Reputation: 1593
I got a commandController like this (using TYPO3 6.1):
class MyCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\CommandController {
/**
* fileRepository
*
* @var \VENDOR\MyExt\Domain\Repository\FileRepository
* @inject
*/
protected $fileRepository;
}
but when i try cast
$this->fileRepository->findAll();
i get:
Fatal error: Call to a member function findAll() on a non-object in
looks like the repostory is not autoinjected with @inject like it is in ActionControllers.
How do i inject the repository manually?
Upvotes: 3
Views: 6163
Reputation: 898
If you add the following to your users or groups TSConfig, you'll be able to clear the system caches also via the "flash" menu in the top right corner, not only in install tool:
options.clearCache.system = 1
Upvotes: 1
Reputation: 42622
Indeed, you need to clear the caches. Apparently in my case on Typo3 6.2 it only worked when I cleared the caches from the Install tool.
Note: I got this tip after reading a blog post on scripting-base.de (in German).
Upvotes: 5
Reputation: 524
you can inject repositories in your commandcontroller. after adding a @inject in your doccomments you have to delete the cache and/or the cachefiles?
Upvotes: 6