Google Groups Home
Help | Sign in
#1210: Selected field with alias is not recognized
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Doctrine  
View profile
 More options 4 Jul, 10:12
From: "Doctrine" <no-re...@phpdoctrine.org>
Date: Fri, 04 Jul 2008 09:12:21 -0000
Local: Fri 4 Jul 2008 10:12
Subject: [Doctrine] #1210: Selected field with alias is not recognized
#1210: Selected field with alias is not recognized
-----------------------------------+--------------------------------------- -
 Reporter:  Max_Schreck            |       Owner:  romanb
     Type:  defect                 |      Status:  new  
 Priority:  minor                  |   Milestone:  0.11.1
Component:  Query/Hydration        |     Version:  0.11  
 Keywords:                         |    Has_test:  0    
 Mystatus:  Pending Core Response  |   Has_patch:  0    
-----------------------------------+--------------------------------------- -
 {{{
 Doctrine_Query::create()
     ->select('up.name up_name, u.name')
     ->from('UserProfile up')
     ->innerJoin('up.User u')
     ->execute();
 }}}

 This query throws Doctrine_Query_Exception with message "The root class of
 the query (alias up) must have at least one field selected.".

--
Ticket URL: <http://trac.phpdoctrine.org/ticket/1210>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doctrine  
View profile
 More options 4 Jul, 11:28
From: "Doctrine" <no-re...@phpdoctrine.org>
Date: Fri, 04 Jul 2008 10:28:33 -0000
Local: Fri 4 Jul 2008 11:28
Subject: Re: [Doctrine] #1210: Selected field with alias is not recognized
#1210: Selected field with alias is not recognized
------------------------------+-------------------------------------------- -
  Reporter:  Max_Schreck      |       Owner:  romanb              
      Type:  defect           |      Status:  closed              
  Priority:  minor            |   Milestone:  0.11.1              
 Component:  Query/Hydration  |     Version:  0.11                
Resolution:  wontfix          |    Keywords:                      
  Has_test:  0                |    Mystatus:  Pending Core Response
 Has_patch:  0                |  
------------------------------+-------------------------------------------- -
Changes (by romanb):

  * status:  new => closed
  * resolution:  => wontfix

Comment:

 You cant alias field/property names. This would be like changing
 field/property names on the fly. Your classes have a defined and fixed set
 of fields/properties. The only thing that can be aliases in DQL queries
 are artificial scalar values that result from aggregate functions for
 example.

--
Ticket URL: <http://trac.phpdoctrine.org/ticket/1210#comment:1>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doctrine  
View profile
 More options 4 Jul, 12:05
From: "Doctrine" <no-re...@phpdoctrine.org>
Date: Fri, 04 Jul 2008 11:05:22 -0000
Local: Fri 4 Jul 2008 12:05
Subject: Re: [Doctrine] #1210: Selected field with alias is not recognized
#1210: Selected field with alias is not recognized
------------------------------+-------------------------------------------- -
  Reporter:  Max_Schreck      |       Owner:  romanb              
      Type:  defect           |      Status:  closed              
  Priority:  minor            |   Milestone:  0.11.1              
 Component:  Query/Hydration  |     Version:  0.11                
Resolution:  wontfix          |    Keywords:                      
  Has_test:  0                |    Mystatus:  Pending Core Response
 Has_patch:  0                |  
------------------------------+-------------------------------------------- -
Comment (by Max_Schreck):

 OK but if I can't alias field names it shouldn't let me do it. If I remove
 "u.name" from the select statement above, the query is processed
 correctly, and the first aliased field "up_name" is properly returned in a
 result. So it is a bit misleading.

--
Ticket URL: <http://trac.phpdoctrine.org/ticket/1210#comment:2>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doctrine  
View profile
 More options 4 Jul, 12:46
From: "Doctrine" <no-re...@phpdoctrine.org>
Date: Fri, 04 Jul 2008 11:46:08 -0000
Local: Fri 4 Jul 2008 12:46
Subject: Re: [Doctrine] #1210: Selected field with alias is not recognized
#1210: Selected field with alias is not recognized
------------------------------+-------------------------------------------- -
  Reporter:  Max_Schreck      |       Owner:  romanb              
      Type:  defect           |      Status:  closed              
  Priority:  minor            |   Milestone:  0.11.1              
 Component:  Query/Hydration  |     Version:  0.11                
Resolution:  wontfix          |    Keywords:                      
  Has_test:  0                |    Mystatus:  Pending Core Response
 Has_patch:  0                |  
------------------------------+-------------------------------------------- -
Comment (by romanb):

 You are right, thats mainly a problem of the current DQL parser which is
 far from accurate when it comes to accepting/declining certain input.
 If you're interested in what is on the agenda for hydration & DQL in 2.0
 this might interest you: http://trac.phpdoctrine.org/wiki/NewHydration

 Although 2.0 is far away we plan to backport the scalar hydration modes to
 1.0. But the special SCALAR() DQL function will most likely not be
 backported.
 So in 2.0 you will be able to do sth like this: select scalar(up.name)
 up_name ... The resulting scalar value will not be put into any objects
 however, as you can see in the link above.

--
Ticket URL: <http://trac.phpdoctrine.org/ticket/1210#comment:3>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doctrine  
View profile
 More options 4 Jul, 13:30
From: "Doctrine" <no-re...@phpdoctrine.org>
Date: Fri, 04 Jul 2008 12:30:37 -0000
Local: Fri 4 Jul 2008 13:30
Subject: Re: [Doctrine] #1210: Selected field with alias is not recognized
#1210: Selected field with alias is not recognized
------------------------------+-------------------------------------------- -
  Reporter:  Max_Schreck      |       Owner:  romanb              
      Type:  defect           |      Status:  closed              
  Priority:  minor            |   Milestone:  0.11.1              
 Component:  Query/Hydration  |     Version:  0.11                
Resolution:  wontfix          |    Keywords:                      
  Has_test:  0                |    Mystatus:  Pending Core Response
 Has_patch:  0                |  
------------------------------+-------------------------------------------- -
Comment (by Max_Schreck):

 Thank you for the explanation. I'll take a look on that article. :)

--
Ticket URL: <http://trac.phpdoctrine.org/ticket/1210#comment:4>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google