Ok, now I have another question.  I understand that I can set 'fields'
to return only some of the table columns of the categories table.  But
how do I limit the columns returned from the Scripts/Entries table
which also gets pulled because of my hasMany definition?

1       SELECT `Category`.`name`, `Category`.`id` FROM `categories` AS
`Category` WHERE `Category`.`id` = 2 LIMIT 1

2       SELECT `Script`.`id`, `Script`.`title`, `Script`.`description`,
`Script`.`content`, `Script`.`category_id`, `Script`.`user_id`,
`Script`.`created`, `Script`.`modified` FROM `scripts` AS `Script`
WHERE `Script`.`category_id` IN (2)

How do I limit the columns from the second quarry?  Doing this
prevented it from pulling `created` from Categories:
$this->set('category', $this->Category->read('name')); //(it still
pulls the id though, so I am assuming you can not prevent that)
//or (seems to do the same thing)
$this->set('category', $this->Category->find(array('id' => $id),
'name'));

Also, why is cake not doing a join, but instead two separate quarries?
wouldn't that be faster?

I would think this would work:
$this->set('category', $this->Category->find( array('id' => $id),
array('Category.name', 'Script.title', 'Script.description') ));
But it doesn't! grr

Thanks,
Jonah

--~--~---------~--~----~------------~-------~--~----~
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