[TYPO3-mvc] Assigning lazy loaded objects to objects
roberto blanko
robertoblanko at gmail.com
Wed Jun 2 16:52:41 CEST 2010
Hello again,
my scenario:
$germany = new Tx_MyExt_Domain_Model_Nation();
$germany->setPresident($oldGermany->getPresident());
$this->nationRepository->add($germany);
The attribute $president is lazyly loaded.
The problem: The relation between the president and $germany is not written
to the database due to the fact, that $oldGermany->getPresident() does not
return an object of class Tx_MyExt_Domain_Model_President but of
Tx_Extbase_Persistence_LazyLoadingProxy. I guess the repository can not
handle this. I could use $oldGermany->getPresident()->_loadRealInstance()
instead. This works but this doesn't seem right or very future-proof
especially since that method is commented with "@return object The instance
(hopefully) returned". Hopefully is not a good word in terms of IT.
Any ideas how to solve my problem?
Regards
Roberto
More information about the TYPO3-project-typo3v4mvc
mailing list