Looks like the '{n}' bit is prepended automatically in the find()
method, so you don't need it.
Why it's not grouping is a different matter...
Exactly what SQL is generated without the '{n}' ? And paste a debug()
of the resultset too.
In fact, temporarily hack your model.php and add this line:
$this->log(compact('keyPath,'valuePath','groupPath','results'));
just before this line :
return Set::combine($this->__filterResults($results, true), $keyPath,
$valuePath, $groupPath);
(line 1823 in release 6398)
And paste the results.
On Jan 24, 2:42 pm, RichardAtHome <[EMAIL PROTECTED]> wrote:
> Hi again folks, still not having any luck with this. Here's what I
> currently have:
>
> $tags = $this->Output->Tag->find("list", array(
> "fields"=>array(
> "{n}.Tag.id",
> "{n}.Tag.name",
> "{n}.TagType.name"),
> "order"=>array(
> "TagType.name",
> "Tag.name ASC"
> ),
> "recursive"=>0
> ));
>
> I've tested this in the current Beta and the nightly build and get the
> following error:
>
> Query: SELECT `{n}`.`Tag`, `{n}`.`TagType`, `Tag`.`id` FROM `tags` AS
> `Tag` LEFT JOIN `tag_types` AS `TagType` ON (`Tag`.`tag_type_id` =
> `TagType`.`id`) WHERE 1 = 1 ORDER BY `TagType`.`name` ASC,
> `Tag`.`name` ASC
>
> Warning (512): SQL Error: 1109: Unknown table '{n}' in field list [CORE
> \cake\libs\model\datasources\dbo_source.php, line 440]
>
> It looks like {n} isn't being parsed correctly?
>
> Here's the model (in case I've messed up in there):
>
> var $hasAndBelongsToMany = array(
> 'OutputType' => array('className' => 'OutputType',
> 'joinTable' =>
> 'outputs_output_types',
> 'foreignKey' => 'output_id',
> 'associationForeignKey' =>
> 'output_type_id',
> 'unique' => true,
> 'conditions' => '',
> 'fields' => '',
> 'order' => '',
> 'limit' => '',
> 'offset' => '',
> 'finderQuery' => '',
> 'deleteQuery' => '',
> 'insertQuery' => ''
> ),
> 'Tag' => array('className' => 'Tag',
> 'joinTable' => 'outputs_tags',
> 'foreignKey' => 'output_id',
> 'associationForeignKey' =>
> 'tag_id',
> 'unique' => true,
> 'conditions' => '',
> 'fields' => '',
> 'order' => '',
> 'limit' => '',
> 'offset' => '',
> 'finderQuery' => '',
> 'deleteQuery' => '',
> 'insertQuery' => ''
> ),
> 'Theme' => array('className' => 'Theme',
> 'joinTable' =>
> 'outputs_themes',
> 'foreignKey' => 'output_id',
> 'associationForeignKey' =>
> 'theme_id',
> 'unique' => true,
> 'conditions' => '',
> 'fields' => '',
> 'order' => '',
> 'limit' => '',
> 'offset' => '',
> 'finderQuery' => '',
> 'deleteQuery' => '',
> 'insertQuery' => ''
> )
> );
>
> If you remove the {n} from the find(), the tags are outputted, but no
> option groups are displayed (the tags ARE grouped by category however,
> just displayed as one long list)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---