[TYPO3-mvc] Extbase 1.3: initializeObject() changed?

roberto blanko robertoblanko at gmail.com
Wed Feb 2 12:17:46 CET 2011


Hello devs,

in my current Extbase extensions, I use initializeObject() in my models to
init attributes, especially ObjectStorages for related objects.

Since the Update to TYPO3 4.5 and therefore Extbase 1.3, I continuesly
encounter PHP errors of the following type:

Fatal error: Call to a member function attach() on a non-object

This happens when I try to attach on object to an attribute that is beeing
initialized as Tx_Extbase_Persistence_ObjectStorage. However in many cases
the attribute remains NULL and the error above is thrown. It seems to me as
if initializeObject() is not called every time the domain object is being
created.

$this->virtualChildren = new Tx_Extbase_Persistence_ObjectStorage();

This is how my initializeObject() looks like:

public function initializeObject()
{
    parent::initializeObject();
    $this->children = new Tx_Extbase_Persistence_ObjectStorage();
}

Important notice: The attribute is not being persisted to a database. It's
just a virtual attribute which contains values during runtime only.

Regards
roberto


More information about the TYPO3-project-typo3v4mvc mailing list