I have the following code in a service:
$position = 1;
// Update all genres with new position
foreach ($genres as $key => $value)
{
${"genre" . $position} =
$this->getRepository()->findOneById($key);
${"genre" . $position} ->setRanking($position);
$this->getObjectManager()->merge(${"genre" . $position} );
++$position;
}
$this->getObjectManager()->flush();
Every time I call it two need to be updated, however it only updates the
first, even though I pass the right arguments.
What could I be doing wrong here?
I thought it might have to do with the reference, so I dynamically assignes
variable names in order to prevent that isssue.
But still the second object isn't updated.
Could someone please give me an insight?
Thanks.
--
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.