With all the features and possibilities cakePHP can offer, one sometimes find it hard to always adhere to cake’s naming convention. Like a table definition in your database should be always plural. The class name of the model for that table will be the singular name of the table and so on and so forth.
But as in some cases, someone (like me!) will not always want to follow this convention. Like for example, if I would want to create a table that shall contain some info’s on the site: amazon.com, I would like to be firm on naming my database table as amazon and not amazons.
So for that, we have to tell cakePHP that the model amazon.php shall use the table amazon and not amazons.
So inside amazon.php:
<?php
class Amazon extends AppModel {
var $name = Amazon';
var $useTable = 'amazon';
}
?>
Or if you would rather not use a table at all:
<?php
class Amazon extends AppModel {
var $name = Amazon';
var $useTable = false';
}
?>
