Stof Doctrine扩展:Tree lvl不会更新

时间:2021-08-13 06:47:49

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

我在这里问这个问题,因为我在github上没有回答。

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

我正在使用嵌套的树注释,据说当一个人保存一个$ food对象时:

$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.

父,lvl和root的更新正确完成。但是,由于我更新到Symfony 2.5,lvl的更新不再起作用,它保持为0,使得这个树扩展无用。

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

我甚至不能强迫它(如果我在持续之前手动更改lvl,在flush lvl返回0之后)...

Does anyone has the same issue ?

有没有人有同样的问题?

1 个解决方案

#1


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();

#1


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();