function loadEntities($resource, $page, $ipp, $relations = array())
 {
     $instance = new $resource();
     // @FIXME! $resource is actually the resource namespace.
     $repository = Mapper::mapRepository($resource, $instance);
     if ($this->criteria) {
         $repository->criteria($this->criteria);
     }
     if ($relations) {
         $repository->with($relations);
         return $repository->paginate($ipp, $page);
     } else {
         return $repository->paginate($ipp, $page);
     }
 }
 public function testMapRepositoryFromConfig()
 {
     \App::shouldReceive('make')->andReturn(new PersonRepository(new Person()));
     $repository = Mapper::mapRepository('person');
     $this->assertEquals('Tests\\Foothing\\RepositoryController\\Resources\\PersonRepository', get_class($repository));
 }