[TYPO3-dev] Extend extbase extension with new property/field to use in fluid template

Philipp philippwrann at gmx.at
Tue Jul 16 11:30:58 CEST 2013


If you want to add a property to a persistent extbase model you have to:

Add the field to the persistence (ext_tables.sql most likely)
Add the field to the TCA ($GLOBALS['TCA']['tx_extension_domain_model_foo']['columns']['new'] = array('config'=>array('type'=>'passthrough'));
if you want to be able to manage that fields value in the backend you have to adjust the config array

Add the field to the model

namespace VendorName\ExtensionName\Domain\Model;

class NewFoo extends \OrigVendorName\ExtensionName\Domain\Model\Foo {
/** @var \string */
protected $new;
public function setNew($new) {
$this->new = $new;
}
public function getNew($new){
return $this->new;
}
}

Some type hints would be nice

Link the new Model to the existing table using typoscript
plugin.tx_extbase.mapping.VendorName\ExtensionName\Domain\Model\NewFoo = tx_extensionname_domain_model_foo
something like that...

Then also build a Controller and Repository for your purpose. A very clean way would be to add a new type for that model and build a SuperClass.

YA, Thats how complicated it is in typo3 BUT you could also simply alter the original extension, would be much faster but you will have to do those modifications after updates over and over again.



More information about the TYPO3-dev mailing list