I'm sorry, I'm a bit lost. Could you explain this a lil more?
On Dec 6, 2007 10:15 AM, nate <[EMAIL PROTECTED]> wrote: > > On 1.2 you can set the 'type' key in the association, which defaults > to "LEFT". > > On Dec 6, 7:39 am, foxmask <[EMAIL PROTECTED]> wrote: > > Hi Baz > > We suggested me to do this : > > > > in the topics controller : > > function lastTopics(){ > > $sql = > > "SELECT Topic.id, Topic.subject FROM topics AS Topic INNER JOIN forums > > AS Forum ON > > Forum.id = Topic.forum_id LEFT JOIN forum_perms AS ForumPerm ON > > (ForumPerm.forum_id=Forum.id AND > > ForumPerm.group_id='xxx') WHERE (ForumPerm.read_forum IS NULL OR > > ForumPerm.read_forum=1) > > AND Topic.moved_to IS NULL ORDER BY Topic.last_post DESC LIMIT 10 "; > > $resultset = $this->Topic->query($sql); > > return $resultset; > > > > } > > > > and in my element : > > $pt_active_topics = $this->requestAction('topics/lastTopics/'); > > > > On Dec 5, 9:59 pm, Baz L <[EMAIL PROTECTED]> wrote: > > > > > I ran into a need for this today. > > > > > In the interest of time, I just trim the array I get back after the > > > fact, however...is there someway to do this? > > > -- > > > Baz L > > > Web Development 2.0http://WebDevelopment2.com/ > > > > > On Dec 1, 1:30 pm, foxmask <[EMAIL PROTECTED]> wrote: > > > > > > gooed evening > > > > any idea aboutinner join? > > > > > > On Nov 29, 12:39 pm, foxmask <[EMAIL PROTECTED]> wrote: > > > > > > > Hi i'd like to know what i need to do and in what model, to be > able to > > > > > use this SQL query > > > > > > > SELECT t.id, t.subject FROM topics AS tINNER JOINforums AS f ON > > > > > f.id=t.forum_id LEFT JOIN forum_perms AS fp ON (fp.forum_id=f.idAND > > > > > fp.group_id='xxx') WHERE (fp.read_forum IS NULL OR fp.read_forum=1 > ) > > > > > AND t.moved_to IS NULL ORDER BY t.last_post DESC LIMIT 10 > > > > > > > actually this SQL Query : > > > > > SELECT `Post`.`id`, `Post`.`poster`, `Post`.`poster_id`, > > > > > `Post`.`poster_ip`, `Post`.`poster_email`, `Post`.`message`, > > > > > `Post`.`hide_smilies`, `Post`.`posted`, `Post`.`edited`, > > > > > `Post`.`edited_by`, `Post`.`topic_id`, `Topic`.`id`, > `Topic`.`poster`, > > > > > `Topic`.`subject`, `Topic`.`posted`, `Topic`.`last_post`, > > > > > `Topic`.`last_post_id`, `Topic`.`last_poster`, > `Topic`.`num_views`, > > > > > `Topic`.`num_replies`, `Topic`.`closed`, `Topic`.`sticky`, > > > > > `Topic`.`moved_to`, `Topic`.`forum_id` FROM `posts` AS `Post` LEFT > > > > > JOIN `topics` AS `Topic` ON (`Post`.`topic_id` = `Topic`.`id`) > WHERE 1 > > > > > = 1 ORDER BY `last_post` desc LIMIT 10 > > > > > > > is produce when i do in my element : > > > > > > > $pt_active_topics = > $this->requestAction('posts/index/sort:last_post/ > > > > > direction:desc/limit:10'); > > > > > > > here are my models : > > > > > > > <?php > > > > > class Post extends AppModel { > > > > > > > var $name = 'Post'; > > > > > > > //The Associations below have been created with all > possible keys, > > > > > those that are not needed can be removed > > > > > var $belongsTo = array( > > > > > 'Topic' => array('className' => 'Topic', > > > > > > 'foreignKey' => 'topic_id', > > > > > > 'conditions' => '', > > > > > > 'fields' => '', > > > > > > 'order' => '', > > > > > > 'counterCache' => ''), > > > > > ); > > > > > > > } > > > > > > > <?php > > > > > class Topic extends AppModel { > > > > > > > var $name = 'Topic'; > > > > > > > //The Associations below have been created with all > possible keys, > > > > > those that are not needed can be removed > > > > > var $belongsTo = array( > > > > > 'Forum' => array('className' => 'Forum', > > > > > > 'foreignKey' => 'forum_id', > > > > > > 'conditions' => '', > > > > > > 'fields' => '', > > > > > > 'order' => '', > > > > > > 'counterCache' => ''), > > > > > ); > > > > > > > var $hasMany = array( > > > > > 'Post' => array('className' => 'Post', > > > > > > 'foreignKey' => 'topic_id', > > > > > > 'conditions' => '', > > > > > > 'fields' => '', > > > > > > 'order' => '', > > > > > > 'dependent' => ''), > > > > > ); > > > > > > > } > > > > > > > <?php > > > > > class Forum extends AppModel { > > > > > > > var $name = 'Forum'; > > > > > > > //The Associations below have been created with all > possible keys, > > > > > those that are not needed can be removed > > > > > var $hasMany = array( > > > > > 'ForumPerm' => array('className' => > 'ForumPerm', > > > > > > 'foreignKey' => 'forum_id', > > > > > > 'conditions' => '', > > > > > > 'fields' => '', > > > > > > 'order' => '', > > > > > > 'limit' => '', > > > > > > 'offset' => '', > > > > > > 'dependent' => '', > > > > > > 'exclusive' => '', > > > > > > 'finderQuery' => '', > > > > > > 'counterQuery' => ''), > > > > > 'Topic' => array('className' => 'Topic', > > > > > > 'foreignKey' => 'forum_id', > > > > > > 'conditions' => '', > > > > > > 'fields' => '', > > > > > > 'order' => '', > > > > > > 'limit' => '', > > > > > > 'offset' => '', > > > > > > 'dependent' => '', > > > > > > 'exclusive' => '', > > > > > > 'finderQuery' => '', > > > > > > 'counterQuery' => ''), > > > > > ); > > > > > > > } > > > > > > > ?> > > > > > > > <?php > > > > > class ForumPerm extends AppModel { > > > > > > > var $name = 'ForumPerm'; > > > > > var $primaryKey = 'group_id,forum_id'; > > > > > > > //The Associations below have been created with all > possible keys, > > > > > those that are not needed can be removed > > > > > var $belongsTo = array( > > > > > 'Group' => array('className' => 'Group', > > > > > > 'foreignKey' => 'group_id', > > > > > > 'conditions' => '', > > > > > > 'fields' => '', > > > > > > 'order' => '', > > > > > > 'counterCache' => ''), > > > > > 'Forum' => array('className' => 'Forum', > > > > > > 'foreignKey' => 'forum_id', > > > > > > 'conditions' => '', > > > > > > 'fields' => '', > > > > > > 'order' => '', > > > > > > 'counterCache' => ''), > > > > > ); > > > > > > > } > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---