[TYPO3-mvc] How to get calculated data from a query into an object?

Nikolas Hagelstein lists at shr-now.de
Wed Feb 17 10:38:56 CET 2010


Hi,

> I'm currently struggling with a query returning stores from the
> repository, that are near by the visitors location. The stores get
> found
> nicely by my custom statement, but how can I assign a row value
> "distance" that got calculated by MySQL to a property to my store
> objects? The distance is not part of the general domain and should not
> get persisted etc., but it is required for this special purpose.

Depends on the method you use to calculate the disctance 
I would introduce a virtual property by adding a getter to the model
returning the calculated distance
Is this an option?

Something like:

getDistance() {

return $this->whatever * .... + ...- //how ever you calculate the distance.
}

Cheers,
Nikolas




More information about the TYPO3-project-typo3v4mvc mailing list