Ejemplo n.º 1
0
 public function testCascadePersistTree()
 {
     $politics = new Category();
     $politics->setTitle('Politics');
     $news = new News('Lorem ipsum', $politics);
     $this->em->persist($news);
     $this->em->flush();
     $closure = $this->em->createQueryBuilder()->select('c')->from(self::CLOSURE, 'c')->where('c.ancestor = :ancestor')->setParameter('ancestor', $politics->getId())->getQuery()->getResult();
     $this->assertCount(1, $closure);
 }