Questions tagged with models

1 answer

0 votes

Asked by tekcorap, on 1/4/10 in

always use singular model and controller names

Hi everyone, I have a small problem. I'm using CakePHP 1.2.6.

Unfortunately, not as in English plurals in Turkish. eg

"makale"(article) in the plural of the word Turkish "makaleler" (not

articles). Create a model when I check the articles CakePHP...

2 answers

1 vote

Asked by ojtibi, on 15/11/09 in

"Bake" validations differences between Name and Title fields

I don't know if any of you have already noticed this, but when we're baking a model in the Cake Bake console, there is a subtle differences for default validations between fields named "name" and "title":

name : the default selected validation...

1 answer

0 votes

Asked by nleach, on 12/6/10 in

$this->data set to false after save

Just curious why after saving data into a model, $this->data is set to false. Is there some best practice I'm missing?

1 answer

0 votes

Asked by rodcord, on 1/6/10 in

3 relationships between 2 tables

What is the correct way to make a relationship at Cake when I have two tables with three relationships between them, for example:

Table: users

Table: Computers

For each computer that I subscribe, I must have 3 users.

So computers have on the table...

2 answers

0 votes

Asked by Alevsk, on 23/4/10 in

add another field after baking

Hello, its me again, now im developing a aplication from a school, I create the aplicacion with cake bake, but now I need to add another field called "phone number", I add directly in the database with phpmyadmin, and modify the views and create...

1 answer

0 votes

Asked by Rahu1, on 1/4/10 in

Associations using hasMany

I have the following models with their associations

post hasMany comment

user hasMany comment

comment belongsTo post and user

when i paginate using the following code the result does not come out as i want it to.

$this-paginate =...

1 answer

0 votes

Asked by csj16, on 17/5/10 in

Associations?

I am very new to CakePHP and I would really appreciate any sort of help with this problem.

I have 3 tables in my database and 3 models for each of them:

User

Friend

Messages

Now I can't seem to figure out how to go about linking them with...

2 answers

0 votes

Asked by tnbrooks, on 17/1/10 in

Auth components password issue

When submitting a registration form I have the password field left blank. As this is required for the Auth component (have also set the email address as the username) it appears to be hashing the field value even if there is no value in it.

When...

1 answer

0 votes

Asked by ajushi.myopenid.com, on 4/12/09 in

Auto converting data from a datetime field to a specific format in CakePHP

Hi is possible to format (using date()) all data from a datetime field in CakePHP? I'm thinking about using a callback function in the model but I don't know if I could filter fields coming from a datetime type.

Thanks in advance!

1 answer

0 votes

Asked by washington, on 12/6/10 in

beforeSave() was not working

Hi all,

I got two simple input text fields in a HTML form:

<input type="text" name="data[User][name]" id="data[User][name]"

<input type="text" name="data[User][pswd]" id="data[User][pswd]"

The scripts for the Controller's action that captured the...

0 answers

0 votes

Asked by spww, on 16/5/10 in

belongsTo and hasMany relation split in two queries?

Hello there,

I've got four models: User, Gallery, Picture, Comment

Picture got the following relations set in its model.php:

var $belongsTo = array('Gallery', 'User');

var $hasMany = array('Comment' = array('dependent' = true));

I've got a pagination...

1 answer

0 votes

Asked by capo64, on 20/5/10 in

Best way to store statuses?

Ok, my app has 3 different main models: customers, products, and orders. Each of these will have statuses, but they are going to be different, eg:

Customers:

created, authorized

Products:

back-ordered, in stock, discontinued, not...

2 answers

0 votes

Asked by lbanegas, 6 days, 7 hours ago in

Binding models. Problem.

I have three tables in the database.

--------------------

Table: cities

Field 1: id

Field 2: name

Field 3: province_id

(City BelongsTo Province)

--------------------

Table: provinces

Field 1: id

Field 2: name

Field 3: country_id

(Province HasMany City AND...

0 answers

0 votes

Asked by geneller, on 29/4/10 in

cake 1.3 displayfield error

hi

i'm using a plugin made by myself and works great!!, but when i try to change $displayField property in model, it does not take the new value, else, continue searching a field (name) that never existed !! , he must search a field named;...

0 answers

0 votes

Asked by geneller, on 29/4/10 in

cake 1.3 displayfield error

hi

i'm using a plugin made by myself and works great!!, but when i try to change $displayField property in model, it does not take the new value, else, continue searching a field (name) that never existed !! , he must search a field named;...

1 answer

0 votes

Asked by webria, 1 week, 1 day ago in

CakePHP and a NoSQL style db

Hi,

We are looking to build a project which needs to be scalable and with fast read writes to the db. We are looking at using the NoSQL style of database design, mainly storing the data in key value pairs in a regular MySQL database.

With regard to...

2 answers

0 votes

Asked by soimon, 1 week, 6 days ago in

CakePHP Model->Save not safe?

Hi.

While I was trying to create a simple commenting system, I discovered that the way of saving comments like the blog-tutorial is not safe in CakePHP.


// Validate and add data
		
if( !empty( $this->data ) )
{

	$this->Series->create( );
	if(...

1 answer

0 votes

Asked by wcolbert, 2 weeks, 1 day ago in

Callback beforeDelete

I'm trying to delete images when deleting the container of those images with a cascading model::delete

The cascading works fine, but I can't get the model call back afterDelete to work properly so I can delete the actual image files when doing the...

1 answer

0 votes

Asked by zaph, on 4/6/10 in

Callbacks not triggered for associated models when using saveAll() ?

I'm trying to use the AclBehavior to create ACOs when I create a record from a model. This seems to work fine if I create the record directly from the model and save. However, I have this situation where any record created as part of the...

1 answer

0 votes

Asked by zorgath, on 1/4/10 in

Cannot bake a model without a table

I am trying to bake some models. It shows the possible models based on your current database:

1. Comment

2. Post

3. User

I enter in 2 for Post.

It says "given your model named 'Post', Cake would expect a database table named 'posts' Do you want to...

<< previous 1   2   3   4   5   6   7   8