Questions tagged with models

0 answers

0 votes

Asked by MoAX, 1 week, 5 days ago in

[noob]A Cake error trying to internationalize my website

Hi,

Today I started to internationalize my website (and its database). I add this code in each of my model files :


var $actsAs = array(
			'Translate' => array(
				'title' => 'title'
			)
		);

But an error occurs when Cake tries to render a web...

1 answer

0 votes

Asked by rossenzahariev, on 7/7/10 in

Why is $data cleared on save/update?

Hello,

I am new to cakePHP and I have the following question:

After each save/update operation on the model the $data attribute is cleared. Why is that?

For instance:



$this->Users->read(null, 1);
//here User->data is filled with...

1 answer

0 votes

Asked by birdwing, 2 weeks, 5 days ago in

Why do I keep getting the error: "Your database doesn't have any tables" while trying to bake?

I have a database called "Churches".

This database has tables set up as such:

  • churches
  • * id
  • * name
  • * denomination
  • * description
  • * address_id
  • * phone_number
  • * email
  • active_charities
  • * id
  • * church_id
  • * charity_id
  • active_events
  • * id
  • * church_id
  • *...

0 answers

0 votes

Asked by jonnie, on 10/6/10 in

Why do all INT fields become ID's in my Join Table?

I have three models User, Instructor, and Subject. The User model expectedly represents a user. The Instructor model can be thought of as a profile. It contains information about a user. You can think of the Subject model as tags.

I'm trying to...

1 answer

0 votes

Asked by rohanfaye, on 15/4/10 in

Whether the concept of "fat models and skinny controllers" is a good, or rather advisable way to follow in CakePHP? What are the possible pros and cons?

I came to know about the concept of "Fat Models and skinny Controllers" and I'm following the same in my project. I am doing the following things:

-I write the actions in the controller as the request first goes to the controller action

-After...

0 answers

0 votes

Asked by georlitz, on 11/12/09 in

What is the use of the AcoAction model?

I'm working on coding up a nice interface for adding/removing ACOs, and granting/revoking permissions on them for the AROs in my database. I have a functioning system, but it definitely could use some polishing.

With that context in mind, what is...

2 answers

0 votes

Asked by ebemunk, on 18/2/10 in

What is the best practice for keeping user history?

Hi there,

A little personal project I'm working on requires a history of users who vote on stuff (so that they don't get to vote twice). Structurally I was going for a MySQL table that holds user_id and image_id, both foreign keys with reference...

6 answers

2 votes

Asked by trevorsg, on 30/10/09 in

What do you think of my Validation tool?

I got frustrated with long complicated validation rules in my models, and the limited functionality of Bake's validation generation, so I made my own tool. If I get enough support I will clean it up, make it pretty, and probably get it its own...

3 answers

-2 votes

Asked by ojtibi, on 15/11/09 in

Validation: Difference between allowEmpty flag and notEmpty rule

I was reading the Cookbook tonight and I noticed that there are comparisons for the "required" flag and "notEmpty" rule, and the "allowEmpty" flag and the "required" flag...

But no comparison for the "allowEmpty" flag and "notEmpty" rule.

So the...

2 answers

0 votes

Asked by Insomniaque, on 28/11/09 in

Validation Rules: between and minLength != required?

While following some of the beginner tutorials, and playing around with CakePHP, I noticed that on the CRUD pages generated from the Cake console, the Create page would list many fields as bold, and many as normal text. A Google search told me,...

1 answer

0 votes

Asked by silverskull, on 12/3/10 in

Validation error across other controllers

hi what i am doing right now is to create a forum page on which there is a form to add threads...

i want to place some basic validation on the make thread form for alphanumeric only...

so far the validation works when i put in alphanumeric content,...

0 answers

0 votes

Asked by ckdarby, on 18/3/10 in

Validation bug?


	var $validate = array(        
		'username' => array(
			'normalCharacters' => array(
				'rule' => 'alphaNumeric',
				'message' => 'This must contain letters and numbers only.',
				'allowEmpty' => false
			),
			'checkUsername' =>...

2 answers

0 votes

Asked by rossjha, on 30/3/10 in

Validating data from controller

Hi

I have a form i need to validate and i'm not saving data to a table. For some reason the validation doesn't seem to kick in? Any help would be appreciated.

R


class SamplePack extends AppModel {

	var $name = 'SamplePack';
	var $useTable =...

2 answers

0 votes

Asked by Tamsmiranda, on 2/3/10 in

Valadete field 2 only if field 1 is not empy!

How i can validate field 2 only if the field 1 is not empty?

Field1 [callme] (boolean)

Field2 [phone] (phone)

if [callme] notnull validate [phone]

1 answer

0 votes

Asked by odin88, on 9/12/09 in

using model in components

I'm using CakePHP 1.1

Im trying to save data in a table but i got this error

Notice: Undefined property: AttendanceComponent::$AttendanceCache in C:\wamp\www\mpk\app\plugins\attendance\controllers\components\attendance.php on line 368

Fatal error:...

1 answer

0 votes

Asked by Jimmie, on 18/7/10 in

Using Model Functions in Views

(Sorry if this is a regularly asked question, I ran a search and it did not show me any results. I am new to CakePHP, just started an hour ago.)

So, I am developing an application powered by CakePHP (It was originally powered by CodeIgniter but...

1 answer

0 votes

Asked by PawełMysior, on 22/2/10 in

Users HABTM Permissions, list user permissions

Well, I have a users and a permissions table, plus a joining table (permissions_users). Everything with the convention. Now in the permissions controller I want to build a method that will list permissions for the specified user. I've got this:


 ...

1 answer

0 votes

Asked by werle, on 2/7/10 in

Users and Friends relationship - HABTM

Hi all!

I need a system that associate users from one single table making them friends. Until now, everything goes fine. The problem is when the user 1 is friend of user 2, cake don't understand that user 2 is friend of user 1 too.

Is there a way...

1 answer

2 votes

Asked by Shard, on 7/12/09 in

User and Friends Relationship

Im trying to work out how to best setup a friends relation for each user to have and belong to many friends and there will be system to send a friend request and for the other user to accept or deny.

I have looked around for an article talking...

1 answer

0 votes

Asked by error77, 2 weeks, 1 day ago in

Update form with a twist

Hi all,

I hope someone can help me as I cannot find anything on google.

I need to update a form in cakephp into fields from different tables.

For example:

<h1Update this

<?php

echo $form-create('Post');

echo $form-input('fieldFromTable1'); //Table 1...

<< previous 1   2   3   4   5   6   7   8   9