You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IF Doctrine\ORM\Tools\EntityGenerator::generateEntityStubMethods (auto) generates adder, which will expect the parameter to be {color:red}target entity{color}
WHY would DoctrineModule\Stdlib\Hydrator\Strategy\AllowRemoveByValue::hydrate call this very same adder, passing an {color:red}ArrayCollection{color}
auto generated code:
public function addAnotherEntity(\NameSpace\Entity\AnotherEntity $xy)
{
$this->anotherEntity[] = $xy;
}
outline of a (quick) workaround:
public function addAnotherEntity($xy)
{
if($xy instanceof \NameSpace\Entity\AnotherEntity)
$this->anotherEntity[] = $xy;
if($xy instanceof \Doctrine\Common\Collections\ArrayCollection)
foreach($xy as $entity)
$this->anotherEntity[] = $entity;
}
(Same goes for removing elements from any "to-many"-collection.)
my question\s
Did I miss something on my way?
Is there any way to "enable" some kind of "multi-adding"?
Is there any chance to (further) influence that adding-part with my xml declaration?
Any advice is very welcome.
Maybe I could write my own EntityGenerator. Maybe I should use a custom Hydrator. But right now it seems to me like a little inconsistency in the library.
The text was updated successfully, but these errors were encountered:
Jira issue originally created by user stomalak:
my concern
IF Doctrine\ORM\Tools\EntityGenerator::generateEntityStubMethods (auto) generates adder, which will expect the parameter to be {color:red}target entity{color}
WHY would DoctrineModule\Stdlib\Hydrator\Strategy\AllowRemoveByValue::hydrate call this very same adder, passing an {color:red}ArrayCollection{color}
auto generated code:
outline of a (quick) workaround:
(Same goes for removing elements from any "to-many"-collection.)
my question\s
Did I miss something on my way?
Is there any way to "enable" some kind of "multi-adding"?
Is there any chance to (further) influence that adding-part with my xml declaration?
Any advice is very welcome.
Maybe I could write my own EntityGenerator. Maybe I should use a custom Hydrator. But right now it seems to me like a little inconsistency in the library.
The text was updated successfully, but these errors were encountered: