extbase中非对象上的findAll [英] findAll on non object in extbase

查看:101
本文介绍了extbase中非对象上的findAll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚用一个模型(产品)在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中的objectreflection caching有关.

This has something to do with the object and reflection caching in Extbase.

TYPO3 4.5中,您应该手动truncate数据库中所有与cache相关的表.我猜想Extbase对象和反射缓存的相关表是cf_extbase_objectcf_extbase_object_tagsbcf_extbase_reflectioncf_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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆