#1380: Lack of a clear way to access calculated DQL columns
-----------------------------------+----------------------------------------
 Reporter:  francois               |       Owner:  jwage  
     Type:  defect                 |      Status:  new    
 Priority:  minor                  |   Milestone:  Unknown
Component:  Attributes             |     Version:  0.11   
 Keywords:                         |    Has_test:  0      
 Mystatus:  Pending Core Response  |   Has_patch:  0      
-----------------------------------+----------------------------------------
 When adding calculated DQL columns, Doctrine tries to find a way to make
 it available from the base record, but can't figure out what to do when
 the calculation is on several objects.

 Here is a DQL example:

 {{{
 //Article has many Comments
 SELECT a.*, COUNT(a.Comment) NbComment FROM Article a GROUP BY a.id LIMIT
 1
 // will hydrate an Article object looking like
 -
   id: 456
   title: Hello, world
   body: Lorem Ipsum...
   Comment:
     id: ~
     body: ~
     article_id: ~
     NbComment: 23
 }}}

 So that works, since I can retrieve my custom `NbComment` column by
 calling `$article['Comment']['NbComment']`.

 But when the calculation is on more than one class, the hydrator has no
 way to determine where to attach the new column.

 Since the current behavior is not very intuitive and very limited, I
 suggest that calculated columns should be made available directly to the
 base record - providing they have an alias, which should be compulsory.
 That way, using the previous DQL statement, the alias `NbComments` could
 be retrieved by calling `$article['NbComment']`.

-- 
Ticket URL: <http://trac.doctrine-project.org/ticket/1380>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"doctrine-svn" group.
 To post to this group, send email to [email protected]
 To unsubscribe from this group, send email to [EMAIL PROTECTED]
 For more options, visit this group at 
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---

Reply via email to