cakephp

cakephp error. Connection to database …not …: Access denied for user 'my_app'@'localhost' (using password: YES)

旧街凉风 提交于 2020-02-02 07:01:47
问题 I am trying to start CakePHP. I made bookmarker and tested by command bin\cake server . It showed one error as connection to database could not be established: SQLSTATE[HY000] [1045] Access denied for user 'my_app'@'localhost' (using password: YES). I read the config/app.default.php file. It says there is a database my_app and another database test_myapp with some users. I can not find these databases in phymyadmin in xampp. Am I supposed to create the named databases and users manually? I

Add a subdomain to all urls in Cakephp

落爺英雄遲暮 提交于 2020-01-31 19:43:29
问题 I want all Cakephp urls to use a subdomain if it is present in the users session... so if there is an entry 'subdomain:user' in the session of the user all pages will have 'user' as a prefix: Eg user.example.com, user.example.com/settings. Is there an easy way to do this? thanks, kSeudo 回答1: There are custom route classes you could use. Create a file in APP/Lib/Route called UserSubdomainRoute.php and put this in it. <?php App::uses('AuthComponent', 'Controller/Component'); class

Add a subdomain to all urls in Cakephp

穿精又带淫゛_ 提交于 2020-01-31 19:42:33
问题 I want all Cakephp urls to use a subdomain if it is present in the users session... so if there is an entry 'subdomain:user' in the session of the user all pages will have 'user' as a prefix: Eg user.example.com, user.example.com/settings. Is there an easy way to do this? thanks, kSeudo 回答1: There are custom route classes you could use. Create a file in APP/Lib/Route called UserSubdomainRoute.php and put this in it. <?php App::uses('AuthComponent', 'Controller/Component'); class

cakePHP auth component not working

本小妞迷上赌 提交于 2020-01-25 21:52:00
问题 I have an issue with cake's auth that I simply can't seem to get past (i've been debugging and trying different tutorials for the last two days). As far as I can see it should be very simple, the problem is whenever i try to login, it just refreshes the login page. I cannot for the life of me figure out why! My only conclusion is that there must be something (basic) which tutorials take for granted that I have missed. Here are a couple of snippets: users_controller.php class UsersController

Add custom class to CakePHP automagic date select

£可爱£侵袭症+ 提交于 2020-01-25 20:22:32
问题 I would like to add a class to all selects of an automagic created datepicker formgroup. <?= $this->Form->input('hide', ['class'=>'classtoadd' ]); ?> The result ist: <div class="input date"> <label>Hide</label> <select name="hide[year]"> <option value="" selected="selected"></option> <option value="2020">2020</option> ... </select> <select name="hide[month]"> <option value="" selected="selected"></option> <option value="01">Januar</option> ... </select> <select name="hide[day]"> <option value

Add custom class to CakePHP automagic date select

拈花ヽ惹草 提交于 2020-01-25 20:22:24
问题 I would like to add a class to all selects of an automagic created datepicker formgroup. <?= $this->Form->input('hide', ['class'=>'classtoadd' ]); ?> The result ist: <div class="input date"> <label>Hide</label> <select name="hide[year]"> <option value="" selected="selected"></option> <option value="2020">2020</option> ... </select> <select name="hide[month]"> <option value="" selected="selected"></option> <option value="01">Januar</option> ... </select> <select name="hide[day]"> <option value

cakePHP - How to solve a 'Trying to get property of non-object' error

心不动则不痛 提交于 2020-01-25 20:17:18
问题 hello i received this error message when i run my application on the server : Notice (8): Trying to get property of non-object [APP/Template/ApplicantEducationNeeds/view.ctp, line 52] and this is the lines of code in view.ctp : <?php use Cake\Cache\Cache; use Cake\Core\Configure; use Cake\Datasource\ConnectionManager; use Cake\Error\Debugger; use Cake\Network\Exception\NotFoundException; $this->layout = 'userProfile'; if (!Configure::read('debug')): throw new NotFoundException(); endif; /

Getting Wrong result when using CakePHP Query

孤人 提交于 2020-01-25 16:28:29
问题 I am trying to fetch Product where Low stock > Stock. Why i am getting Wrong results in CakePHP Query ? Using CakePHP Custom query it is working fine. but with default pagination query result are wrong. I have association between Product and Category Model. Controller code : $condition = array('Product.status =' => 1, 'Product.is_deleted !=' => 1, 'Product.low_stock_alert != ' => 0, 'Product.low_stock_alert >' => 'Product.stock'); $this->paginate = array('fields' => array('Product.id',

CakePHP 2.1 Authentication: AclExtras does not populate acos table

為{幸葍}努か 提交于 2020-01-25 11:10:42
问题 I have followed this tutorial to build an ACL/ACO controlled app: http://book.cakephp.org/2.0/en/tutorials-and-examples/simple-acl-controlled-application/simple-acl-controlled-application.html I have downloaded the AclExtras plugin, put it into my app/Plugins folder, and executed the command ./Console/cake AclExtras.AclExtras aco_update , as described in the tutorial, which gives me Aco Update Complete . But when I look into my acos table, the only thing it has done is add the following row,

cakephp save array

纵饮孤独 提交于 2020-01-25 10:19:08
问题 what would be the efficient way of saving the following array using php (cakephp)? each value needs to go into a new row in the table? Array ( [0] => 6786754654 [1] => 5643564545 [2] => 344544545 [3] => 233245654654 [4] => 453454654654 [5] => 6546542323 [6] => 654654654 [7] => 645654654 etc.... ) thanks 回答1: 2 choices: Format the array as required by Model::saveAll() Loop through the array calling Model::create(), then Model:save() I'd recommend option 1 as you can use Model::saveAll($data,