[TYPO3-mvc] Extbase objects only partly (uid, pid) filled

Philipp Wrann philippwrann at gmail.com
Wed Nov 12 08:37:55 CET 2014


Dont know for sure about the correct usage of those:
$GLOBALS['TSFE']->connectToDB();
Frontend\Utility\EidUtility::connectDB();

But this does the job inlcl. TCA/DB/Typoscript.... so basically a full Bootstrap:
I didnt integrate a Access controll for plugin/controller/action combinations, if you use Controllers with CRUD methods, you may want to look at that.


/**
 * Todo:
 *  - Access Protection
 */

use TYPO3\CMS\Core\Utility\GeneralUtility as Utility;
use TYPO3\CMS\Frontend;

//determine id
$id = $_REQUEST['id'] ? (integer) $_REQUEST['id'] : 1;
$GLOBALS['TSFE'] = Utility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController',$TYPO3_CONF_VARS,$id,0);
/* @var $GLOBALS['TSFE'] Frontend\Controller\TypoScriptFrontendController */
$GLOBALS['TSFE']->connectToDB();
$GLOBALS['TSFE']->includeTCA();
$GLOBALS['TSFE']->initFEuser();
$GLOBALS['TSFE']->checkAlternativeIdMethods();
$GLOBALS['TSFE']->clear_preview();
$GLOBALS['TSFE']->determineId();
$GLOBALS['TSFE']->initTemplate();
$GLOBALS['TSFE']->getConfigArray();
$GLOBALS['TSFE']->settingLanguage();
$GLOBALS['TSFE']->settingLocale();
//Connect to database
Frontend\Utility\EidUtility::connectDB();

$configuration = array(
	'extensionName' => NULL,
	'controllerName' => NULL,
	'vendorName' => NULL,
	'actionName' => NULL,
	'pluginName' => NULL,
	'arguments' => array()
);

$origRequest = $_REQUEST;

foreach (array_keys($configuration) as $arg) {
	if ($origRequest[$arg]) $configuration[$arg] = $origRequest[$arg];
}

$bootstrap = Utility::makeInstance('TYPO3\\CMS\\Extbase\\Core\\Bootstrap');
/* @var $bootstrap \TYPO3\CMS\Extbase\Core\Bootstrap */
$bootstrap->initialize($configuration);
$objectManager = Utility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
/* @var $objectManager \TYPO3\CMS\Extbase\Object\ObjectManagerInterface */
$request = $objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request');
/* @var $request \TYPO3\CMS\Extbase\Mvc\Web\Request */
if ($configuration['vendorName'] !== NULL) {
	$request->setControllerVendorName($configuration['vendorName']);
}
$request->setControllerExtensionName($configuration['extensionName']);
$request->setPluginName($configuration['pluginName']);
$request->setControllerName($configuration['controllerName']);
$request->setControllerActionName($configuration['actionName']);
$request->setArguments($configuration['arguments']);
$response = $objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Response');
/* @var $response \TYPO3\CMS\Extbase\Mvc\Web\Response */
$dispatcher = $objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Dispatcher');
/* @var $dispatcher \TYPO3\CMS\Extbase\Mvc\Dispatcher */
$dispatcher->dispatch($request, $response);
$response->sendHeaders();
$content = $response->getContent();
echo $content;


More information about the TYPO3-project-typo3v4mvc mailing list