extbase中非对象上的findAll [英] findAll on non object in extbase
问题描述
我刚刚用一个模型(产品)在typo3 4.5中创建了一个扩展.我创建了"productRepository",然后将其注入到ProductController中,但仍然得到
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
这是ProductController的外观:
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);
}
和ProductRepository:
and the ProductRepository :
class Tx_PiProductDetail_Domain_Repository_ProductRepository extends Tx_Extbase_Persistence_Repository { }
推荐答案
这与Extbase中的object
和reflection caching
有关.
This has something to do with the object
and reflection caching
in Extbase.
在TYPO3 4.5
中,您应该手动truncate
数据库中所有与cache
相关的表.我猜想Extbase对象和反射缓存的相关表是cf_extbase_object
,cf_extbase_object_tags
,bcf_extbase_reflection
和cf_extbase_reflection_tags
,但是我不确定.
In TYPO3 4.5
you should truncate
manually all cache
related tables in your database. I guess the related tables for the Extbase object and reflection caching are cf_extbase_object
, cf_extbase_object_tags
, bcf_extbase_reflection
and cf_extbase_reflection_tags
but I'm not sure.
在TYPO3 4.5
中,您可以通过将其添加到typo3conf/localconf.php
中来避免该问题:
In TYPO3 4.5
you can avoid the problem while developing by adding this to your typo3conf/localconf.php
:
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['extbase_reflection']['backend'] = 't3lib_cache_backend_NullBackend';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['extbase_object']['backend'] = 't3lib_cache_backend_NullBackend';
这篇关于extbase中非对象上的findAll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!