[TYPO3-mvc] lazy loading __toString linkViewHelper
Marco Huber
marco.huber at marit.ag
Wed Jun 2 17:01:32 CEST 2010
Hi List,
I have a little Problem with the linkViewHelper and lazy loading.
I have an object Project which has the property Customer:
class Tx_MaritReferences_Domain_Model_Project extends
Tx_Extbase_DomainObject_AbstractEntity {
/**
* customer
* @var Tx_MaritReferences_Domain_Model_Customer
* @lazy
*/
protected $customer;
}
I used the parameter @lazy because I don't need the customer in every view.
In the Project detailview I use the link ViewHelper:
<f:link.action controller="Customer" action="show" arguments="{customer:
project.customer}"
class="projectcustomer">{project.customer.title}</f:link.action>
Now I get this error:
Fatal error: Call to undefined method
Tx_MaritReferences_Domain_Model_Customer::__toString() in
/srv/www/htdocs/afrika/Kunden/Develop/mhu/maritag/webroot/typo3/sysext/extbase/Classes/Persistence/LazyLoadingProxy.php
on line 157
When I use
<f:link.action controller="Customer" action="show" arguments="{customer:
project.customer.uid}"
class="projectcustomer">{project.customer.title}</f:link.action>
there is no error.
Without the @lazy everything works fine.
I think this issue has something to do with Bug #7558 but I have
absolutly no idea where to start the debugging. When I comment out the
method __toString in
typo3\sysext\extbase\classes\persistence\LazyLoadingProxy.php everything
works fine.
Do I have to write the __toString method in every model because of that?
I think Fluid should do this for me. Or the LazyLoading mechanism. What
do you think?
Kind regards,
Marco
More information about the TYPO3-project-typo3v4mvc
mailing list