cakephp-2.2

How to declare the type for local variables using PHPDoc notation?

二次信任 提交于 2020-12-04 14:37:48
问题 I use Zend Studio to develop in PHP with CakePHP, and one of the problems with CakePHP is that the views all reference undeclared local variables. So for example, in the controller you would $this->set('job',new MyJobObject()); Then in the view you could echo $job->getName(); My problem is that Zend Studio can't perform autocomplete on $job , because it's type is unknown. Now there are PHPDoc tags that allow you to declare the type so that IDE's can perform autocomplete. The @var tag for

CakePHP form authentication for normal requests with basic authentication for JSON

心已入冬 提交于 2020-01-24 12:33:08
问题 I'm attempting to to build a web application that can be view by a user in a browser but also has an API for developers to interface with my application. My question is how do I change the authentication based on what type of request it is in CakePHP? I would like my application to prompt users using the site with form authentication but when a request comes in with a '.json' to use basic authentication. I've tried this in my AppController: class AppController extends Controller { public

dispatcher calls code from another app occasionally

拥有回忆 提交于 2020-01-17 12:36:46
问题 We just upgraded some of our apps (from 1.3) to cakephp 2.2 and refactored the code. our basic server setup looks like htdocs/subdomain.domain/cakeapp1/... htdocs/subdomain.domain/cakeapp2/... sometimes we receive errors, which are due to the problem, that cake internally decides to call code from within another app folder. so, we call a route from cakeapp1 and all of a sudden, in the middle of the stack trace, cake calls files from cakeapp2. so, although no code in cakeapp1 references the

Converting named parameters to GET parameters for pagination at CakePHP 2.2

百般思念 提交于 2020-01-06 08:48:13
问题 I am trying to convert named parameters to GET parameters for pagination at CakePHP 2.2 following the instructions given in the documentation but it is not working. Instead of this: http://localhost/cake/posts/yourPosts/page:2?url=posts%2FyourPosts I want this: http://localhost/cake/posts/yourPosts/?page=2&url=posts%2FyourPosts The thing is, when i submit a form using GET method, i don't want to retain the current page, and currently, it is doing it by default because it is not a normal param

Applying Limit on associated model Cakephp 2.3x HABTM

不打扰是莪最后的温柔 提交于 2020-01-05 08:56:28
问题 My Category Model: class Category extends AppModel { public $displayField = 'name'; // public $actsAs = array('Containable'); public $hasAndBelongsToMany = array( 'Post' => array( 'className' => 'Post', 'joinTable' => 'categories_postss', 'foreignKey' => 'category_id', 'associationForeignKey' => 'post_id', 'unique' => 'keepExisting' ) ); } $params['contain'] = array('Post' => array( 'limit'=> 3)); pr($this->Category->find('first',$params)); exit; It is fetching all Posts, irrespective of

Menu Component CakePHP markstory

家住魔仙堡 提交于 2020-01-05 07:24:00
问题 I've edited the CakePHP Menu Component made by Mark Story to make it compatible with CakePHP 2.2.3. https://github.com/markstory/cakephp_menu_component The problem is that I still get an error that I can't figure out how to get rid of: http://imm.io/MK9J http://imm.io/MK9W http://imm.io/MKa7 Here is the modified code: <?php /** * Menu Component * * Uses ACL to generate Menus. * * Copyright 2008, Mark Story. * * Licensed under The MIT License * Redistributions of files must retain the above

Menu Component CakePHP markstory

人走茶凉 提交于 2020-01-05 07:23:19
问题 I've edited the CakePHP Menu Component made by Mark Story to make it compatible with CakePHP 2.2.3. https://github.com/markstory/cakephp_menu_component The problem is that I still get an error that I can't figure out how to get rid of: http://imm.io/MK9J http://imm.io/MK9W http://imm.io/MKa7 Here is the modified code: <?php /** * Menu Component * * Uses ACL to generate Menus. * * Copyright 2008, Mark Story. * * Licensed under The MIT License * Redistributions of files must retain the above

Add a new translatable field to an existing translatable table in CakePHP 2.2

此生再无相见时 提交于 2020-01-02 23:35:33
问题 I'm using CakePHP's translatable behavior. I have a few existing fields working fine, but I'm having trouble adding a new translatable field to my model. CakePHP uses an INNER JOIN to fetch all translatable fields from the database. Now, if I add an extra translatable field to my model, all the translation records for that field won't exist in the database. And because of the inner join, whenever it tries to fetch ANY existing records from the database, it will return blank - because the

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

一曲冷凌霜 提交于 2019-12-30 14:08:43
问题 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 2018] [php7:error] [pid 8945] [client 192.168.0.14:52237] PHP Fatal error: Cannot use 'Object' as class name as it is reserved in /home/jamesmcgrath/Documents/dashboard/lib/Cake/Core/Object.php on line 30 [Thu Oct 25 15:09:39.714547 2018] [php7:error]

Parsing HTML in Cakephp

情到浓时终转凉″ 提交于 2019-12-24 10:56:23
问题 I started building a web crawler in CakePHP 2.2. The pages, the script is crawling is HTML pages, and I need to parse them, to get my values. Have tried some different solutions, and looked on some open source things aswell, but not sure what the best way is to do this. DomDocument::loadHTML() - Looks like this is the solution but not 100% sure. Regular Expression - A bit hard to maintain Simple HTMLDom - http://electrokami.com/coding/simple-html-dom-baked-cakephp-component (Made for Cake 1.3