/** * Set the $node at the last position of the $parent. * * @param \Claroline\CoreBundle\Entity\Resource\ResourceNode $parent * @param \Claroline\CoreBundle\Entity\Resource\ResourceNode $node */ public function setLastIndex(ResourceNode $parent, ResourceNode $node, $autoflush = true) { $max = $this->resourceNodeRepo->findLastIndex($parent); $node->setIndex($max + 1); $this->om->persist($node); if ($autoflush) { $this->om->flush(); } }