Re: newbie query question
Do you have? class Listing extends AppModel { public $belongsTo = array('Category'); } class Category extends AppModel { public $hasMay = array('Listing'); } Then you should be able to: $listing = $this->Listing->findAll(array('category_id' => $category_id)); On Jan 26, 9:30 pm, bob <[EMAIL PROTECTED]> wrote: > I have a Listings table and another Categories table, and Lists hasMany > Categories. I am trying to write a cake query where it finds all lists in a > certain category. > > $listings = $this->Listing->findAll( > array('Category.category_id'=>$category_id) > ); > > this returns an error. > > Also, if I do $this->Listing->findAll(), it just returns the columns in > Listings, not Categories. How would i do this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Head around Relationships
Ok, I may have figured out what I really want to do... Instead of the HABTM relationship between games and players, i can just access each other through the score, since every player has to have a score in the game... Still correct? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Head around Relationships
Actually... what I can do is instead of looping through $player['Game'] I can loop through $player['Score'] which will contain details about my game... Is this how I would do this correctly? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Head around Relationships
New to cake here... using 1.2 I've got three models: Players Games Scores class Player extends AppModel { public $name = 'Player'; public $hasAndBelongsToMany = array('Game'); public $hasMany = array('Score'); } class Game extends AppModel { public $name = 'Game'; public $hasAndBelongsToMany = array('Player'); public $hasMany = array('Score'); } class Score extends AppModel { public $belongsTo = array('Game', 'Player'); } I'm building a profile controller action: /players/profile/username public function profile($username) { $player = $this->Player->find(array('username' => $username), null, null, 2); $this->set('player',$player); } The return array has the Games key, with ALL the scores for that game. how can I get only score for that game for the player i'm interested in. For each game, there will only be one score per Player. Thanks in advance! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: v1.2 $beforeFilter property warning
This is how I was using it, in my AppController class RequestHandler->setContent('json', 'text/x-json'); } ?> On Jan 14, 10:52 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > On Jan 14, 2008 10:42 PM, Jeremi <[EMAIL PROTECTED]> wrote: > > > > > I am receiving the warning: > > > Warning (512): Dispatcher::start - Controller::$beforeFilter property > > usage is deprecated and will no longer be supported. Use > > Controller::beforeFilter(). [CORE/cake/dispatcher.php, line 298] > > > But I cannot figure out the proper way to use the method, can someone > > please help? > > Well... > > beforeFilter is actually a method for a controller > > class FooController extends AppController { > function beforeFilter() { > // do all you beforeFiltery stuff here > } > > } > > In what context were you using $beforeFilter, as that is something > that I have not seen before. > > -- > Chris Hartjes > Internet Loudmouth > Motto for 2008: "Moving from herding elephants to handling snakes..." > @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
v1.2 $beforeFilter property warning
I am receiving the warning: Warning (512): Dispatcher::start - Controller::$beforeFilter property usage is deprecated and will no longer be supported. Use Controller::beforeFilter(). [CORE/cake/dispatcher.php, line 298] But I cannot figure out the proper way to use the method, can someone please help? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Relationship Levels
I have a file model that belongs to an image model that belongs to a gallery model. When I'm in the gallery controller and do a findAll() galleries, it loads the galleries and their corrosponding images. But the images do not load the File model. I assume it's because it only loads to a certain depth, is there any way to change this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---