Esempio n. 1
0
 /**
  * @param integer[] $ids
  *
  * @return \Claroline\CoreBundle\Entity\Resource\ResourceNode[]
  */
 public function getByIds(array $ids)
 {
     return $this->om->findByIds('Claroline\\CoreBundle\\Entity\\Resource\\ResourceNode', $ids);
 }
Esempio n. 2
0
 public function testFindByIds()
 {
     $oom = $this->mock('Doctrine\\ORM\\EntityManager');
     $query = $this->mock(new Query($oom));
     $oom->shouldReceive('createQuery')->once()->with('SELECT object FROM Foo\\Bar object WHERE object.id IN (:ids)')->andReturn($query);
     $query->shouldReceive('setParameter')->with('ids', array(1, 2))->once();
     $query->shouldReceive('getResult')->once()->andReturn(array('object 1', 'object 2'));
     $om = new ObjectManager($oom);
     $this->assertEquals(array('object 1', 'object 2'), $om->findByIds('Foo\\Bar', array(1, 2)));
 }