Doctrine 1.2 must have at least one field selected Error.but one is actually selected

brucao

New Member
i've been banging my head against the wall over the past hour about this Exception :\[quote\] The root class of the query (alias b) must have at least one field selected\[/quote\]on a small school hotel booking project here is the part of the schema concerned\[code\]RoomType: actAs: [Timestampable] tableName: room_type columns: name: string(100) number_of_bed: integerRoom: tableName: room columns: id: type: string(36) primary: true room_number: integer price: decimal relations: RoomType: class: RoomType local: type_id foreign: idRoomBooking: tableName: roombooking actAs: [Timestampable] columns: id: type: string(36) primary: true room_id: string(36) checkin_date: date checkout_date: date is_cancelled: boolean relations: Room: class: Room local: room_id foreign: id\[/code\]i tripped out certain field for sake of simplicity and having short post.So basically i wanted to query for the total, the type of rooms booked each day of a certain month.i wanted things simple so for now i assumed booking are just for 24 hours so for now i'm just looking at checkin date.here is the query\[code\]$q = Doctrine_Query::create ()->select("SUM(COUNT(b.id)), b.checkin_date as DATE, t.name")->from ("Hotel_Model_RoomBooking b" )->leftJoin("b.Room r")->leftJoin("r.RoomType t")->where ("b.checkin_date > ? AND b.checkin_date < ?", array ($first, $last))->groupBy("b.checkin_date, t.name");$result = $q->fetchArray (); \[/code\]\[code\]b.checkin_date\[/code\] is one field of the root class so i have this and \[code\]b.id\[/code\] selected, and up to now i can't figure it out.What do you think? what am i doing wrong here? thanks for reading and thanks in advance for your help
 
Back
Top