[TYPO3-mvc] odd relational issue with attach

Toke Herkild th at t3cms.dk
Mon Feb 20 13:20:33 CET 2012


Den 20-02-2012 13:04, Toke Herkild skrev:
> Den 20-02-2012 11:54, Claus Due skrev:
>>> Now I just have to figure out why the mirroring seems to be wrong.
>>
>> Could be that you need to set TCA type "passthrough" on the mirrorred
>> side - but of course this is just a shot from the hip.
>>
>> Cheers,
>> Claus
>
> Hi Claus,
>
> Seems my problem lies in the child_Persistence_Storage_Object Not being
> loaded on init of the Parent.
>
> So that count($AModel->getChilds()) == 0
>
> And after adding a new child count == 1
>
> Regards,
> Toke

Hi All,

In regards to the initial load of the Object in extBase, not all 
properties are loaded unless you re-fetch the object from repository.

Example:

public function genericAction(TModel $aModel){
   /** Reload object and enforce load of 
Tx_Extbase_Persistence_ObjectStorage. */
   $aModel = $this->repo->findByUid($aModel->getUid());
   $aModel->addChilds($child);
   $this->repo->update($aModel);
}

Anyone who'd care to axplain why ObjectStorage isn't loaded by default ?

Regards,
Toke


More information about the TYPO3-project-typo3v4mvc mailing list