cakephp-2.0

CakePHP unable to write to certain files

白昼怎懂夜的黑 提交于 2019-12-08 15:17:03
问题 I am starting to develop a website using CakePHP for my framework, I've literally just started and have already encountered errors, I can't work about what they mean. Warning: _cake_core_ cache was unable to write 'cake_dev_en-us' to File cache in /Applications/XAMPP/xamppfiles/htdocs/evolvidsnew/lib/Cake/Cache/Cache.php on line 310 Warning: _cake_core_ cache was unable to write 'cake_dev_en-us' to File cache in /Applications/XAMPP/xamppfiles/htdocs/evolvidsnew/lib/Cake/Cache/Cache.php on

Friendships in CakePHP 2.x

人走茶凉 提交于 2019-12-08 14:23:50
问题 I'm having trouble setting up friendships with CakePHP 2. I have two database tables: users and friends . My users table has the following columns: id email password And my friends table has the following columns: id user_id friend_id approved I have friends set up as a hasAndBelongsToMany relationship in my Users model: <?php class User extends AppModel { public $hasAndBelongsToMany = array( 'Friends' => array( 'className' => 'User', 'joinTable' => 'friends', 'foreignKey' => 'user_id',

Want to create a custom function

不羁的心 提交于 2019-12-08 10:40:23
问题 I am working on a CakePHP 2.x .. I want to create a special class in which I want to create functions so that I can call functions from other controllers. For example this function function replace_dashes($string) { $string = str_replace("-", " ", $string); return $string; } So whenever I want to use that function in some other controller I can call this or can pass parameters too ... I want to implement all the raw functions like this in some class. How can I do this in CakePHP? 回答1: Its not

CakePHP 3.0 Flash Message

匆匆过客 提交于 2019-12-08 10:21:34
问题 In CakePHP 2.0, I can check if there a flash message by using if($session->check('Message.flash')){...} I understand that in CakePHP 3.0, I read the doc that I can check if there a flash message by using Layout echo $this->Flash->render('auth'); Template/Users/login echo $this->Flash->render(); if($this->request->is('flash')){...}else{...} But in my view is when I added the above condition is not showing anything. My controller code is below $this->Flash->error('The email address and/or

CakePHP Unit Test Not Returning Content or View

半世苍凉 提交于 2019-12-08 09:38:43
问题 I'm working on implementing test cases for our project to be included in our build script. This CakePHP 2.4 application is largely REST based and has been set to parse json extensions in its routes.php file. Here is an example of a typical function in our application: public function index() { $this->paginate = array( 'fields' => array('User.username', 'User.first_name', 'User.last_name', 'UserGroup.name','Location.name','User.id'), 'conditions' => array( 'active'=>1 ), 'link' => array(

Paginator (Migration from Cake 1.3 to 2.0)

时光怂恿深爱的人放手 提交于 2019-12-08 09:37:38
问题 I am struggling with the paginator in Cakephp 2.0. While I am trying to migrate my application to 2.0 I cant find any solution to jump directly to the last page. In 1.3 it was quiet to do that from outside like this: echo $this->Html->link(__('Flights'), array('controller' => 'flights', 'action' => 'index','page' => 'last')); but this little trick putting 'page:last' in does not work anymore in 2.0. Of course there is a Paginator function called last, but this would only help if I would be

CakePHP Auth loginRedirect error/always redirect to 'users/login' whereas i put different controller

梦想与她 提交于 2019-12-08 09:23:56
问题 CakePHP Auth loginRedirect error/always redirect to 'users/login' whereas i put different controller. I mean, when i open the forbidden page(not allowed/require login) $this->Auth->allow('index', 'profile', 'view', 'register'); it must redirect to "players/index". I put the loginRedirect to "players", 'loginRedirect' => array('controller' => 'Players', 'action' => 'index'), but it doesn't work. It always redirect to "users/login" not "players/index" whereas i write "'loginRedirect' => array(

CakePHP: How to deploy DB schema changes to production without errors

夙愿已清 提交于 2019-12-08 08:30:21
问题 We're running CakePHP v2.3 We just had a weird incident during a push to production where we threw the following errors immediately after pulling the changes and we were not able to load any pages. The column ( User.group_id ) had just been dropped by us. We then deleted the caches (persistent and models) thinking that would prevent errors resulting from the changed schema. Instead, the caches were not recreated and it generated the following error and we were not able to load any pages...

Password Hashing for SSO between Wordpress and CakePHP

旧巷老猫 提交于 2019-12-08 07:53:26
问题 We have a Wordpress site which we are going to gradually rebuild using the cakePHP framework. We will replace different parts of the Wordpress site incrementally, so we need to implement some sort of single sign on to allow authorization across both frameworks during the time while both frameworks are running side by side. We have a pretty good strategy for how to do this. In short, we will duplicate all user rows in two different tables: one table for Wordpress ( wp_users ) and a different

Cakephp HasMany + SaveAll doesnt work

南笙酒味 提交于 2019-12-08 05:22:50
问题 Im trying to do a hasmany saveall() but it does not work. I have a Model Carmodel hasMany CarmodelsImage When i try to save, the array passed is: [CarmodelsImage] => Array ( [0] => Array ( [name] => teste [carmodel_id] => 1 ) ) In the controller i have $this->Carmodel->saveAll($this->request->data) but it does not work. I need some help. I know this question was already posted but I read every answers and it not work. Thanks 回答1: Your requested data needs to be an array like in the following