Código PHP:
/**
*
* @ORM\Entity(repositoryClass="Blog\Repository\CategoryRepository")
* @ORM\Table(name="post_categories")
* @ORM\Entity
*/
class Category
{
module/Blog/src/Blog/Repository\CategoryRepository.php
en mi controlador
Código PHP:
namespace BlogController;
use ZendMvcControllerAbstractActionController;
use ZendViewModelViewModel;
use DoctrineORMEntityManager;
use DoctrineCommonCollectionsArrayCollection;
use DoctrineModulePaginatorAdapterCollection as Adapter;
use ZendPaginatorPaginator;
class CategoryController extends AbstractActionController
{
protected $entityManager;
protected function setEntityManager(EntityManager $em)
{
$this->entityManager = $em;
return $this;
}
protected function getEntityManager()
{
if (is_null($this->entityManager))
{
$this->setEntityManager($this->getServiceLocator()->get('Doctrine\ORM\EntityManager'));
}
return $this->entityManager;
}
public function indexAction()
{
$em = $this->getEntityManager();
$categories = $em->getRepository('Blog\Entity\Category');
$paginator = new Paginator(new Adapter($categories->ListCategoryQuery()));
$paginator
->setCurrentPageNumber(1)
->setItemCountPerPage(5);
return new ViewModel(
array(
'categories' => $paginator
)
);
}
Undefined method 'ListCategoryQuery'. The method name must start with either findBy or findOneBy!