[TYPO3-mvc] Using Repository outside extbase
Jochen Rau
jochen.rau at typoplanet.de
Sun Jul 12 05:13:37 CEST 2009
Hi.
Joerg Schoppet wrote:
> actually I'm using an itemProcFunction to generate a custom menu.
>
> within the function I instantiate an own Repository-Class.
>
> Before the persistence-rewrite, I simple used:
> $this->catRepository =
> t3lib_div::makeInstance('Tx_MyExample_Domain_Model_CatRepository');
>
>
> Now I always get the following error:
> Catchable fatal error: Argument 1 passed to
> Tx_Extbase_Persistence_Manager::__construct() must be an instance of
> Tx_Extbase_Persistence_BackendInterface, none given, called in
> /var/www/model/web/typo3_4.3svn/t3lib/class.t3lib_div.php on line 4828
> and defined in
> /var/www/model/web/extbase/Classes/Persistence/Manager.php on line 59
This happens because inside the constructor of the
Tx_Extbase_Persistence_Repository there is the following line
$this->persistenceManager =
t3lib_div::makeInstance('Tx_Extbase_Persistence_Manager'); // singleton;
must have been initialized before (constructor argument)
My technique to (mis)use a singleton as a "global" object is indeed not
very clever (well, maybe "clever" but not "smart" ;-) ).
I will change this on Monday.
Regards
Jochen
--
Every nit picked is a bug fixed
More information about the TYPO3-project-typo3v4mvc
mailing list