cakephp

SQL Server: How do I convert all varchar(max) columns to text type?

How do I convert all varchar(max) columns to text type? I know varchar(max) is recommended but I still want to use type text because CakePHP doesn't automagically convert varchar(max) to textarea (HTML form). How do I do it? Thanks in advance ...

how to create aro using dbAcl using console

hi i am using cakephp for my project but whille creating acl using command promt. when i run the following command cake schema run create DbAcl it genrate three tables in database. but after puting the following code in users_controller.php. and this command. cake acl view aro it dont create aros. function index() { $aro =& $thi...

Cakephp datasource questions

I need help to understand how to properly build a cakephp 1.3 datasource. FYI, I'm still a beginner regarding OOP. I'll use Mailchimp as an example. Mailchimp provides a "Wrapper" (http://www.mailchimp.com/api/downloads/) for their API. My first question is : Is it overkill to build a datasource since they provide a wrapper ? On with...

minLength data validation is not working with Auth component for CakePHP

Let's say I have a user registration and I'm using the Auth component (/user/register is allowed of course). The problem is if I need to set a minLength validation rule in the model, it doesn't work since the Auth component hashes the password therefore it's always more than my minlength password and it passes even if it's blank. How d...

CakePHP: How to increment count for multiple rows in paginated query

Hello all, In CakePHP, I have this code: $data = $this->paginate('Model', array("MATCH(Model.colA) AGAINST('$q' IN BOOLEAN MODE)")); And I am trying to increment by 1 the values of Model.colB for the rows retrieved (10 per page). So I'm guessing it's something like: $data = $this->paginate('Model', array("MATCH(Model.colA) AGAINST('$...

Is it advisable to store things such as list of cities on the db?

Hi I'm using CakePHP and I'm wondering if it's advisable to store things that don't change a lot in the database lik the list of cities? ...

Validation file upload CakePHP

How validate file upload in CakePHP? When i wrote some like this:var $validate = array( 'file' => array( 'select' => array( 'rule' => array('selectFile'), 'message' => 'There is no file!'), 'type' => array( 'rule' => array('typeFile'), 'message' => 'Bad type!'), ...

Using a single PHP script for an entire site

I had an idea today (that millions of others have probably already had) of putting all the sites script into a single file, instead of having multiple, seperate ones. When submitting a form, there would also be a hidden field called something like 'action' which would represent which function in the file would handle it. I know that thi...

In my cakephp project the save function is not working?

My controller action is: function add() { if (!empty($this->data)) { $this->Customer->create(); if ($this->Customer->save($this->data)) { $this->Session->setFlash('A new Customer has been added'); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash('The customer cannot be added this time. Tr...

Cakephp, don't use a databse table.

I don't a controllers model to use a database table. I have a pages controller and model but it is saying "pages table not found". How do I tell the model not to use a the database at all? Cheers! ...

cakephp 2.0 features?

where can i read more about cakephp 2.0 features? cause i could find symfony 2.0 presentations but not for cakephp 2.0 thanks ...

Validating made up fields in CakePHP?

Here's my scenario: I'm creating a password change page. the real field that holds the password is User.password On the password create page, I used 3 made up fields: $form->input('User.old_passwd'); $form->input('User.new_passwd'); $form->input('User.confirm_new_passwd'); How do I validate them with the rules: old password must matc...

i want to creating image tag system in cakephp?

I want to create image taging system in cakephp can any one say how i create data dictionary and how i handle relationship in cake ? ...

Why is cakephp form input stored in $this->data and POST data stored in $this->params['form'] ?

the cakephp rest tutorial says that post data should be in $this->data, but I am finding that it is not, but instead inside $this->params['form'] However, when using cakephp form helper in a view, the data is in $this->data. Am I correct to have to check both locations in my controller? It just seems a bit of a waste of extra code. S...

Nesting forms in CakePHP

I am wondering if there's a way in CakePHP to nest multiple models in a form? What I'm trying to accomplish is to make a form for creating Posts that will also contain fields for adding Images (separate model) that will automatically be connected to the created post. Something similar to Ruby on Rails ** accept_nested_attributes_for**...

Cakephp: how do I know what route was used

So I am a total cakephp newb and one of the first things I expected to see was basic info about each page request logged. More specifically, I need what route was used and as a result, what controller/method is called. Obviously I did not find what I was expecting and about the only kind of meaningful info I can find is from the apache l...

php array count

I have a var dump of my sql query which return the following I wanna to count in the array below that how many rows of myID = 5 are there. How would I do that. I am using php. Thanks in advance array 0 => object(stdClass)[17] public 'myID' => string '5' (length=1) public 'data' => string '123' (length=3) 1 => ...

Modifying Model data in beforeSave of Behavior when using saveAll

I'm trying to write a Meta behavior for a project I am working on that will allow me to assign custom variables/attributes to a model, similar to how you can create custom fields in a wordpress post. I have created a Meta behavior that binds the meta model to the model it is acting on and also has a beforeSave callback that loops throug...

CakePHP: Create form (records) with db-driven fields (record-fields), save user-provided field values elsewhere (record-datas).

Already developed few websites on top of CakePHP but now ran into a brick wall. To make things simple, here's the scenario: Database Schema: USERS - id - name RECORDS - id - user_id - timestamp RECORD_FIELDS - id - name RECORD_DATA - id - record_id - record_field_id - value Basically it's an control panel for staff that...

Database table posts for model post was not found.

Hi all, I am using cakephp 1.26 to create a simple message board in my localhost. When I tried to link two tables together, I got this error: Error: Database table posts for model post was not found. Here are the table structures of the two tables: Table 'post' has these fields { PostID, Topic, Content} and table 'reply' has these ...