> 'contain' => array('ListLink', array(
Try: 'contain' => array('ListLink' => array(... Make a connection between 'LinkList' => and => it's => array(). The way you wrote it it's two separate parameters... On 22 Oct 2008, at 06:43, Stinkbug wrote: > > I think my code looks almost exactly like what's in the docs with the > exception of the extra condition. I'm not getting my desired results > and I'm not sure what I'm doing wrong. Here is what my data looks > like that's getting returned. > > Array > ( > [ListTitle] => Array > ( > [id] => 3 > [title] => Featured Story > ) > > [ListLink] => Array > ( > [0] => Array > ( > [id] => 1 > [title] => It's the great and mighty Stinkbug! > [link] => http://blog.stinkbug.net > [list_title_id] => 3 > [created] => 2008-10-20 15:05:01 > [modified] => 2008-10-20 15:41:49 > [deleted] => 1 > [deleted_date] => 2008-10-20 15:41:49 > ) > > [1] => Array > ( > [id] => 2 > [title] => It's Google! > [link] => http://www.google.com > [list_title_id] => 3 > [created] => 2008-10-20 16:35:54 > [modified] => 2008-10-20 16:35:54 > [deleted] => 0 > [deleted_date] => > ) > > [2] => Array > ( > [id] => 3 > [title] => Stinkbug The Man > [link] => http://www.stinkbug.net > [list_title_id] => 3 > [created] => 2008-10-21 09:38:14 > [modified] => 2008-10-21 09:38:14 > [deleted] => 1 > [deleted_date] => 2008-10-21 09:49:12 > ) > > [3] => Array > ( > [id] => 4 > [title] => A Test URL > [link] => http://www.google.com > [list_title_id] => 3 > [created] => 2008-10-21 09:43:41 > [modified] => 2008-10-21 09:43:41 > [deleted] => 1 > [deleted_date] => 2008-10-21 09:46:57 > ) > > [4] => Array > ( > [id] => 5 > [title] => Oops, Stinkbugs did it again! > [link] => http://www.stinkbug.net > [list_title_id] => 3 > [created] => 2008-10-21 11:17:15 > [modified] => 2008-10-21 11:17:15 > [deleted] => 0 > [deleted_date] => > ) > > ) > > ) > > And here is my code that returns that data: > > //Grab the Features Stories data. > $this->ListTitle->Behaviors->attach('Containable'); > > $featuredStories = $this->ListTitle->find('first', array( > 'conditions' => array('ListTitle.id' => 3), > 'contain' => array('ListLink', array( > 'conditions' => array('ListLink.deleted' => 0), > 'order' => 'ListLink.created DESC', > 'limit' => 3 > ) > ))); > > By looking at the code I think you can see what I would like > returned. All of ListLink where deleted = 0. As you can see from my > data above, it's returning everything. I am getting some errors. > > Warning (2): preg_match() expects parameter 2 to be string, array > given [CORE\cake\libs\model\behaviors\containable.php, line 280] > Notice (8): Array to string conversion [CORE\cake\libs\model\behaviors > \containable.php, line 283] > Notice (8): Array to string conversion [CORE\cake\libs\model\behaviors > \containable.php, line 340] > Warning (512): Model "ListTitle" is not associated with model > "Array" [CORE\cake\libs\model\behaviors\containable.php, line 342] > > Not sure what they mean though. Here are the queries getting spit > out. > > SELECT `ListTitle`.`id`, `ListTitle`.`title` FROM `list_titles` AS > `ListTitle` WHERE `ListTitle`.`id` = 3 LIMIT 1 > > SELECT `ListLink`.`id`, `ListLink`.`title`, `ListLink`.`link`, > `ListLink`.`list_title_id`, `ListLink`.`created`, > `ListLink`.`modified`, `ListLink`.`deleted`, `ListLink`.`deleted_date` > FROM `list_links` AS `ListLink` WHERE `ListLink`.`list_title_id` = (3) > > As you can see, the conditions for the ListLink model is totally being > ignored. Can anyone suggest what I might be doing wrong? > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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 -~----------~----~----~----~------~----~------~--~---