Questions tagged [cakephp-2.x]

Questions about the 2.x branch of the CakePHP MVC framework. If your question applies to CakePHP in general, use the tag [cakephp].

Use this tag for questions specifically about version 2.x of the CakePHP MVC framework. If your question applies to CakePHP more generally, use the tag .

CakePHP is a rapid development framework for PHP that provides an extensible architecture for developing, maintaining, and deploying applications. Using commonly known design patterns like MVC and ORM within the convention over configuration paradigm, CakePHP reduces development costs and helps developers write less code.

CookBook for CakePHP 2.x

302 questions
20
votes
6 answers

CakePHP: How can I use a "HAVING" operation when building queries with find method?

I'm trying to use the "HAVING" clause in a SQL query using the CakePHP paginate() method. After some searching around it looks like this can't be achieved through Cake's paginate()/find() methods. The code I have looks something like…
cowls
  • 24,013
  • 8
  • 48
  • 78
17
votes
11 answers

CakePHP select default value in SELECT input

Using CakePHP: I have a many-to-one relationship, let's pretend it's many Leafs to Trees. Of course, I baked a form to add a Leaf to a Tree, and you can specify which Tree it is with a drop-down box ( tag) created by the form helper. The only thing…
erjiang
  • 44,417
  • 10
  • 64
  • 100
10
votes
1 answer

How to Create a URL in Controller like HtmlHelper

TLDR: How can I create a URL in the Controller similar to how I can use the HtmlHelper to create URLs in a View? Problem: I want to print the url of a controller action, in my controller (because I create my JSON string in my controller, not in a…
mrdaliri
  • 7,148
  • 22
  • 73
  • 107
6
votes
3 answers

How to resolve "Uncaught TypeError" in error handler using CakePHP 2 on PHP7?

Fatal Error Error: Uncaught TypeError: Argument 1 passed to ErrorHandler::handleException() must be an instance of Exception, instance of Error given in /opt/lampp/htdocs/quiz/lib/Cake/Error/ErrorHandler.php:108 Stack trace: #0 [internal function]:…
akshay shringi
  • 113
  • 1
  • 7
6
votes
2 answers

unable to get image with link in cakephp 2.x?

I tried to made image with link using FormHelper..in cakephp. Below are my script: Html->link($this->Html->image('images/view-more-arrow.png') . ' ' . __('View More'),array('controller' => 'zones', 'action' => 'index'),…
Pank
  • 13,800
  • 10
  • 32
  • 45
6
votes
3 answers

Cakephp textarea

I am using CakePHP 2.2.3. I have a contact form with a model without a table but with validation rules. My problem is, how to tell CakePHP that the input type is textarea ? I could use $this->Form->textarea() but I've noticed that when I use it, it…
João Gonçalves
  • 3,903
  • 2
  • 22
  • 36
5
votes
2 answers

How to autoload Composer packages in CakePHP 2 Travis integration

I'm working on a CakePHP 2.x plugin that uses Composer to pull in a package dependency. I am now trying to use the Friends of Cake's Travis package to automatically run my unit tests whenever the plugin's repository is updated. As far as I can tell…
drmonkeyninja
  • 8,490
  • 4
  • 31
  • 59
5
votes
1 answer

CakePHP Error: Class 'String' not found in Acl

My Acl admin is corrupt and I have no idea why, since I haven't changed anything from when it used to work. When I go to /acl, I get the following error: Error: Class 'String' not found File:…
flaggalagga
  • 451
  • 5
  • 14
5
votes
1 answer

How to update an existing .po file with a newly generated .pot file?

Cake version is 2.x. I have extracted all the texts inside __ function with ./Console/cake i18n extract command, moved the default.pot file into app/Locale/[iso3]/LC_MESSAGES/default.po and translated it to corresponding language. Everything is…
dav
  • 8,931
  • 15
  • 76
  • 140
5
votes
1 answer

PHP checkbox data into table?

I have a name list which i need to implement in "checkboxes" and I need to insert those names that are checked, into a table, in SQL through CakePHP. Someone suggested to use: $this->Form->input('Members', array('multiple' => 'checkbox')); I am not…
Disorder
  • 430
  • 1
  • 6
  • 16
4
votes
1 answer

CakePHP - Where is the best place to put custom utility classes in my app structure?

I am making utility classes that will provide general methods for helping manipulate strings. I may also want one for arrays, math functions, etc. Should these be components? Vendors? Could I maybe make these into some sort of vendor package?
BadHorsie
  • 14,135
  • 30
  • 117
  • 191
4
votes
2 answers

cakephp 2 ajax form

I'm having trouble building an ajax form in cakephp 2 which obviously has changed a lot since 1.3. I'm using the following code:
Form->create('Comment', array('action' =>…
Kik Minev
  • 103
  • 1
  • 3
  • 9
3
votes
2 answers

CakePHP 2.x GROUP BY within Containable

I am going nuts trying to find a good solution, either using the set::extract() or something. I want to add a GROUP BY within my containable: $params = array( 'conditions'=>array( 'Project.id'=>$ProjectId ), 'contain'=>array( …
numerical25
  • 10,524
  • 36
  • 130
  • 209
3
votes
1 answer

Cannot use 'Object as class name as it is reserved Cake 2.2.x

I'm having an issue trying to set up a testing copy of a site we have running, I have the files and applications installed under a Mint VM and when I point apache at the directory I get a 500 error and the following- [Thu Oct 25 15:09:39.714201…
James McGrath
  • 187
  • 1
  • 4
  • 15
3
votes
1 answer

How to create a join that uses a subquery?

How do you convert the following SQL Query to a CakePhp Find Query? SELECT a.id, a.rev, a.contents FROM YourTable a INNER JOIN ( SELECT id, MAX(rev) rev FROM YourTable GROUP BY id ) b ON a.id = b.id AND…
jaypax123
  • 188
  • 2
  • 14
1
2 3
20 21