vlucas / Spot

[DEPRECATED - use v2] Simple DataMapper ORM for PHP 5.3+
75 stars 14 forks source link

Entities should be loaded with custom properties in custom queries #70

Closed vlucas closed 10 years ago

vlucas commented 10 years ago

Marking this as a bug because this feature used to be supported in Spot, but at some point regressed.

$posts = $mapper->all('Entity_Post')
    ->select('id, MAX(status) AS maximus')
    ->group(array('id'));

When looping through the $posts results, the property maximus is not loaded on any of the $post objects even though it is explicitly requested. Spot should strive to be flexible and lenient over strict and inflexible, so this custom property should be loaded on the resulting Entity objects even though it is not in the entity field definitions. Any custom properties will be returned as-is, and will not have any special handling or processing performed on them.