static function threeItems(EntityManager $em, $parentId, $name = '')
 {
     $i1 = OrderedItemWithParent::build('i 1' . $name, $parentId);
     $i2 = OrderedItemWithParent::build('i 2' . $name, $parentId);
     $i3 = OrderedItemWithParent::build('i 3' . $name, $parentId);
     $i4 = OrderedItemWithParent::build('i 4' . $name, $parentId);
     $repo = $em->getRepository('Gradua\\DoctrineExtensions\\OrderedItem\\ExampleEntities\\OrderedItemWithParent');
     $repo->addLast($i1);
     $repo->addLast($i2);
     $repo->addLast($i3);
     $repo->addLast($i4);
     //        $em->persist($i1);
     //        $em->persist($i2);
     //        $em->persist($i3);
     //        $em->persist($i4);
     $em->flush();
     $em->remove($i3);
     $em->flush();
     //\Dbg::x('ate que vai');
     return array($i1->getId(), $i2->getId(), $i4->getId());
 }
         $repo = $em->getRepository('Gradua\\DoctrineExtensions\\OrderedItem\\ExampleEntities\\OrderedItemWithParent');
         $i2 = $repo->find($fixtureIds[1]);
         $item = OrderedItemWithParent::build('o', $parentId);
         $repo->addAfter($item, $i2);
         $em->flush();
         $items = $repo->findAllByParent($parentId);
         expect($items[0]->getId())->should('be', $fixtureIds[0]);
         expect($items[1]->getId())->should('be', $fixtureIds[1]);
         expect($items[2]->getId())->should('be', $item->getId());
         expect($items[3]->getId())->should('be', $fixtureIds[2]);
     });
     it('should add one item before another existing one (no such position on the database, should do no batch update query)', function () use(&$fixtureIds, &$parentId) {
         $em = Project::sc()->em();
         $repo = $em->getRepository('Gradua\\DoctrineExtensions\\OrderedItem\\ExampleEntities\\OrderedItemWithParent');
         $i3 = $repo->find($fixtureIds[2]);
         $item = OrderedItemWithParent::build('o', $parentId);
         $repo->addBefore($item, $i3);
         $em->flush();
         $items = $repo->findAllByParent($parentId);
         expect($items[0]->getId())->should('be', $fixtureIds[0]);
         expect($items[1]->getId())->should('be', $fixtureIds[1]);
         expect($items[2]->getId())->should('be', $item->getId());
         expect($items[3]->getId())->should('be', $fixtureIds[2]);
     });
 });
 describe('getPrevious() and getNext()', function () {
     $fixtureIds = null;
     $parentId = 2;
     beforeEach(function () use(&$fixtureIds, &$parentId) {
         Project::sc()->createService('EntityManager');
         $em = Project::sc()->em();