I'm calling this function from a controller:
$this->set('menu_items', $this->MenuItem->findAll(null, null,
array('ui_name')));
and I get the following error:
SQL Error in model MenuItem: 1052: Column 'ui_name' in order clause is
ambiguous
And I can't for the life of me figure out why. If I call findAll
without arguments, there's no problem, but it's unordered.

My model definition looks like this

class MenuItem extends AppModel {
        var $name = 'MenuItem';
        var $useTable = 'tester';
 ...
}

and the tester table looks like this:

mysql> describe tester;
+-----------+------------------+------+-----+---------+----------------+
| Field     | Type             | Null | Key | Default | Extra
|
+-----------+------------------+------+-----+---------+----------------+
| id        | int(10) unsigned |      | PRI | NULL    | auto_increment
|
| name      | varchar(255)     | YES  |     | NULL    |
|
| ui_name   | varchar(50)      |      |     |         |
|
| parent_id | int(10) unsigned | YES  |     | NULL    |
|
+-----------+------------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)

mysql>

And a basic sql command like this works:
mysql> select * from tester order by ui_name limit 3;
+-----+-------------------+------------------------------------------+-----------+
| id  | name              | ui_name                                  |
parent_id |
+-----+-------------------+------------------------------------------+-----------+
|  81 | NULL              | Articles                                 |
      26 |
|  53 | basics            | Basics                                   |
       6 |
|  54 | bigpicture        | Big Picture                              |
       6 |
+-----+-------------------+------------------------------------------+-----------+
3 rows in set (0.03 sec)

mysql>

I've tried findAll with all these combinations:
findAll('','','ui_name')
findAll('','','ui_name ASC')
findAll(null,null,'ui_name ASC')
findAll(null,null, array('ui_name'))
findAll(null,null, array('ui_name' => 'ASC'))
and a bunch of permutations of that. Any ideas why this isn't working?

Thanks,
Ian


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

Reply via email to