I just created an extension in typo3 4.5 with one model (product). I created the "productRepository" then injected it in the ProductController but I still get the
Call to a member function findAll() on a non-object
here is how the ProductController looks like :
/**
* @var Tx_PiProductDetail_Domain_Repository_ProductRepository
*/
protected $productRepository;
/**
* @param Tx_PiProductDetail_Domain_Repository_ProductRepository $productRepository
* @return void
*/
public function injectProductRepository(Tx_PiProductDetail_Domain_Repository_ProductRepository $productRepository) {
$this->productRepository = $productRepository;
}
/**
* action list
*
* @return void
*/
public function listAction() {
$products = $this->productRepository->findAll();
$this->view->assign('products', $products);
}
and the ProductRepository :
class Tx_PiProductDetail_Domain_Repository_ProductRepository extends Tx_Extbase_Persistence_Repository { }
This has something to do with the
objectandreflection cachingin Extbase.In
TYPO3 4.5you shouldtruncatemanually allcacherelated tables in your database. I guess the related tables for the Extbase object and reflection caching arecf_extbase_object,cf_extbase_object_tags,bcf_extbase_reflectionandcf_extbase_reflection_tagsbut I'm not sure.In
TYPO3 4.5you can avoid the problem while developing by adding this to yourtypo3conf/localconf.php: