Questions tagged [cakephp-model]

App models are the classes that sit as the business layer in a CakePHP application.

App models classes are responsible for managing almost everything that happens regarding data, its validity, interactions and evolution of the information workflow in a CakePHP project.

Usually model classes represent data and are used in CakePHP applications for data access, more specifically they represent a database table but they are not limited to this, but can be used to access anything that manipulates data such as files, external web services, iCal events, or rows in a CSV file.

Source: Manual Reference

Example: (CakePHP 2.x)

App::uses('AppModel', 'Model');
class Ingredient extends AppModel {
    public $name = 'Ingredient';
}
501 questions
-2
votes
1 answer

Pass parameters in cakephp function

$this->requestAction("/survey/responsethereuser/qid:$qid,uid:$uid,sid:$sid"); In my controller function responsethereuser($qid = null, $uid=null, $sid=null) It is showing on taking value of qid $qid=1,uid:3,sid:1 How to get all the parameter…
-2
votes
1 answer

CakePHP cascading foreign keys to get a user list

I have a table for users, a table for cities and a table for states. Each user has a city, identified by city_id in its columns, and each city is related to a state by state_id key. I want to get a list of users in each state, but I don't know how…
ranieri
  • 2,030
  • 2
  • 21
  • 39
-2
votes
1 answer

cakephp full find/read depth

I'm basically trying to extend the depth of my query by returning the Users and Comments for both my Project and Update tables. Site visitors can view a Project, which has many Updates listed below it. Users can leave comments on both the initial…
Tim
  • 6,986
  • 8
  • 38
  • 57
-3
votes
1 answer

About Model CakePHP

i have 2 table in database.there are categories and posts. categories have id , name posts have id , category and i have 2 files. PostsController.php edit.ctp i edit category by edit.ctp when i save its image >>…
bbk
  • 1
-3
votes
2 answers

Baking in CakePHP

After setting up my database and baking, the model associations declared are not correct. eg instead of seeing hasOne i see hasAndBelongsToMany so my question here is for examples of sql tables that would generate the 4 correct associations when…
Simba
  • 522
  • 1
  • 5
  • 9
-5
votes
1 answer

Output last 5 rows in database [CakePHP]

I have a database and I want to output the last 5 rows on the database. The model is called 'text'.
DCo
  • 69
  • 2
  • 10
1 2 3
33
34