[TYPO3-mvc] order by "calculated attribute" - several approaches

Martin Kutschker masi-no at spam-typo3.org
Mon Jun 7 10:58:07 CEST 2010


Sebastian Kurfürst schrieb:
> Hi Jigal,
> 
>> 4. Maintain a field with the average rating (and use it in an index) and
>> sort on that field.
> Thanks for sharing this idea -- I really like it!
> I think due to the encapsulated nature of the Domain Model, it's quite
> easy to update such a calculated field if any of the original values
> within the object change.

Sidenote: for persons this can also be useful:

Properties: firstname and lastname
Display: firstname lastname
Sorting: lastname, firstname

In this case it makes also sense to create a generated (read-only) sortingName property.

But... where to put the logic? Is there any beforePerists() method available that can update such
fields?

Masi


More information about the TYPO3-project-typo3v4mvc mailing list