Reputation: 193
I have to modify an existing project, coded in cakephp. I am not much aware of cakephp. I need to access tables in database, without using model. The existing code is as below:
There are two tables 'users' and 'videos'. In one of the controller following code is used to access table.
public $uses = array('User','Video');
$data = $this->User->findByPhone($phone);
My doubt is how does the control identify 'User' as an object pointed to 'users' table ? Please help..
Upvotes: 3
Views: 2065
Reputation: 296
Cake is all about conventions. You can change models table using useTable
Upvotes: 0
Reputation: 4142
Allowing a controller to access additional models through the $uses variable.
Model classes represent data and are used in CakePHP applications for data access. They generally represent a database table.
If model class is not defined then it uses AppModel and AppModel extend libray model class that describes :-
model classes represent data and are used in CakePHP applications for data access. They generally represent a database table but can be used to access anything that manipulates data such as files, external web services, or iCal events.
Upvotes: 1