Probably your setter is not ok. Please check that your telephone setter
method is:
public function setTelephone($telephone)
{
$this->telephone = $telephone;
}
Вопрос
I'm trying to persist a new entity, a "member", which has a contact field. The contact field is another entity, composed of a mail and a phone field. When I try to persist a new member, I add an email and a phone number, but the phone is not persisted. I did a var_dump over the object in my controller, and I found out that the private phone => null
but doctrine added a new attribute : public phones => <the actual phone number>
. This attribute doesnt exist in my entity.. What did I do wrong ? the relation between member and contact is
@ORM\OneToOne(targetEntity="Interne\FichierBundle\Entity\Contact", cascade={"persist", "remove"})
Thanks a lot for your help
EDIT :
result of the var_dump over my"member", for the contact entry :
private 'contact' =>
object(Interne\FichierBundle\Entity\Contact)[891]
private 'id' => null
private 'telephone' => null
private 'email' => string 'test@gmail.com' (length=25)
public 'telephones' => float 2187187392749
As you can see, telephone is empty, but telephones isnt. Problem is, there are no telephones attribute in my entities.
Решение
Probably your setter is not ok. Please check that your telephone setter
method is:
public function setTelephone($telephone)
{
$this->telephone = $telephone;
}