Hello,

well, I need to get a hint of "good way" to read additional data from a
join table from a connected controller. I use such a table including a
"position" field associating CD tracks.

CREATE TABLE `cake_cds_tracks` (
  `cd_id` int(11) NOT NULL default '0',
  `track_id` int(11) NOT NULL default '0',
  `position` int(11) NOT NULL default '0'
) TYPE=MyISAM;

In my cd model I connected the table with HABTM and added 'order' =>
'position ASC' - this works great

    var $hasAndBelongsToMany = array(
            'Track' =>
                array('className' => 'Track',
                        'joinTable' => 'cds_tracks',
                        'foreignKey' => 'cd_id',
                        'associationForeignKey' => 'track_id',
                        'order' => 'position ASC'
                )

I am quering in cds_controller.php a CD i.e. in 'function
view($id=null)'

$this->set('cd', $this->Cd->read(null, $id));

But now I am wordering, how to get the 'position' info in my controller
*in a good way*. The queried data is being sorted by its position and
includes correct tracks, but I need to read and add (set) the database
field 'position'. Is there a simple API call doing this? Or do I need
to add a function in my cd model? 

-- 
Christian


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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