[TYPO3-mvc] How to set default values for a new Model object?

Armin Rüdiger Vieweg info at professorweb.de
Sat Mar 19 13:30:04 CET 2011


> private function createEmptyObject() {
> 	$object =  
> $this->objectManager->create('Tx_Extkey_Domain_Model_ObjectName');
> 	$object->setSomeDefaultValue($this->settings['defaults']['someDefaultValue']);
> 	return $object;
> }

If possible I would set the default values for a model in its attributes:

class Tx_Extension_Domain_Model_Person extends  
Tx_Extbase_DomainObject_AbstractEntity {
	protected $firstname = 'John';
	protected $name = 'Doe';
	// ...
}

Best Regards
Armin


More information about the TYPO3-project-typo3v4mvc mailing list