cakephp-2.3

How do i resolve Error: The requested address was not found on this server - CakePHP

半腔热情 提交于 2019-12-24 03:12:39
问题 I'm using CakePHP 2.X in my project and stuck at one point. First of all let you know that i implemented search functionality using form's POST Method, But for this i found error in pagination. Filter will not sustain for next page. So i changed form method to GET . now its working OK ( Not exactly what i required, All requested data displaying in URL ) , but now i'm at the point where its create another issue. I got below error when i trying to search anything ( Existing data in DB ), and go

Using OAuth for authentication with CakePHP 2.3

半世苍凉 提交于 2019-12-23 16:07:59
问题 I have a CakePHP app that I'd like my users to be able to use OAuth to log in to. I seem to have the OAuth conversation working correctly, as I am getting user info out of the end of it, and can save the tokens to my users table fine. My question is possibly a silly one, but I'm trying to work out when I need to use the token I was given. Should I be storing the user's ID in a cookie, and whenever they 'come back' to my site grab their token from the DB and us it to re-check their details? I

trouble including PHPUnit

℡╲_俬逩灬. 提交于 2019-12-23 12:43:43
问题 I want to start writing tests for my code so I installed the latest PHPUnit with the following commands wget http://pear.phpunit.de/get/phpunit.phar chmod +x phpunit.phar mv phpunit.phar /usr/local/bin/phpunit http://phpunit.de/manual/3.8/en/installation.html then I added /usr/local/bin to my php.ini include path which looks like this include_path = ".:/Applications/MAMP/bin/php/php5.4.10/lib/php:/usr/local/bin" but I'm getting the following errors when I visit /my-app/test.php Warning (2):

Wildcard subdomains and CakePHP

拟墨画扇 提交于 2019-12-23 03:15:24
问题 I'm not strong in .htaccess and for this reason I need your help. Recently I purchased wildcard SSL certificate and changing http to https doesn't work properly. The site is build on CakePHP 2.3 and public_html directory has a following structure: /app /lib /plugins /Cake /sub1.domain.com - app - lib - plugins - ... /sub2.domain.com - app - lib - plugins - ... It is how my hosting handle subdomains. Folder Cake is a shared CakePHP core across all subdomains + main domain. When SSL was

Odd issue with CakePHP Document Root

偶尔善良 提交于 2019-12-23 01:38:28
问题 Ok, here's a new one to me. Here's the situation... I have a Cake app running under multiple environments (dev, qa, staging, live), managed using GIT. I'm developing away on my development branch, and access that branch from dev.BLAH.com. DEV is served out of /var/www/dev.BLAH.com/app Occasionally, when working on DEV I start getting errors like this: Warning (512): Model "Exercise" is not associated with model "ExerciseOutcome" [/var/www/QA.BLAH.com/lib/Cake/Model/Behavior

Strict (2048): Declaration of CsvImportBehavior::setup() should be compatible with ModelBehavior

≡放荡痞女 提交于 2019-12-22 17:48:03
问题 I am getting the following error: Strict (2048): Declaration of CsvImportBehavior::setup() should be compatible with ModelBehavior::setup(Model $model, $config = Array) [APP\Plugin\Utils\Model\Behavior\CsvImportBehavior.php, line 20] I followed the tutorial on this site: http://www.pronique.com/blog/enable-csv-import-all-controllers-models-cakephp-2 When I import my CSV file, it gives the following flash message: Successfully imported 0 records from Book1.csv I don't understand why its not

CakePHP re-populate list box

与世无争的帅哥 提交于 2019-12-20 07:09:27
问题 I have a question about cakePHP. I create two drop down lists in my view. When the user changes the value in one list, I want the second to change. Currently, I have this working like this: An on click event fires when the user selects from list box one. This fires a jQuery ajax function that calls a function from my controller. This is all working fine, but how do I re-render my control, asynchronously (or, view)? I i know I could just serialize the array to json and then recreate the

cakephp - How to handle integrity constraint violation errors

一曲冷凌霜 提交于 2019-12-20 01:46:32
问题 Am at a loss here. I need to know how to handle error messages in case of integrity constraint violations. Meaning i want to show users some meaningful message instead displaying error messages like Error: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails I need to capture these databse errors and just show messages like say The item you are trying to delete is associated with other records How do we deal with this. i

How to associate model in CakePHP by fields not named by convention?

流过昼夜 提交于 2019-12-19 03:39:06
问题 I have two tables with field username in both. How i can specify field name for both local and foreign table? I want CakePHP will do something like ON (`T1`.`username` = `T2`.`username`)` in result. Without any changes tables will be joined with following condition: ON (`T1`.`id` = `T2`.`t1_id`)` Setting 'foreign_key' = 'username' property is not enough because it will produce query like this: ON (`t1`.`id` = `t2`.`username`)` I have two solutions. First one is use 'join' property and join

Using virtual fields in cakePHP 2.x

烂漫一生 提交于 2019-12-19 02:51:53
问题 I've read through the documentation and struggled to understand what to do. Also, I've read through the questions here on stackoverflow, and nothing that I tried helped. I've got a drop down that I want to list all employees in the company. The list should be displayed like this: Name Surname (Job Title) In my Model, I have this piece of code: public $virtualFields = array( 'fullname' => 'CONCAT(HrEmployee.name, " ", HrEmployee.surname, " (", HrEmployee.jobTitle, ")")' ); And in my controller