[TYPO3-mvc] Issue with creating new objects containing IRRE relations. Relations not stored correctly!

Franz Koch typo3.RemoveForMessage at elements-net.de
Fri Jun 18 00:16:59 CEST 2010


Hey there,

I'm still struggling with my import script. Although my main object 
already get's imported and updated quite fine, new relations added to 
those object don't get persisted correctly.

I'm using a IRRE relation in some of the properties via 'foreing_field' 
and 'foreign_table'. Altough those related IRRE objects get persisted, 
the related IRRE-fields don't get filled by default. My question is now, 
do I really have to fill those fields by hand before adding my new 
related object as property of my main object, or might this be a bug in 
extbase, or probably more likely a bug in my code?


Here my simplified piece of code:
----------------------------------------
//example for updating a existing object
$object = $this->myRepository->findByUniqueIdentifier($identifier);

# create a new, empty relation object
$newRelationObject = 
t3lib_div::makeInstance('Tx_MyExt_Domain_Model_RelationObject');

# fill the object
foreach ($importData as $property => $value) {
	Tx_Extbase_Reflection_ObjectAccess::setProperty($newRelationObject, 
$property, $value);
}

# add/update relation to main object
$object ->setMyProperty($newRelationObject);

# update object in repository
$this->myRepository->update($newObject);
----------------------------------------

The second strange thing is, that the php process is stopped at some 
point and all I see is a white page - but my objects got stored in the 
DB, but that's a different issue.

Thanks for any hints.
-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list