I have a form in which I want to make values of the input set up by using {{app.user.mail_2}} but when I do I get an error:
Neither the property "mail_2" nor one of the methods "mail_2()", >"getmail_2()"/"ismail_2()"/"hasmail_2()" or "__call()" exist and have public >access in class "BAJ\BookingBundle\Entity\Drivers".
I already used it for name and it works.
Here's my html.twig code
<div class="clear"></div>
<div id="email-2" class="form_element email-facultatif">
<div>2ème e-mail (facultatif)</div>
<input type="email" class="email-mobile-width"
name="drivers[email_2]" placeholder="EMAIL" value="{{ app.user.mail_2 }}"
style="border-bottom-right-radius: 0px;border-top-right-radius: 0px;width:
224px;"/>
<div class="email-facultatif-block" id="email-2-img"><img
src="{{ asset('bundles/bajbooking/images/moin-
icon.png') }}" style="width: 41px;"></div>
</div>
and this is my entity
/**
* Drivers
*
* @ORM\Table(name="drivers")
* @ORM\Entity(repositoryClass="BAJ\BookingBundle\Repository\DriversRepository ")
*/
class Drivers extends BaseUser
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var string
*
* @ORM\Column(name="license_date", type="string", length=255, nullable=true)
*/
private $licenseDate;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=255, nullable=true)
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="civility", type="string", length=255, nullable=true)
*/
private $civility;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255, nullable=true)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="first_name", type="string", length=255, nullable=true)
*/
private $firstName;
/**
* @var string
*
* @ORM\Column(name="date_of_brith", type="string", nullable=true)
*/
private $dateOfBrith;
/**
* @var string
*
* @ORM\Column(name="phone", type="string", length=255, nullable=true)
*/
private $phone;
/**
* @var string
*
* @ORM\Column(name="address", type="string", length=255, nullable=true)
*/
private $address;
/**
* @var string
*
* @ORM\Column(name="second_address", type="string", length=255, nullable=true)
*/
private $second_address;
/**
* @var string
*
* @ORM\Column(name="postal_code", type="string", length=255, nullable=true)
*/
private $postalCode;
/**
* @var string
*
* @ORM\Column(name="city", type="string", length=255, nullable=true)
*/
private $city;
/**
* @var string
*
* @ORM\Column(name="country", type="string", length=255, nullable=true)
*/
private $country;
/**
* @var string
*
* @ORM\Column(name="mail_2", type="string", length=255, nullable=true)
*/
private $mail_2;
/**
* @var string
*
* @ORM\Column(name="mail_3", type="string", length=255, nullable=true)
*/
private $mail_3;
/**
* @var string
*
* @ORM\Column(name="mail_4", type="string", length=255, nullable=true)
*/
private $mail_4;
/**
* @var string
*
* @ORM\Column(name="mail_5", type="string", length=255, nullable=true)
*/
private $mail_5;
/**
* @var string
*
* @ORM\Column(name="phone_2", type="string", length=255, nullable=true)
*/
private $phone_2;
/**
* @var string
*
* @ORM\Column(name="phone_3", type="string", length=255, nullable=true)
*/
private $phone_3;
/**
* @var string
*
* @ORM\Column(name="phone_4", type="string", length=255, nullable=true)
*/
private $phone_4;
/**
* @var string
*
* @ORM\Column(name="phone_5", type="string", length=255, nullable=true)
*/
private $phone_5;
/**
* @ORM\OneToMany(targetEntity="Booking", mappedBy="driver")
*/
private $bookings;
public function __construct() {
$this->bookings = new ArrayCollection();
parent::__construct();
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set licenseDate
*
* @param \DateTime $licenseDate
*
* @return Drivers
*/
public function setLicenseDate($licenseDate)
{
$this->licenseDate = $licenseDate;
return $this;
}
/**
* Get licenseDate
*
* @return \DateTime
*/
public function getLicenseDate()
{
return $this->licenseDate;
}
/**
* Set title
*
* @param string $title
*
* @return Drivers
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set civility
*
* @param string $civility
*
* @return Drivers
*/
public function setCivility($civility)
{
$this->civility = $civility;
return $this;
}
/**
* Get civility
*
* @return string
*/
public function getCivility()
{
return $this->civility;
}
/**
* Set name
*
* @param string $name
*
* @return Drivers
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set firstName
*
* @param string $firstName
*
* @return Drivers
*/
public function setFirstName($firstName)
{
$this->firstName = $firstName;
return $this;
}
/**
* Get firstName
*
* @return string
*/
public function getFirstName()
{
return $this->firstName;
}
/**
* Set dateOfBrith
*
* @param \DateTime $dateOfBrith
*
* @return Drivers
*/
public function setDateOfBrith($dateOfBrith)
{
$this->dateOfBrith = $dateOfBrith;
return $this;
}
/**
* Get dateOfBrith
*
* @return \DateTime
*/
public function getDateOfBrith()
{
return $this->dateOfBrith;
}
/**
* Add booking
*
* @param \BAJ\BookingBundle\Entity\Booking $booking
*
* @return Drivers
*/
public function addBooking(\BAJ\BookingBundle\Entity\Booking $booking)
{
$this->bookings[] = $booking;
return $this;
}
/**
* Remove booking
*
* @param \BAJ\BookingBundle\Entity\Booking $booking
*/
public function removeBooking(\BAJ\BookingBundle\Entity\Booking $booking)
{
$this->bookings->removeElement($booking);
}
/**
* Get bookings
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getBookings()
{
return $this->bookings;
}
/**
* Set phone
*
* @param string $phone
*
* @return Drivers
*/
public function setPhone($phone)
{
$this->phone = $phone;
return $this;
}
/**
* Get phone
*
* @return string
*/
public function getPhone()
{
return $this->phone;
}
/**
* Set address
*
* @param string $address
*
* @return Drivers
*/
public function setAddress($address)
{
$this->address = $address;
return $this;
}
/**
* Get address
*
* @return string
*/
public function getAddress()
{
return $this->address;
}
/**
* Set secondAddress
*
* @param string $secondAddress
*
* @return Drivers
*/
public function setSecondAddress($secondAddress)
{
$this->second_address = $secondAddress;
return $this;
}
/**
* Get secondAddress
*
* @return string
*/
public function getSecondAddress()
{
return $this->second_address;
}
/**
* Set postalCode
*
* @param string $postalCode
*
* @return Drivers
*/
public function setPostalCode($postalCode)
{
$this->postalCode = $postalCode;
return $this;
}
/**
* Get postalCode
*
* @return string
*/
public function getPostalCode()
{
return $this->postalCode;
}
/**
* Set city
*
* @param string $city
*
* @return Drivers
*/
public function setCity($city)
{
$this->city = $city;
return $this;
}
/**
* Get city
*
* @return string
*/
public function getCity()
{
return $this->city;
}
/**
* Set country
*
* @param string $country
*
* @return Drivers
*/
public function setCountry($country)
{
$this->country = $country;
return $this;
}
/**
* Get country
*
* @return string
*/
public function getCountry()
{
return $this->country;
}
/**
* Set mail2
*
* @param string $mail2
*
* @return Drivers
*/
public function setMail2($mail2)
{
$this->mail_2 = $mail2;
return $this;
}
/**
* Get mail2
*
* @return string
*/
public function getMail2()
{
return $this->mail_2;
}
/**
* Set mail3
*
* @param string $mail3
*
* @return Drivers
*/
public function setMail3($mail3)
{
$this->mail_3 = $mail3;
return $this;
}
/**
* Get mail3
*
* @return string
*/
public function getMail3()
{
return $this->mail_3;
}
/**
* Set mail4
*
* @param string $mail4
*
* @return Drivers
*/
public function setMail4($mail4)
{
$this->mail_4 = $mail4;
return $this;
}
/**
* Get mail4
*
* @return string
*/
public function getMail4()
{
return $this->mail_4;
}
/**
* Set mail5
*
* @param string $mail5
*
* @return Drivers
*/
public function setMail5($mail5)
{
$this->mail_5 = $mail5;
return $this;
}
/**
* Get mail5
*
* @return string
*/
public function getMail5()
{
return $this->mail_5;
}
/**
* Set phone2
*
* @param string $phone2
*
* @return Drivers
*/
public function setPhone2($phone2)
{
$this->phone_2 = $phone2;
return $this;
}
/**
* Get phone2
*
* @return string
*/
public function getPhone2()
{
return $this->phone_2;
}
/**
* Set phone3
*
* @param string $phone3
*
* @return Drivers
*/
public function setPhone3($phone3)
{
$this->phone_3 = $phone3;
return $this;
}
/**
* Get phone3
*
* @return string
*/
public function getPhone3()
{
return $this->phone_3;
}
/**
* Set phone4
*
* @param string $phone4
*
* @return Drivers
*/
public function setPhone4($phone4)
{
$this->phone_4 = $phone4;
return $this;
}
/**
* Get phone4
*
* @return string
*/
public function getPhone4()
{
return $this->phone_4;
}
/**
* Set phone5
*
* @param string $phone5
*
* @return Drivers
*/
public function setPhone5($phone5)
{
$this->phone_5 = $phone5;
return $this;
}
/**
* Get phone5
*
* @return string
*/
public function getPhone5()
{
return $this->phone_5;
}
}