Can you post your schema?

On Nov 16, 2010 5:48 AM, "man mixi" <mixi...@gmail.com> wrote:

Hi, experts.
I set up a simple relationship using sfGuardUserProfile.
But it does not work properly.

Remove 'p.name' from select method, In this case it works.
Why?
I do not understand the meaning of the error message.

Please help me.

---

ERROR MESSAGE
>500 | Internal Server Error | Doctrine_Query_Exception
>The root class of the query (alias s) must have at least one field
selected.


#action.php

   $this->saless = Doctrine_Query::create()
     ->select('s.user_id as userid,p.name, sum(s.amount) as amount')
     ->from('Sales s')
//      ->where('s.created_at between ? and ?',array($start,$end))
     ->leftJoin('s.Profile p')
     ->groupBy('userid')
     ->execute();

#schema.yml
Sales:
 tableName: sales
 actAs:        { Timestampable: ~ }
 columns:
   user_id:
     type: integer
   amount: integer
 relations:
    User:
      class: sfGuardUser
      foreign: id
      local: use_id
      type: many
      onDelete: cascade
      foreignType: many
      foreignAlias: Sales
    Profile:
      class: sfGuardUserProfile
      foreign: user_id
      local: user_id
      type: many
      onDelete: cascade
      foreignType: many
      foreignAlias: Sales

sfGuardUserProfile:
 tableName: sf_guard_user_profile
 actAs:        { Timestampable: ~ }
 columns:
   id: integer
   user_id:
     type: integer
     primary: true
   name: varchar(50)
 relations:
    User:
      class: sfGuardUser
      foreign: id
      local: user_id
      type: one
      onDelete: cascade
      foreignType: one
      foreignAlias: Profile

--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to