cakephp-2.1

SplFileInfo::openFile(/app/tmp/cache/persistent/cake_core_cake_console_):failed to open stream:Permission denied in /lib/…/FileEngine.php line 293

女生的网名这么多〃 提交于 2019-11-28 18:47:15
I am working on a CakePHP 2 project. It originally started out in 2.0.x and then recently migrated to 2.1.0. Throughout the whole development process, I have been receiving the error message below. It pops up at the top of the page unpredictably. It can be when I am just viewing different pages, or even after I add a record to the database (yet the record properly saves). Warning: SplFileInfo::openFile(/var/www/cake_prj/app/tmp/cache/persistent/cake_core_cake_console_): failed to open stream: Permission denied in /var/www/cake_prj/lib/Cake/Cache/Engine/FileEngine.php on line 293 I recursively

Where to register event listeners

大城市里の小女人 提交于 2019-11-28 18:24:10
I'm trying to use the Event System in CakePHP v2.1+ It appears to be quite powerful, but the documentation is somewhat vague. Triggering the event seems pretty straight-forward, but I'm not sure how to register the corresponding listener(s) to listen for the event. The relevant section is here and it offers the following example code: App::uses('CakeEventListener', 'Event'); class UserStatistic implements CakeEventListener { public function implementedEvents() { return array( 'Model.Order.afterPlace' => 'updateBuyStatistic', ); } public function updateBuyStatistic($event) { // Code to update

CakePHP 2.x Auth with Two Separate Logins

烂漫一生 提交于 2019-11-28 17:39:35
Back in May, I posted this question . I'm trying to do the same thing again on a different app, but I haven't found a solution to this problem. I do have more information and better code, so I'm hoping you guys can help me sort this out. Use Case: Doctor's office has a website with admin users. The users login successfully with CakePHP's Auth via User model and UsersController . Doctors have referring physicians with completely different profiles and actions. Doctors need to login via example.com/physicians/login . However, this login is failing with this authError => 'You are not authorized

Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual

ぐ巨炮叔叔 提交于 2019-11-28 13:14:53
Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@g.com, 'User'.'phone' = 87665r5, 'User'.'address' = 23lsdhf, 'User'.'location' ' at line 1 SQL Query: UPDATE 'cake'.'users' AS 'User' SET 'User'.'username' = paul, 'User'.'password' = eben, 'User'.'email' = paul@g.com, 'User'.'phone' = 87665r5, 'User'.'address' = 23lsdhf, 'User'.'location' = lskjaflasi, 'User'.'pincode' = 867567 WHERE 'User'.'id' = 1 My code is if($this->request->data) {$User=$this

CakePHP saving data in HABTM fields

北慕城南 提交于 2019-11-28 12:50:41
问题 I am using these three relations User, Movie and UsersWatchlist.. Where users_watchlists contains movie_id and user_id as attributes.. I have this structure array( 'User' => array( 'id' => '3' ), 'UsersWatchlist' => array( 'UsersWatchlist' => array( (int) 0 => '3' ) ) ) public function watchlist($id = null) { $userid = '3'; if (!$id && $userid != 3) { $this->Session->setFlash('Invalid Movie'); $this->redirect($this->referer(array('action' => 'listing'))); } $this->request->data['User']['User'

Using Oracle database with CakePHP 2.0

戏子无情 提交于 2019-11-28 12:26:49
I have noticed there's no datasource for Oracle in CakePHP 2.0 for the moment, although it seems they are working on in it now: http://ask.cakephp.org/questions/view/any_news_about_oracle_datasource_with_cakephp_2_0 There are some people explaining how to use an Oracle DB adapting some code from CakePHP 1.3: http://www.hassanbakar.com/2012/01/09/using-oracle-in-cakephp-2-0/ http://liamgraham.wordpress.com/2007/04/19/using-oracle-with-cakephp-15-minute-blog-tutorial/ But I'm not sure that's the correct way. If it was so simple, they would have released the feature already for CakePHP 2.X...

want to remove action name from url CakePHP

荒凉一梦 提交于 2019-11-28 12:23:21
问题 i am working on a Cakephp 2.x.. i want to remove the action or controller name from url ... for example i am facing a problem is like that i have a function name index on my Messages controller in which all the mobile numbers are displaying the url is www.myweb.com/Messages now in my controller there is a second function whose name is messages in which i am getting the messages against the mobile number so now my url becomes after clicking the number is www.myweb.com/Messages/messages/823214

Using Md5 for password hash in Auth component of Cakephp 2.x

[亡魂溺海] 提交于 2019-11-28 09:51:29
问题 I have an existing website, built using CakePhp 1.3. In that website I have used MD5 algorithm for the password hash. Now I want to upgrade my CakePhp version to 2.3.5, but I'm unable to use MD5 for the password hash. I would like to know why I can't use MD5 in CakePhp 2.x. ? 回答1: Don't use md5 for passwords md5 is not an appropriate hashing algorithm for hashing passwords, don't use it. There are many, many references which explain why - including the php manual: Why are common hashing

Defining global conditions in Model

余生长醉 提交于 2019-11-28 04:44:57
问题 Is it possible to define global conditions for Model ? I have 2 Models: User and Student . In database both of them are using table users but each student has set parent_id to its owner (which is set in the same table) while each user has parent_id set to Null . When I use for example $this->find('all'); in Student Model I want to force Cake to return only those records from database table users where parent_id != Null . So the question is - can I define somehow global conditions in the Model

SplFileInfo::openFile(/app/tmp/cache/persistent/cake_core_cake_console_):failed to open stream:Permission denied in /lib/…/FileEngine.php line 293

自古美人都是妖i 提交于 2019-11-27 11:39:19
问题 I am working on a CakePHP 2 project. It originally started out in 2.0.x and then recently migrated to 2.1.0. Throughout the whole development process, I have been receiving the error message below. It pops up at the top of the page unpredictably. It can be when I am just viewing different pages, or even after I add a record to the database (yet the record properly saves). Warning: SplFileInfo::openFile(/var/www/cake_prj/app/tmp/cache/persistent/cake_core_cake_console_): failed to open stream: