4

I'm asking this question here because I'm having no answer on github.

I'm using the nested tree annotation and supposedly when one save a $food object like that:

$food->setParent($vegetables); 

the update of the parent, lvl and root is done correctly. However since I update to Symfony 2.5 the update of the lvl isn't working anymore, it stays at 0, making this tree extension useless.

I can't even force it (if I manually change the lvl before persisting, after the flush lvl is back to 0)...

Does anyone has the same issue ?

mmmm
  • 3,768
  • 9
  • 36
  • 63
Eagle1
  • 810
  • 2
  • 12
  • 30

1 Answers1

1

Without seeing more of your code it's hard to tell exactly what the issue is.

However I'd recommend trying something like:

$foodRepository = $entityManager->getRepository('AppBundle:Food');
$foodRepository->persistAsFirstChildOf($vegetables, $food);
$entityManager->flush();
Rob Jensen
  • 261
  • 2
  • 6
  • With persistAsLastChildOf($vegetables, $food) method it doesn't update it. With the first it updates it as expected. – Tomsgu Apr 17 '17 at 13:49