[TYPO3-dev] Repository class not injected correctly

Ivano Luberti luberti at archicoop.it
Sat Aug 2 10:28:54 CEST 2014


Could it be that you declared wrongly $forumRepository then corrected it
and TYPO3 is no recognizing the changes?

Have you tried cleaning the cache? You should go to the Install Tool and
select Important Actions (up left).
Scrollling donw you should see buttons "Clear all Cache" and  "Clear PHP
op code cache"

Use both and reload the page.




Il 01/08/2014 23:36, Dirk Ho ha scritto:
> Hi all,
>
> I'm still coding a test project (a forum) and in this project, I get
> an error that I do not understand.
>
> When I use my list and add method for categories, everything works
> fine, but when I try to select a forum in my forumController with the
> forumRepository, I get an exception, that the method findAll does not
> exist.
>
> Here's the source code that I checked several times against my
> (working) CategoryController and cannot find any difference (except
> the names of the Controller / Repository):
>
> /**
>  * ForumController
>  */
> class ForumController extends
> \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
>
>     /**
>      * forumRepository
>      *
>      * @var \DH\Forum\Domain\Repository\ForumRepository
>      * @inject
>      */
>     protected $forumRepository = NULL;
>
>     /**
>      * persistenceManager
>      *
>      * @var \TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager
>      * @inject
>      */
>     protected $persistenceManager;
>
>     /**
>      * action list
>      *
>      * @return void
>      */
>     public function listAction() {
>         $logger =
> \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Core\Log\LogManager')->getLogger(__CLASS__);
>
>         $logger->info('Forum List START');
>
>        if (!($this->forumRepository instanceof ForumRepository)) {
>             $logger->info('No valid forumRepositoryObj' .
>             get_class($this->forumRepository));
>         }
>
>         $forums = $this->forumRepository->findAll();
>
>         $this->view->assign('forums', $forums);
>
>         $logger->info('Forum List END');
>     }
> }
>
> In my case, the logger logs, that $this->forumRepository is
> "\DH\Forum\Controller\ForumController"???
>
> May you please help me what I do wrong injecting the ForumRepository?
>
> My ForumRepository class looks like
>
> /**
>  * The repository for Forums
>  */
> class ForumRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
>      // Nothing in here
> }
>
> I don't know what I may try. I also created a dummy entry in db to
> ensure the error does not occure because on non-existing datasets in
> the db.
>
> Thanks and best wishes,
>
> Dirk
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev
>

-- 
==================================================
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==================================================




More information about the TYPO3-dev mailing list