On Fri, Jan 16, 2009 at 9:38 AM, ezekfred <[email protected]> wrote:
> could you post your Entry & EntryType model?

Sure, though there's not much to it:

<?php

class EntryType extends AppModel {
        public $name = 'EntryType';
        public $hasMany = array ( 'Entry' );
}

?>

<?php

class Entry extends AppModel {
        public $name = 'Entry';
        public $belongsTo = array (
                'EntryType',
                'PDF' => array (
                        'className'  => 'Binary',
                        'foreignKey' => 'pdf_file_id'
                ),
                'MSWord' => array (
                        'className'  => 'Binary',
                        'foreignKey' => 'msword_file_id'
                )
        );
        
        public function groupByType() {
                return Set::combine (
                        $this->find (
                                'all',
                                array (
                                        'order' => 'EntryType.title, 
Entry.title'
                                )
                        ),
                        '{n}.Entry.id',
                        '{n}',
                        '{n}.EntryType.title'
                );
        }
}

?>

Hope that helps.

Thanks again.

-- 
Rob Wilkerson
http://robwilkerson.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to