Re: Updating a generateList() to use find(list) - problems with syntax?
I tried the very latest nightly build this morning (25th) and its working as intended. /cheer I had previously tried the nightly build on the 23th (as recommended by grigri) which still exhibited the problem. It must have been fixed by those mysterious code fairies that work so tirelessly behind the scenes. I did run the debug code recommended by grigri this morning before I tried the nightly build, and the groupPath wasn't being sent to the log (truncated as there are 300+ tags): 2008-01-25 10:47:34 Error: Array ( [keyPath] = {n}.Tag.id [valuePath] = {n}.Tag.name [results] = Array ( [0] = Array ( [Tag] = Array ( [id] = 1 [name] = ADL_SCORM ) [TagType] = Array ( [name] = Standards ) ) [1] = Array ( [Tag] = Array ( [id] = 2 [name] = AIFF ) [TagType] = Array ( [name] = Standards ) ) [2] = Array ( [Tag] = Array ( [id] = 3 [name] = ARK ) [TagType] = Array ( [name] = Standards ) ) ) ) I want to offer a big thanks to everyone who offered help and assistance on this, debugging someone else code is always a nightmare - thanks for sticking with it. I hope I get the opportunity to return the favour in the future. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Updating a generateList() to use find(list) - problems with syntax?
Glad it's finally working! It's odd, because trac says that this area of the model file hasn't been changed since changeset 6360 (10th Jan 2008). It must have been fixed by those mysterious code fairies that work so tirelessly behind the scenes. Maybe it really is a case of the Elves and the Shoemaker! On Jan 25, 11:15 am, RichardAtHome [EMAIL PROTECTED] wrote: I tried the very latest nightly build this morning (25th) and its working as intended. /cheer I had previously tried the nightly build on the 23th (as recommended by grigri) which still exhibited the problem. It must have been fixed by those mysterious code fairies that work so tirelessly behind the scenes. I did run the debug code recommended by grigri this morning before I tried the nightly build, and the groupPath wasn't being sent to the log (truncated as there are 300+ tags): 2008-01-25 10:47:34 Error: Array ( [keyPath] = {n}.Tag.id [valuePath] = {n}.Tag.name [results] = Array ( [0] = Array ( [Tag] = Array ( [id] = 1 [name] = ADL_SCORM ) [TagType] = Array ( [name] = Standards ) ) [1] = Array ( [Tag] = Array ( [id] = 2 [name] = AIFF ) [TagType] = Array ( [name] = Standards ) ) [2] = Array ( [Tag] = Array ( [id] = 3 [name] = ARK ) [TagType] = Array ( [name] = Standards ) ) ) ) I want to offer a big thanks to everyone who offered help and assistance on this, debugging someone else code is always a nightmare - thanks for sticking with it. I hope I get the opportunity to return the favour in the future. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Updating a generateList() to use find(list) - problems with syntax?
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 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 -~--~~~~--~~--~--~---
Re: Updating a generateList() to use find(list) - problems with syntax?
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 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 -~--~~~~--~~--~--~---
Re: Updating a generateList() to use find(list) - problems with syntax?
http://groups.google.com/group/cake-php/browse_thread/thread/996efa1f92415163/6c38e322189ec4ef?lnk=gstq=manish#6c38e322189ec4ef On Jan 22, 4:20 pm, RichardAtHome [EMAIL PROTECTED] wrote: Hi All I've just upgraded a project to the latest beta 1.2 (cake_1.2.0.6311- beta) and am struggling to get my head around the new find(list) syntax. Previously, I had: $tags = $this-Output-Tag-generateList(null, array(TagType.name, Tag.name ASC), null, null, null, {n}.TagType.name); Which returned me values suitable for a mutliselect box split into catagories (TagType.name) I've updated this to use find(list): $tags = $this-Output-Tag-find(list, array(order=array(TagType.name, Tag.name ASC), null, null, null, {n}.TagType.name)); But this generates the following error: SQL Error: 1109: Unknown table 'TagType' in order clause The SQL being generated is: Query: SELECT `Tag`.`id`, `Tag`.`name` FROM `tags` AS `Tag` WHERE 1 = 1 ORDER BY `TagType`.`name` ASC, `Tag`.`name` ASC My question is: How to I get find(list) to return the data in the same structure as my previous generateList() ? Thanks in advance! :-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Updating a generateList() to use find(list) - problems with syntax?
Try: $tags = $this-Output-Tag-find ( list, array ( order=array(TagType.name, Tag.name ASC) ) ); The list method is now clever enough to insert a fields option that includes your display key and primary key (usually something like name and id respectively). If you want to generate a list that does not include your models normal display key or primary key then there are two ways to go; either: 1. As in the threan pointed to by manish, retrieve all data with a find then do Set::combine; or 2. Just before you call your list method, set your models displayName and/or primaryKey properties to whatever you want to have returned. ianh On Jan 22, 12:55 pm, manish [EMAIL PROTECTED] wrote: http://groups.google.com/group/cake-php/browse_thread/thread/996efa1f... On Jan 22, 4:20 pm, RichardAtHome [EMAIL PROTECTED] wrote: Hi All I've just upgraded a project to the latest beta 1.2 (cake_1.2.0.6311- beta) and am struggling to get my head around the new find(list) syntax. Previously, I had: $tags = $this-Output-Tag-generateList(null, array(TagType.name, Tag.name ASC), null, null, null, {n}.TagType.name); Which returned me values suitable for a mutliselect box split into catagories (TagType.name) I've updated this to use find(list): $tags = $this-Output-Tag-find(list, array(order=array(TagType.name, Tag.name ASC), null, null, null, {n}.TagType.name)); But this generates the following error: SQL Error: 1109: Unknown table 'TagType' in order clause The SQL being generated is: Query: SELECT `Tag`.`id`, `Tag`.`name` FROM `tags` AS `Tag` WHERE 1 = 1 ORDER BY `TagType`.`name` ASC, `Tag`.`name` ASC My question is: How to I get find(list) to return the data in the same structure as my previous generateList() ? Thanks in advance! :-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Updating a generateList() to use find(list) - problems with syntax?
Thanks for replying ian, but I'm still getting the same result: Warning (512): SQL Error: 1109: Unknown table 'TagType' in order clause [CORE\cake\libs\model\datasources\dbo_source.php, line 440] And the SQL remains the same: Query: SELECT `Tag`.`id`, `Tag`.`name` FROM `tags` AS `Tag` WHERE 1 = 1 ORDER BY `TagType`.`name` ASC, `Tag`.`name` ASC As you can see, the TagTypes table is not being included so the order by fails. On Jan 22, 1:17 pm, ianh [EMAIL PROTECTED] wrote: Try: $tags = $this-Output-Tag-find ( list, array ( order=array(TagType.name, Tag.name ASC) ) ); The list method is now clever enough to insert a fields option that includes your display key and primary key (usually something like name and id respectively). If you want to generate a list that does not include your models normal display key or primary key then there are two ways to go; either: 1. As in the threan pointed to by manish, retrieve all data with a find then do Set::combine; or 2. Just before you call your list method, set your models displayName and/or primaryKey properties to whatever you want to have returned. ianh On Jan 22, 12:55 pm, manish [EMAIL PROTECTED] wrote: http://groups.google.com/group/cake-php/browse_thread/thread/996efa1f... On Jan 22, 4:20 pm, RichardAtHome [EMAIL PROTECTED] wrote: Hi All I've just upgraded a project to the latest beta 1.2 (cake_1.2.0.6311- beta) and am struggling to get my head around the new find(list) syntax. Previously, I had: $tags = $this-Output-Tag-generateList(null, array(TagType.name, Tag.name ASC), null, null, null, {n}.TagType.name); Which returned me values suitable for a mutliselect box split into catagories (TagType.name) I've updated this to use find(list): $tags = $this-Output-Tag-find(list, array(order=array(TagType.name, Tag.name ASC), null, null, null, {n}.TagType.name)); But this generates the following error: SQL Error: 1109: Unknown table 'TagType' in order clause The SQL being generated is: Query: SELECT `Tag`.`id`, `Tag`.`name` FROM `tags` AS `Tag` WHERE 1 = 1 ORDER BY `TagType`.`name` ASC, `Tag`.`name` ASC My question is: How to I get find(list) to return the data in the same structure as my previous generateList() ? Thanks in advance! :-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Updating a generateList() to use find(list) - problems with syntax?
Model::find('list', ...) automatically assumes you want $recursive - -1 (no joins) unless you specify otherwise. Try this: $tags = $this-Output-Tag-find(list, array( fields = array( '{n}.Tag.id', // keyPath : Option value '{n}.Tag.name', // valuePath: Option display field '{n}.TagType.name' // groupPath : optgroups ), order=array(TagType.name, Tag.name ASC), 'recursive' = 0 )); According to the code, the 'fields' argument can contain 1, 2 or 3 fields 1 Field : Sets keyPath to default, uses the arg for the valuePath, sets groupPath to null 2 Fields : keyPath, valuePath specified (in order), groupPath is null 3 Fields : In order: keyPath, valuePath, groupPath On Jan 22, 1:47 pm, RichardAtHome [EMAIL PROTECTED] wrote: Thanks for replying ian, but I'm still getting the same result: Warning (512): SQL Error: 1109: Unknown table 'TagType' in order clause [CORE\cake\libs\model\datasources\dbo_source.php, line 440] And the SQL remains the same: Query: SELECT `Tag`.`id`, `Tag`.`name` FROM `tags` AS `Tag` WHERE 1 = 1 ORDER BY `TagType`.`name` ASC, `Tag`.`name` ASC As you can see, the TagTypes table is not being included so the order by fails. On Jan 22, 1:17 pm, ianh [EMAIL PROTECTED] wrote: Try: $tags = $this-Output-Tag-find ( list, array ( order=array(TagType.name, Tag.name ASC) ) ); The list method is now clever enough to insert a fields option that includes your display key and primary key (usually something like name and id respectively). If you want to generate a list that does not include your models normal display key or primary key then there are two ways to go; either: 1. As in the threan pointed to by manish, retrieve all data with a find then do Set::combine; or 2. Just before you call your list method, set your models displayName and/or primaryKey properties to whatever you want to have returned. ianh On Jan 22, 12:55 pm, manish [EMAIL PROTECTED] wrote: http://groups.google.com/group/cake-php/browse_thread/thread/996efa1f... On Jan 22, 4:20 pm, RichardAtHome [EMAIL PROTECTED] wrote: Hi All I've just upgraded a project to the latest beta 1.2 (cake_1.2.0.6311- beta) and am struggling to get my head around the new find(list) syntax. Previously, I had: $tags = $this-Output-Tag-generateList(null, array(TagType.name, Tag.name ASC), null, null, null, {n}.TagType.name); Which returned me values suitable for a mutliselect box split into catagories (TagType.name) I've updated this to use find(list): $tags = $this-Output-Tag-find(list, array(order=array(TagType.name, Tag.name ASC), null, null, null, {n}.TagType.name)); But this generates the following error: SQL Error: 1109: Unknown table 'TagType' in order clause The SQL being generated is: Query: SELECT `Tag`.`id`, `Tag`.`name` FROM `tags` AS `Tag` WHERE 1 = 1 ORDER BY `TagType`.`name` ASC, `Tag`.`name` ASC My question is: How to I get find(list) to return the data in the same structure as my previous generateList() ? Thanks in advance! :-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Updating a generateList() to use find(list) - problems with syntax?
Looks like it's fixed in the latest branch, but not in the beta: https://trac.cakephp.org/changeset/6360/branches/1.2.x.x/cake/libs/model/model.php On Jan 22, 2:20 pm, ianh [EMAIL PROTECTED] wrote: Looking at the code thats what I thought it would do to (using the 1.2 beta) but my unit tests say that, when trying to generate a list of events.url = events.name - this doesn't work: return $this-find ( 'list' , array ( 'conditions' = $conditions , 'order' = 'Event.eventdate DESC' , 'fields' = array('{n}.Event.url', '{n}.Event.name') , 'recursive' = 0 ) ); whereas this works correctly: $this-primaryKey = 'url'; return $this-find ( 'list' , array ( 'conditions' = $conditions , 'order' = 'Event.eventdate DESC' , 'fields' = array('Event.url', 'Event.name') , 'recursive' = -1 ) ); Hmmm - thinking cap time. And re the original question - yes, look at recursive, I missed that bit out -sorry. ian On Jan 22, 2:07 pm, grigri [EMAIL PROTECTED] wrote: Model::find('list', ...) automatically assumes you want $recursive - -1 (no joins) unless you specify otherwise. Try this: $tags = $this-Output-Tag-find(list, array( fields = array( '{n}.Tag.id', // keyPath : Option value '{n}.Tag.name', // valuePath: Option display field '{n}.TagType.name' // groupPath : optgroups ), order=array(TagType.name, Tag.name ASC), 'recursive' = 0 )); According to the code, the 'fields' argument can contain 1, 2 or 3 fields 1 Field : Sets keyPath to default, uses the arg for the valuePath, sets groupPath to null 2 Fields : keyPath, valuePath specified (in order), groupPath is null 3 Fields : In order: keyPath, valuePath, groupPath On Jan 22, 1:47 pm, RichardAtHome [EMAIL PROTECTED] wrote: Thanks for replying ian, but I'm still getting the same result: Warning (512): SQL Error: 1109: Unknown table 'TagType' in order clause [CORE\cake\libs\model\datasources\dbo_source.php, line 440] And the SQL remains the same: Query: SELECT `Tag`.`id`, `Tag`.`name` FROM `tags` AS `Tag` WHERE 1 = 1 ORDER BY `TagType`.`name` ASC, `Tag`.`name` ASC As you can see, the TagTypes table is not being included so the order by fails. On Jan 22, 1:17 pm, ianh [EMAIL PROTECTED] wrote: Try: $tags = $this-Output-Tag-find ( list, array ( order=array(TagType.name, Tag.name ASC) ) ); The list method is now clever enough to insert a fields option that includes your display key and primary key (usually something like name and id respectively). If you want to generate a list that does not include your models normal display key or primary key then there are two ways to go; either: 1. As in the threan pointed to by manish, retrieve all data with a find then do Set::combine; or 2. Just before you call your list method, set your models displayName and/or primaryKey properties to whatever you want to have returned. ianh On Jan 22, 12:55 pm, manish [EMAIL PROTECTED] wrote: http://groups.google.com/group/cake-php/browse_thread/thread/996efa1f... On Jan 22, 4:20 pm, RichardAtHome [EMAIL PROTECTED] wrote: Hi All I've just upgraded a project to the latest beta 1.2 (cake_1.2.0.6311- beta) and am struggling to get my head around the new find(list) syntax. Previously, I had: $tags = $this-Output-Tag-generateList(null, array(TagType.name, Tag.name ASC), null, null, null, {n}.TagType.name); Which returned me values suitable for a mutliselect box split into catagories (TagType.name) I've updated this to use find(list): $tags = $this-Output-Tag-find(list, array(order=array(TagType.name, Tag.name ASC), null, null, null, {n}.TagType.name)); But this generates the following error: SQL Error: 1109: Unknown table 'TagType' in order clause The SQL being generated is: Query: SELECT `Tag`.`id`, `Tag`.`name` FROM `tags` AS `Tag` WHERE 1 = 1 ORDER BY `TagType`.`name` ASC, `Tag`.`name` ASC My question is: How to I get find(list) to return the data in the same structure as my previous generateList() ? Thanks in advance! :-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Updating a generateList() to use find(list) - problems with syntax?
Looking at the code thats what I thought it would do to (using the 1.2 beta) but my unit tests say that, when trying to generate a list of events.url = events.name - this doesn't work: return $this-find ( 'list' , array ( 'conditions' = $conditions , 'order' = 'Event.eventdate DESC' , 'fields' = array('{n}.Event.url', '{n}.Event.name') , 'recursive' = 0 ) ); whereas this works correctly: $this-primaryKey = 'url'; return $this-find ( 'list' , array ( 'conditions' = $conditions , 'order' = 'Event.eventdate DESC' , 'fields' = array('Event.url', 'Event.name') , 'recursive' = -1 ) ); Hmmm - thinking cap time. And re the original question - yes, look at recursive, I missed that bit out -sorry. ian On Jan 22, 2:07 pm, grigri [EMAIL PROTECTED] wrote: Model::find('list', ...) automatically assumes you want $recursive - -1 (no joins) unless you specify otherwise. Try this: $tags = $this-Output-Tag-find(list, array( fields = array( '{n}.Tag.id', // keyPath : Option value '{n}.Tag.name', // valuePath: Option display field '{n}.TagType.name' // groupPath : optgroups ), order=array(TagType.name, Tag.name ASC), 'recursive' = 0 )); According to the code, the 'fields' argument can contain 1, 2 or 3 fields 1 Field : Sets keyPath to default, uses the arg for the valuePath, sets groupPath to null 2 Fields : keyPath, valuePath specified (in order), groupPath is null 3 Fields : In order: keyPath, valuePath, groupPath On Jan 22, 1:47 pm, RichardAtHome [EMAIL PROTECTED] wrote: Thanks for replying ian, but I'm still getting the same result: Warning (512): SQL Error: 1109: Unknown table 'TagType' in order clause [CORE\cake\libs\model\datasources\dbo_source.php, line 440] And the SQL remains the same: Query: SELECT `Tag`.`id`, `Tag`.`name` FROM `tags` AS `Tag` WHERE 1 = 1 ORDER BY `TagType`.`name` ASC, `Tag`.`name` ASC As you can see, the TagTypes table is not being included so the order by fails. On Jan 22, 1:17 pm, ianh [EMAIL PROTECTED] wrote: Try: $tags = $this-Output-Tag-find ( list, array ( order=array(TagType.name, Tag.name ASC) ) ); The list method is now clever enough to insert a fields option that includes your display key and primary key (usually something like name and id respectively). If you want to generate a list that does not include your models normal display key or primary key then there are two ways to go; either: 1. As in the threan pointed to by manish, retrieve all data with a find then do Set::combine; or 2. Just before you call your list method, set your models displayName and/or primaryKey properties to whatever you want to have returned. ianh On Jan 22, 12:55 pm, manish [EMAIL PROTECTED] wrote: http://groups.google.com/group/cake-php/browse_thread/thread/996efa1f... On Jan 22, 4:20 pm, RichardAtHome [EMAIL PROTECTED] wrote: Hi All I've just upgraded a project to the latest beta 1.2 (cake_1.2.0.6311- beta) and am struggling to get my head around the new find(list) syntax. Previously, I had: $tags = $this-Output-Tag-generateList(null, array(TagType.name, Tag.name ASC), null, null, null, {n}.TagType.name); Which returned me values suitable for a mutliselect box split into catagories (TagType.name) I've updated this to use find(list): $tags = $this-Output-Tag-find(list, array(order=array(TagType.name, Tag.name ASC), null, null, null, {n}.TagType.name)); But this generates the following error: SQL Error: 1109: Unknown table 'TagType' in order clause The SQL being generated is: Query: SELECT `Tag`.`id`, `Tag`.`name` FROM `tags` AS `Tag` WHERE 1 = 1 ORDER BY `TagType`.`name` ASC, `Tag`.`name` ASC My question is: How to I get find(list) to return the data in the same structure as my previous generateList() ? Thanks in advance! :-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---