findAll на не объект в extbase
Я только что создал расширение в typo3 4.5 с одной моделью (продуктом). Я создал "productRepository", затем внедрил его в ProductController, но я все еще получаю
Call to a member function findAll() on a non-object
Вот как выглядит ProductController:
/**
* @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);
}
и репозиторий продуктов:
class Tx_PiProductDetail_Domain_Repository_ProductRepository extends Tx_Extbase_Persistence_Repository { }
1 ответ
Решение
Это как-то связано с object
а также reflection caching
в Extbase.
В TYPO3 4.5
вам следует truncate
вручную все cache
связанные таблицы в вашей базе данных. Я думаю, что связанные таблицы для объекта Extbase и кэширования отражений cf_extbase_object
, cf_extbase_object_tags
, bcf_extbase_reflection
а также cf_extbase_reflection_tags
но я не уверен.
В TYPO3 4.5
Вы можете избежать проблемы при разработке, добавив это в свой 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';