Hi Matthews, Thanks by your feedback.
/**
* @var Address
* @ORM\OneToMany(targetEntity="Address", mappedBy="adrsUsr",
cascade={"remove"}, orphanRemoval=true)
*/
private $address;
/**
* Constructor
*/
public function __construct(array $options = array()) {
$hydrator = new Hydrator\ClassMethods;
$hydrator->hydrate($options, $this);
$this->address = new ArrayCollection();
}
public function setAddress($address) {
if (!($address instanceof \User\Entity\Address) && null !=
$address):
throw new \InvalidArgumentException('Typo de variável não
corresponde ao esperado. Esperado:\User\Entity\Address.', 10601);
endif;
$this->getAddress->add($address);
return $this;
}
The problem is not limited to this entity.
In any entity using the ArrayCollection can only rescue after reflsh.
Em segunda-feira, 16 de fevereiro de 2015 18:02:04 UTC-2, Matthew Stuart
escreveu:
>
> It's always helpful to see your code, pure integration lines don't give us
> an idea of what's going on in the background and able to provide targeted
> help.
>
> Some things top of my head, sounds like a OneToMany relationship (due to
> the count) between User -> Address but the {{setAddress}} function naming
> sounds "singular":
> * The user {{__construct}} isn't initializing the addresses internal
> variable to an {{ArrayCollection}}
> * The {{setAddress}} function isn't adding to the internal {{addresses}}
> collection
> * The {{getAddress}} function is doing something beyond standard..
>
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.