Unfortunately I don't think there is a native way to allow this (yet)
however correct me if I am wrong.
I did a test the other day and managed to get it to work as far as I
could tell.
create your model as below:
app/models/list_model.php
<?php
class ListModel extends AppModel {
var $name = 'ListModel';
var $useTable = 'lists';
function __construct($id = false, $table = null, $ds = null) {
parent::__construct($id, $table, $ds);
$this->alias = 'List';
}
}
?>
Then in your controller:
app/controllers/lists_controller.php
<?php
class ListsController extends AppController {
var $name = 'Lists';
var $uses = array('ListModel');
function beforeFilter() {
parent::beforeFilter();
$this->List = $this->ListModel;
}
function index() {
$lists = $this->List->find('all');
pr($lists);
exit;
}
}
?>
Hope that helps... of course, this could be abstracted into a
behaviour and component or app_controller and app_model, however I
would prefer to see this implemented correctly into the core (if it
isn't already).
Cheers,
Adam
On Apr 1, 11:53 am, Colin Viebrock <[EMAIL PROTECTED]> wrote:
> I'm guessing this isn't possible, since "list" seems to be a reserved
> class name in PHP (5.2.5).
>
> class List extends AppModel {
> var $name = 'List';
>
> }
>
> Parse error: syntax error, unexpected T_LIST, expecting T_STRING in /
> var/www/app/models/list.php on line 3
>
> Is there a way around this? I could, of course, rename my database
> table and stuff ... but I really want to call it "list"!
>
> - Colin
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---