#1609: Oracle - Execution with custom function results in "not a GROUP BY
expression" error
--------------------------+-------------------------------------------------
  Reporter:  tchakkapark  |       Owner:  guilhermeblanco      
      Type:  defect       |      Status:  closed               
  Priority:  major        |   Milestone:  1.0.4                
 Component:  Pager        |     Version:  1.0.3                
Resolution:  invalid      |    Keywords:  oracle group by      
  Has_test:  0            |    Mystatus:  Pending Core Response
 Has_patch:  0            |  
--------------------------+-------------------------------------------------
Comment (by tchakkapark):

 Yeah, I figured that there would be too much involved to decipher
 something like that to a simple count query. My solution was the following
 (just for anybody's future reference):


 {{{
                 $messages = Doctrine_Query::create()
                                                 ->select("el.email_id,
 el.user_id, el.to_email, el.to_name, el.to_contact_id, el.from_email,
 el.from_name, el.from_contact_id, el.reply_email, el.subject,
 el.text_clob_id, el.html_clob_id, el.attachment_clob, el.attachment_name,
 el.scheduled_send, el.status, el.status_text,
 ".Util::toUnixTime('el.created', 'created'))
                                         ->from('EMAIL_LOG el')
                                                 ->where("el.to_email = ?
 AND el.status != 'Deleted'", $this->getUser()->getAttribute('email'))
 ->setHydrationMode(Doctrine::HYDRATE_ARRAY);


                 $messagesCount = Doctrine_Query::create()
                                         ->from('EMAIL_LOG el')
                                                 ->where("el.to_email = ?
 AND el.status != 'Deleted'", $this->getUser()->getAttribute('email'));

                 if($this->reduced == true){
                         $this->pager = new Doctrine_Pager($messages, 0,
 5);
                 } else {
                         $this->pager = new Doctrine_Pager($messages,
 $request->getParameter("page", 0), 30);
                 }

                 $this->pager-> setCountQuery($messagesCount);
                 $this->results = $this->pager->execute();

 }}}

-- 
Ticket URL: <http://trac.doctrine-project.org/ticket/1609#comment:5>
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