[TYPO3-mvc] RFC: #8083 define default __toString method in Tx_Extbase_DomainObject_AbstractDomainObject

Martin Kutschker masi-no at spam-typo3.org
Wed Nov 10 11:16:58 CET 2010


Am 10.11.2010 10:55, schrieb Marc Bastian Heinrichs:
> Hi Masi,
> 
>>> Solution:
>>> Add magic method __toString to return the uid
>>
>> What about [<class name>:<uid>]? The uid conveys very little information.
> 
> For debugging you are right.
> 
> For linking to an related object you use {enterprise : job.enterprise}.
> This would fail when the related object is defined as lazy
> (see <http://forge.typo3.org/issues/10702>)
> 
> Returning the uid fixes this.

I assume you mean linking in a FLUID context, right? Anyway, I am not against adding a default to
string even if it shows only the uid.

But I have a problem if the reason seems to be to provide a workaround. If some code needs the uid
of object it should ask for it. Why? Because I can use a custom implementation of __toString() which
may return something else.

I suggest to fix the problem with the lazy loader first before applying a patch that only hides the
problem.

Masi


More information about the TYPO3-project-typo3v4mvc mailing list