[TYPO3-mvc] confusion with object manager in CommandController context
Domi
djgarms at gmail.com
Mon Jan 28 01:16:24 CET 2013
Hello,
I start using the objectManager,now DI is working properly.
For getting cObject for typolinks I added this service:
require_once(PATH_tslib . 'class.tslib_fe.php');
require_once(PATH_t3lib . 'class.t3lib_userauth.php');
require_once(PATH_tslib . 'class.tslib_feuserauth.php');
require_once(PATH_t3lib . 'class.t3lib_cs.php');
require_once(PATH_tslib . 'class.tslib_content.php');
require_once(PATH_t3lib . 'class.t3lib_tstemplate.php');
require_once(PATH_t3lib . 'class.t3lib_page.php');
class Tx_Intranet_Service_BuildTsfeService implements t3lib_Singleton {
function buildTSFE() {
if (!is_object($GLOBALS['TT'])) {
$GLOBALS['TT'] = new t3lib_timeTrack;
$GLOBALS['TT']->start();
}
$TSFEclassName = t3lib_div::makeInstance('tslib_fe');
$GLOBALS['TSFE'] = new $TSFEclassName($GLOBALS['TYPO3_CONF_VARS'],
$pid = 1, '0', 1, '', '', '', '');
$GLOBALS['TSFE']->connectToDB();
$GLOBALS['TSFE']->initFEuser();
$GLOBALS['TSFE']->fetch_the_id();
$GLOBALS['TSFE']->getPageAndRootline();
$GLOBALS['TSFE']->initTemplate();
$GLOBALS['TSFE']->tmpl->getFileName_backPath = PATH_site;
$GLOBALS['TSFE']->forceTemplateParsing = 1;
$GLOBALS['TSFE']->getConfigArray();
}
}
With buildTsfe I can make use of tslib_cObj and then typolink and all
other goodies are possible in cronjobs.
Regards,
Dominic
More information about the TYPO3-project-typo3v4mvc
mailing list