0

我刚刚在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);
}

和 ProductRepository :

class Tx_PiProductDetail_Domain_Repository_ProductRepository extends Tx_Extbase_Persistence_Repository { }
4

1 回答 1

1

这与Extbase 中的objectand有关系。reflection caching

TYPO3 4.5你应该truncate手动cache在你的数据库中的所有相关表。我猜 Extbase 对象和反射缓存的相关表是cf_extbase_object, cf_extbase_object_tags,但我不确定。bcf_extbase_reflectioncf_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';
于 2015-05-26T14:02:45.647 回答