initializeTreeRepository($this->getEntityManager(), $this->getClassMetadata()); } public function create(CLpItem $item): void { $this->getEntityManager()->persist($item); $this->getEntityManager()->flush(); } public function getRootItem(int $lpId): ?CLpItem { return $this->findOneBy([ 'path' => 'root', 'lp' => $lpId, ]); } public function findItemsByLearningPathAndType(int $learningPathId, string $itemType): array { $qb = $this->createQueryBuilder('i') ->where('i.lp = :learningPathId') ->andWhere('i.itemType = :itemType') ->setParameter('learningPathId', $learningPathId) ->setParameter('itemType', $itemType) ; $query = $qb->getQuery(); return $query->getResult(); } }