arakibi
arakibi

Reputation: 447

findAll on non object in extbase

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 { }

Upvotes: 0

Views: 673

Answers (1)

Arek van Schaijk
Arek van Schaijk

Reputation: 1442

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

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.

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';

Upvotes: 1

Related Questions