private function populate()
 {
     $root = new RootCategory();
     $root->setTitle("Food");
     $root2 = new RootCategory();
     $root2->setTitle("Sports");
     $child = new RootCategory();
     $child->setTitle("Fruits");
     $child->setParent($root);
     $child2 = new RootCategory();
     $child2->setTitle("Vegitables");
     $child2->setParent($root);
     $childsChild = new RootCategory();
     $childsChild->setTitle("Carrots");
     $childsChild->setParent($child2);
     $potatoes = new RootCategory();
     $potatoes->setTitle("Potatoes");
     $potatoes->setParent($child2);
     $this->em->persist($root);
     $this->em->persist($root2);
     $this->em->persist($child);
     $this->em->persist($child2);
     $this->em->persist($childsChild);
     $this->em->persist($potatoes);
     $this->em->flush();
 }
 private function populate()
 {
     $repo = $this->em->getRepository(self::ROOT_CATEGORY);
     $food = new RootCategory();
     $food->setTitle('Food');
     $fruits = new RootCategory();
     $fruits->setTitle('Fruits');
     $vegitables = new RootCategory();
     $vegitables->setTitle('Vegitables');
     $milk = new RootCategory();
     $milk->setTitle('Milk');
     $meat = new RootCategory();
     $meat->setTitle('Meat');
     $oranges = new RootCategory();
     $oranges->setTitle('Oranges');
     $citrons = new RootCategory();
     $citrons->setTitle('Citrons');
     $repo->persistAsFirstChild($food)->persistAsFirstChildOf($fruits, $food)->persistAsFirstChildOf($vegitables, $food)->persistAsLastChildOf($milk, $food)->persistAsLastChildOf($meat, $food)->persistAsFirstChildOf($oranges, $fruits)->persistAsFirstChildOf($citrons, $fruits);
     $this->em->flush();
 }