Where or how do I tell CakePHP (2.x) to ignore the Views in a database, so that it works only with the Tables?

200
February 24, 2017, at 01:38 AM

I have a CakePHP 2.x app running with a MySQL database.

Another developer, for another purpose in another app (In Asp.Net) created some MySQL Views in the database itself.

These Views seem to be confusing for my CakePHP app, because it is taking them as tables and messing some things up in terms of keys, relationships, etc.

Is there a way or place for me to tell my CakePHP app that it needs not to worry about these Views and just keep working with the Tables as it always had before?

Answer 1

For every table model your CakePHP app is using, define the table attribute

If a table dont have a Model associated with, you have to create it

class Somemodel extends AppModel{
    public $table = "somemodels";
}
Rent Charter Buses Company
READ ALSO
Vagrant multi-machine - mysql connection between machines

Vagrant multi-machine - mysql connection between machines

I have simple vagrant multi-machine config:

490
MySQL comma separated values into multiple rows

MySQL comma separated values into multiple rows

I'm trying to split string values, which is passed as the parameter to my SQL function into multiple rowsI tried many samples out there but I'm not able to find the correct output

544
MySQL REGEXP case sensitivity when using CONCAT

MySQL REGEXP case sensitivity when using CONCAT

Usually REGEXP is case insensitive, eg

658
Save SQL Query for later, or upload this data as a column on my database

Save SQL Query for later, or upload this data as a column on my database

I want to save the following query to calculate the average of the numbers in my databaseThese are student grades and I want to calculate an average to trace their progress

301