[TYPO3-mvc] initializeAction how to instance repository from other extension?

Christine Gerpheide cgerpheide at gmail.com
Mon Mar 29 20:04:09 CEST 2010


2010/3/26 Peter Niederlag <typo3-list at niekom.de>

> Hello,
>
>  ----------------------------------------------------
> if (!class_exists('Tx_Extbase_Utility_ClassLoader')) {
>        require(t3lib_extmgm::extPath('extbase') .
> 'Classes/Utility/ClassLoader.php');
>    }
> $classLoader = new Tx_Extbase_Utility_ClassLoader();
> spl_autoload_register(array($classLoader, 'loadClass'));
> ----------------------------------------------------
>
> hth,
> Peter
> --
> Peter Niederlag
> http://www.niekom.de * TYPO3 & EDV Dienstleistungen *
>
>
Hi Peter,

Forgive me, again this is a little over my head (but it's pretty important
to my extension that I can instatiate a repository within this hook..
somehow).

Based on what you said above, I have almost the same thing and then try to
instantiate the class using t3lib_div::makeInstance().  Is that how I'm
supposed to be using what you stated above?  I'm currently still getting the
fatal error that *"*Class 'Tx_MyExt_Domain_Repository_CampaignRepository'
not found in *C:\sites\ecampaign\t3lib\class.t3lib_div.php* on line *4943"*
---
if (!class_exists('Tx_Extbase_Utility_ClassLoader')) { //already exists,
doesn't come in here

require(t3lib_extmgm::extPath('extbase').'Classes/Utility/ClassLoader.php');
}
 $classLoader = new Tx_Extbase_Utility_ClassLoader();
spl_autoload_register(array($classLoader, 'loadClass'));
 if(class_exists('Tx_Extbase_Dispatcher')){ //does exist
echo "exists";}
 $campaignRepository =
t3lib_div::makeInstance('Tx_MyExt_Domain_Repository_CampaignRepository');
---

Really, thank you _very_ much for your help here,
Christine


More information about the TYPO3-project-typo3v4mvc mailing list