[TYPO3-mvc] Cannot update a 1:n relation [BUG FOUND]
Franz Koch
typo3.RemoveForMessage at elements-net.de
Fri Aug 13 03:12:58 CEST 2010
Hey Xavier,
> _isDiry('contact') always returns FALSE. I digged into the problem and
> found where the test fails:
>
> /**
> * Checks the $value against the $cleanState.
> *
> * @param mixed $previousValue
> * @param mixed $currentValue
> * @return boolan
> */
> protected function isPropertyDirty($previousValue, $currentValue) {
...
> }
>
> Test goes into if ($currentValue instanceof
> Tx_Extbase_Persistence_ObjectMonitoringInterface) but:
>
> - previousValue is an object => isDirty = FALSE
> - $currentValue is not dirty as the referenced object itself was not
> modified => isDirty = FALSE
> - both previous and current value have the same class!
>
> As test, I deactivated this test to use the "For all other objects we do
> only a simple comparison
>
> After that, my relation is properly updated. Can someone from Extbase
> team understands where the "real" error is?
How does your update action look like? Something like this?
function updateAction(Tx_ExtKey_Domain_Model_Company $company) {
$this->companyRepository->update($company);
}
Or do you update you $company object by hand via something like this:
function updateAction(Tx_ExtKey_Domain_Model_Contact $contact,
Tx_ExtKey_Domain_Model_Company $company) {
$company->setContact($contact);
$this->companyRepository->update($company);
}
The later has to work in any way - the previous might have an issue with
the argument mapping, memorizing the clean state at a wrong stage.
Please tell me which way you do it and I'll have a look at the
responsible codes.
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list