[TYPO3-mvc] initializeAction how to instance repository from other extension?
Peter Niederlag
typo3-list at niekom.de
Fri Mar 26 20:38:58 CET 2010
Hello,
Christine Gerpheide schrieb:
> Hi,
Sry, I was a bit unprecise.
Tx_Extbase_Utility_ClassLoader() will only be registered in
initializeClassLoader() in the constructor of Tx_Extbase_Dispatcher()
So It doesn't work if there's no instance of Tx_Extbase_Dispatcher().
Simple workaround:
----------------------------------------------------
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'));
----------------------------------------------------
Duplicate registration of the same callback does not seem to do any
harm, and doesn't end up in multiple registrations. However it would be
possible to check wether it was registered already, by wrapping the code
above like this:
------------------------
if(!in_array(array('Tx_Extbase_Utility_ClassLoader','loadClass'),spl_autoload_functions()))
{
// ... see above
}
------------------------
hth,
Peter
--
Peter Niederlag
http://www.niekom.de * TYPO3 & EDV Dienstleistungen *
More information about the TYPO3-project-typo3v4mvc
mailing list