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
0
votes
1 answer

CakePHP Bake - Issues with underscores in Table Names

I am trying to bake a model that uses a table called "forecast_counties". I cannot for the life of me get the automated bake process to use this table. I've tried the following: "cake bake all forecast_county" "Fatal error: Class 'ForecastCounty'…
DirtyBirdNJ
  • 574
  • 10
  • 26
0
votes
2 answers

how to get ids of the rows updated by updateAll() function in cakephp?

I am developing an application in cakephp. I need to get id's of all the rows that have been updated using updateAll() function in cakephp. Any suggestions would be highly appreciated. Thanx.. Is this what i should do in my App Model class AppModel…
Vineet
  • 287
  • 2
  • 14
0
votes
2 answers

How to create a custom callback function in cakephp after saveAll()

I am developing an application in cakephp. In this application I am using saveAll() function at many different places to save multiple records. What is need is to create a callback function which automatically gets called after saveAll() is…
Vineet
  • 287
  • 2
  • 14
0
votes
1 answer

CakePHP Validation not displaying messages

I have only recently started using CakePHP and have been unable to get validation to work in a contact app that I have created for the sole purpose of testing forms. Once I setup the $validate array in the modal, the asterisks showed up on the form,…
drewwyatt
  • 5,989
  • 15
  • 60
  • 106
0
votes
1 answer

Cakephp 2.1 Plugin not detect Model Package

at first sorry my bad English I want load model in my plugin controller i have a controller in this path: /app/Plugin/Services/Controller/TypesController.php and i have a model in this path: /app/Plugin/Services/Model/ServiceType.php i want load…
navid_gh
  • 1,863
  • 3
  • 17
  • 30
-1
votes
1 answer

Cakephp, wrong values are inserted

im having strange bug meaning from time to time my application inserts wrong values in my MySQL table users. I was trying to edit user in many ways but couldn't find where is bug in my code so my question is: Does CakePHP have somekind of access…
Viszman
  • 1,378
  • 1
  • 17
  • 47
-1
votes
2 answers

cakephp 2 $this->Model not set

I am working on Cake 2.4 and if i debug $this in my controller, then $this->Model is not set but should. Controller: CustomersController(.php) Model: CustomerModel(.php) Since the naming Conventions are right, i have no clue where the issue is be…
user2610087
  • 117
  • 3
  • 13
-1
votes
2 answers

Deep Associations works with recursive => 2 but too slow to load

I have 3 models Product having product_family_id as foreign key to ProductFamily and ProductFamily have customer_id as foreign key to Customer. Putting recursive to 2 in Product model allow me to get Customer name from Customer for a product. But…
-1
votes
1 answer

cakephp friendship between users Linking models together

What I need: A facebook-like friendship system. User (A) sends a requests for a friendship with User (B) User (B) confirmes the request User (A) and User (B) are friends now My problem: I'm confused how to work this out. I read a lot on the…
kenwebart
  • 51
  • 2
  • 9
-1
votes
1 answer

How to access profile model filename field to display each users profile picture

Hi all I am trying to access the profile picture filename for each individual user as and when they are logged into the system. I have a 'profiles' table and I need to make this available in my default.ctp view file as I am trying to load profile…
Joshua
  • 371
  • 2
  • 6
  • 23
-1
votes
2 answers

CakePHP 2.2.4: Undefined Index Error

Possible Duplicate: PHP: “Notice: Undefined variable” and “Notice: Undefined index” Many people have asked questions regarding the "Notice (8) Undefined Index" error message but none of the solutions are working for me. I'm not sure if my model…
bowlerae
  • 924
  • 1
  • 14
  • 37
-1
votes
1 answer

Cake PHP registration form

Possible Duplicate: Call to a member function on a non-object I have just started learning cake php and am attempting to create a very simple registration form consisting of one field. I'm having trouble interacting with my model however. Code…
BIOS
  • 1,655
  • 5
  • 20
  • 36
-2
votes
2 answers

How to remove model using command line from CakePHP project

I have an annoying model that I accidentally created that keeps interfering with my cake schema run update command. how can I destroy this model? ok, I believe it is just easier to remove model file. I was just curious about cakephp-scripts…
lollercoaster
  • 15,969
  • 35
  • 115
  • 173
-2
votes
1 answer

Change id column name in cakephp(in the Db the id column has different name)

I know i have to declare the unique column(PK) with ID.But the database is already exist, and was created with a different name(Reg_name) than ID.How can i set in cakephp to use Reg_name insted of id?
Andrewboy
  • 364
  • 5
  • 15
-2
votes
1 answer

How do I reuse components that handle logic related to models in shell scripts for CakePHP?

So, CakePHP is a really awesome MVC framework, but I'm looking to better understand the MVC architecture in it, especially for services and organizing logic. I currently have a lot of logic in components related to models, but I want to do some…
1 2 3
33
34