cakephp-2.0

How to get $settings data out of CakePHP 2.0 FormAuthenticate object

僤鯓⒐⒋嵵緔 提交于 2020-01-06 07:57:07
问题 I am building a RememberMe Component using the AuthComponent and would like to get the BaseAuthenticate::$settings data (userModel and fields) data out of the XxxxAuthenticate object so I can know what model and fields I should be dealing with, but I can't seem to figure out how to get that data back out. Any suggestions? Basically I need something with the same functionality as Auth::getModel( ) or Auth::$userModel from Cake 1.X. Cake- 2.0.3 回答1: Auth::$userModel still exists in 2.0. However

CakePHP - How do I join a table on a joined table?

拜拜、爱过 提交于 2020-01-06 07:34:11
问题 I am in the FilesController and I'm trying to get a file based on the condition that its order belongs to the current user. FilesController // Check the file exists and that it belongs to the user $this->File->find('first', array( 'conditions' => array( 'File.id' => $id, 'Order.Customer.id' => $this->Auth->user('id') ), 'recursive' => 2 )); Cake SQL Error Unknown column 'Order.Customer.id' in 'where clause' I'm trying to get the SQL to left join orders onto files and then left join customers

How associations get defined when code is baked in Cakephp

孤街醉人 提交于 2020-01-05 14:04:02
问题 I was trying to bake the blog tutorial in console. I created one table named posts and baked the code and all MVC files were created properly. Then I created another table named comments and I again baked the code but no relationship gets defined by baking and comments was created as separate part from blog. I want to define has many relationship means blog has many comments. How will it get defined through console? Please give some idea? Or am I running bake incorrectly? Many thanks. 回答1:

CakePHP core tests not working on IIS

北城以北 提交于 2020-01-05 10:31:31
问题 I'm following the steps (from http://book.cakephp.org/2.0/en/development/testing.html) to set up Testing on a CakePHP install. Viewing the core tests is supposed to be as simple as appending /test.php to my application's URL. But when I do that, I get an error page, saying... Missing Controller Error: Test.phpController could not be found. Error: Create the class Test.phpController below in file: my-app\Controller\Test.phpController.php Obviously, "test.php" is supposed to be a real file, not

CakePHP core tests not working on IIS

ぐ巨炮叔叔 提交于 2020-01-05 10:31:30
问题 I'm following the steps (from http://book.cakephp.org/2.0/en/development/testing.html) to set up Testing on a CakePHP install. Viewing the core tests is supposed to be as simple as appending /test.php to my application's URL. But when I do that, I get an error page, saying... Missing Controller Error: Test.phpController could not be found. Error: Create the class Test.phpController below in file: my-app\Controller\Test.phpController.php Obviously, "test.php" is supposed to be a real file, not

CakePHP 2.0 - customize database error message

心不动则不痛 提交于 2020-01-05 09:22:53
问题 I have a CakePHP 2.0 application with a MySQL database. Two database tables are connected with a 1:n relation and a foreign key constraint. So if I want to delete an entry which is connected in the other database table, I get the error: Error: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a forein key constraint fails (...) SQL Query: DELETE 'Test' FROM 'tests' AS 'Test' WHERE 'Test'.'id' = 10 Notice: If you want to customize this error message,

How to connect a post rest request to the add controller action using prefixes in cakephp

一曲冷凌霜 提交于 2020-01-05 08:23:10
问题 I code a client/server application. Server side is powered by CakePHP 2.4.7. Client side run with angularjs and cordova on mobile devices I use several cakephp route prefixes whose 'admin' and 'mobile'. (And I use $resource and $httpInterceptor angularjs factories to setup my REST requests.) I want to call /website/mobile/posts/add.json with json data posting. So I call /website/mobile/posts.json with a POST ajax query: The problem is here: the called controller action is 'index', not 'add';

CakePhp 2.6.3 Not Working on PHP 7

落花浮王杯 提交于 2020-01-04 06:15:22
问题 Fatal error : Uncaught Error: Class 'String' not found in /var/www/html/hrportal/lib/Cake/Utility/Debugger.php:340 Stack trace: 0 /var/www/html/hrportal/lib/Cake/Utility/Debugger.php(742): Debugger::trace(Array)1 /var/www/html/hrportal/lib/Cake/Error/ErrorHandler.php(229): Debugger->outputError(Array) /var/www/html/hrportal/app/Controller/AppController.php(72): ErrorHandler::handleError(8, 'Undefined index...', '/var/www/html/h...', 72, Array) 3 /var/www/html/hrportal/lib/Cake/Event

CakePhp 2.6.3 Not Working on PHP 7

不羁的心 提交于 2020-01-04 06:12:21
问题 Fatal error : Uncaught Error: Class 'String' not found in /var/www/html/hrportal/lib/Cake/Utility/Debugger.php:340 Stack trace: 0 /var/www/html/hrportal/lib/Cake/Utility/Debugger.php(742): Debugger::trace(Array)1 /var/www/html/hrportal/lib/Cake/Error/ErrorHandler.php(229): Debugger->outputError(Array) /var/www/html/hrportal/app/Controller/AppController.php(72): ErrorHandler::handleError(8, 'Undefined index...', '/var/www/html/h...', 72, Array) 3 /var/www/html/hrportal/lib/Cake/Event

cakephp checkbox is showing extra hidden field

你说的曾经没有我的故事 提交于 2020-01-03 20:01:19
问题 foreach($apps as $app){ echo $this->Form->input('Application', array('type'=>'checkbox', 'id'=>$app['Application']['description'], 'div'=>false,'type'=>'checkbox','value' => $app['Application']['description'],'label'=>$app['Application']['description'])); } <div class="checkboxes"> <input type="hidden" name="data[Group][Application]" id="GG_" value="0"/><input type="checkbox" name="data[Group][Application]" id="GG" value="GG"/><label for="GG">GG</label><input type="hidden" name="data[Group]