[TYPO3-mvc] odd relational issue with attach

Toke Herkild th at t3cms.dk
Mon Feb 20 11:07:56 CET 2012


Hi All,

I've an Action in which I try to add a range of childs to their parent, 
and it works brilliantly with the first Item but when adding the next 
the relation to the first item gets reset.

Example:
public function genericAction(TModel $Amodel){
   $childRepo = new t_dom_repo_Repository;
   $child = $this->obejctManager->create('TModel_Child');
   // Add Defaults to child
   ...
   //
   $Amodel->addChild($child);
   $child->addParent($Amodel);
   $childRepo->add($child);
   $this->AmodelRepo->update($Amodel);

   // Code Forward/Redirect
   ...
}

First time I do this everything seems to work like a charm, though 
second the Parent_Uid of the first child relation, gets set to 0.

I've tried adding persistence too, and no difference.

Any Ideas ?

Regards,
Toke Herkild


More information about the TYPO3-project-typo3v4mvc mailing list