[TYPO3-mvc] ItemsRepository: Fatal error: Call to a member function createQuery()
Muriel le Pair
typo3 at strangefruit.nl
Tue Jun 24 14:31:25 CEST 2014
Hi,
My ItemsRepository looks like this:
class ItemsRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
/**
* Find top 5
*
* @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
*/
public function findTop5() {
$query = $this->itemsRepository->createQuery();
$query->matching($query->equals('top5', 1));
$query->setLimit(5);
$query->execute();
return $query;
}
}
When I run the code below, I get a Fatal error: Call to a member
function createQuery()
class ItemsController extends
\TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
/**
* action listTop5
*
* @return void
*/
public function listTop5Action() {
$itemss = $this->itemsRepository->findTop5();
$this->view->assign('itemss', $itemss);
}
}
But when I insert the code directly to the ItemsController it works fine.
class ItemsController extends
\TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
/**
* action listTop5
*
* @return void
*/
public function listTop5Action() {
$query = $this->itemsRepository->createQuery();
$query->matching($query->equals('top5', 1));
$query->setLimit(5);
$itemss = $query->execute();
}
}
The odd thing is that it works in another extension.
So what am I doing wrong?
--
kind regards,
Muriel le Pair
More information about the TYPO3-project-typo3v4mvc
mailing list