[TYPO3-mvc] Interfaces or abstract classes as action arguments?
Dennis Ahrens
dennis.ahrens at googlemail.com
Fri Jul 2 10:48:49 CEST 2010
Hi Jochen,
Jochen Rau wrote:
> This should already work without passing the class via GET/POST. But you have to configure the class hierarchy via TS. Search this list for "Single Table Inheritance" for an example.
it is not working with and without single table inheritance by
configuring the subclasses in TS.
i've tested for a class where single table inheritance works - when
calling an action looking like this
(Tx_FhhQmdocs_Domain_Model_ContentConfiguration is an abstract class
that has three subclasses configured):
/**
*
* @param Tx_FhhQmdocs_Domain_Model_ContentConfiguration
$contentConfiguration
*/
public function testAction($contentConfiguration) {
}
PHP tells me:
Fatal error: Cannot instantiate abstract class
Tx_FhhQmdocs_Domain_Model_ContentConfiguration in
/home/dahrens/t3/TYPO3_core_svn/t3lib/class.t3lib_div.php on line 5210
I've digged a bit deeper and found out that the ValidatorResolver likes
to instantiate the class that is annotated for the argument.
Here is the end of the stacktrace:
12 t3lib_div::makeInstance("Tx_FhhQmdocs_Domain_Model_ContentConfiguration")
11
Tx_Extbase_Object_Manager::makeInstance("Tx_FhhQmdocs_Domain_Model_ContentConfiguration",
array)
10
Tx_Extbase_Object_Manager::getObject("Tx_FhhQmdocs_Domain_Model_ContentConfiguration")
9
Tx_Extbase_Validation_ValidatorResolver::createValidator("Tx_FhhQmdocs_Domain_Model_ContentConfiguration")
8
Tx_Extbase_Validation_ValidatorResolver::buildMethodArgumentsValidatorConjunctions("Tx_FhhQmdocs_Controller_ContentConfigurationController",
"testAction")
7
Tx_Extbase_MVC_Controller_ActionController::initializeActionMethodValidators()
regards
Dennis
More information about the TYPO3-project-typo3v4mvc
mailing list