cakephp

CakePHP: upgrade from 3.6.x to 4.0 “Missing Template Exception”

天涯浪子 提交于 2021-02-19 07:55:30
问题 I followed the upgrade guide (after I upgraded from 3.6 to 3.8 ) but I get this error: Error: [Cake\View\Exception\MissingTemplateException] Template file "Error\error500.ctp" is missing .... If you want to customize this error message, create src\Template\Error\fatal_error.ctp After the upgrade procedure my templates moved to app_name\templates directory and renamed to *.php instead of *.ctp . I updated the app.php and app.default.php with the new paths: 'App' => [ 'namespace' => 'App',

space between the radio button and label Cakephp

ε祈祈猫儿з 提交于 2021-02-19 07:51:13
问题 i am newbie in Cakephp trying to create a space between radio box and a label <span class="label"><b>Gender</b></span> <?php $options=array('M'=>'Male'."<br>" , 'F'=>'Female'); $attributes=array('legend'=>false,'label'=>'gender_male.','class'=>'radio'); echo $this->Form->radio('gender',$options,$attributes);?> </div> i have created a radio box in Cakephp but there is no space between the box and label is coming ... how can i create a space . 回答1: Try it <span class="label"><b>Gender</b></span

Cakephp: how to pass values into a javascript file?

天大地大妈咪最大 提交于 2021-02-19 04:19:17
问题 I have some javascript that is being included in a view and I used inkedmn's method in this thread: adding-page-specific-javascript-to-each-view-in-cakephp So I now have the following code in my view: $this->set('jsIncludes',array('google')); // this will link to /js/google.js But I need to pass some values from the view into the javascript file and I'm unsure of how to accomplish this. Update: I guess one option would be to echo the values in the php file, enclose in a div tag, and then use

How do you use COUNT(*) with find('list') in CakePHP 3?

前提是你 提交于 2021-02-18 11:58:51
问题 In CakePHP 3, I had a model called Articles and a field called 'subject', and I ran into a roadblock trying to retrieve a list of the 100 most commonly-used article subjects. The following code's resulting SQL selected all of the possible fields and not COUNT(*) : $articles->find('list', [ 'keyField' => 'subject', 'valueField' => 'COUNT(*)' ]) ->group('subject') ->order(['COUNT(*)' => 'DESC']) ->limit(100) ->toArray(); Then I remembered "CakePHP’s ORM offers abstraction for some commonly used

Can't use requestAction from Shell in Cakephp 2.5

可紊 提交于 2021-02-11 07:59:10
问题 As stated, when I use in a shell : $this->requestAction('/sites/zaz/option1'); The action doesn't get triggered. To test this, I tried : public function zaz($option1 = null) { CakeLog::write('acces', 'action triggered'); return 'got it !'; } And the action isn't done and there is no log written whatsoever. All my other logs do work. So I tried : $this->requestAction('/sites/actionwhichdoesntexist/option1'); And I got an error stating that the action doesn't exist. I really need to use

Can't use requestAction from Shell in Cakephp 2.5

≯℡__Kan透↙ 提交于 2021-02-11 07:58:11
问题 As stated, when I use in a shell : $this->requestAction('/sites/zaz/option1'); The action doesn't get triggered. To test this, I tried : public function zaz($option1 = null) { CakeLog::write('acces', 'action triggered'); return 'got it !'; } And the action isn't done and there is no log written whatsoever. All my other logs do work. So I tried : $this->requestAction('/sites/actionwhichdoesntexist/option1'); And I got an error stating that the action doesn't exist. I really need to use

Please anyone tell me how i solve this problem.please help someone

牧云@^-^@ 提交于 2021-02-11 04:31:47
问题 Notice (8): Use of undefined constant ankitgir_deshbhakt - assumed 'ankitgir_deshbhakt' [CORE/Cake/Model/ConnectionManager.php, line 69] Code Context include_once APP . 'Config' . DS . 'database.php'; if (class_exists('DATABASE_CONFIG')) { static::$config = new DATABASE_CONFIG(); ``` ConnectionManager::_init() - CORE/Cake/Model/ConnectionManager.php, line 69 ConnectionManager::getDataSource() - CORE/Cake/Model/ConnectionManager.php, line 83 Model::setDataSource() - CORE/Cake/Model/Model.php,

cakePHP 3.0 Action PagesController::myaction.json() could not be found, or is not accessible."

杀马特。学长 韩版系。学妹 提交于 2021-02-10 19:01:37
问题 I am migrating an existing 2.5 app over to 3.0. I am getting an 404 error when using ajax. This works fine in cakePHP 2.5 url: "/cakephp3/pages/myaction.json" I don't see any step that I might have missed. I am sure it is a routing issue with the .json extension routes.php Router::scope('/', function ($routes) { Router::extensions(['json', 'xml']); $routes->connect('/', ['controller' => 'Pages', 'action' => 'home']); $routes->connect('/hotel-training-courses', ['controller' => 'pages',

cakePHP 3.0 Action PagesController::myaction.json() could not be found, or is not accessible."

家住魔仙堡 提交于 2021-02-10 19:00:43
问题 I am migrating an existing 2.5 app over to 3.0. I am getting an 404 error when using ajax. This works fine in cakePHP 2.5 url: "/cakephp3/pages/myaction.json" I don't see any step that I might have missed. I am sure it is a routing issue with the .json extension routes.php Router::scope('/', function ($routes) { Router::extensions(['json', 'xml']); $routes->connect('/', ['controller' => 'Pages', 'action' => 'home']); $routes->connect('/hotel-training-courses', ['controller' => 'pages',

CakePHP Authentication Plugin Identity Associations

感情迁移 提交于 2021-02-10 14:20:32
问题 I'm using CakePHP 3.8 and migrating to the Authentication Plugin (https://book.cakephp.org/authentication/1.1/en/index.html). When calling $this->Authentication->getIdentity()->getOriginalData() in a controller, I'd like to access a couple of assocations of my User entity. At the moment, I'm doing this by implementing the following IdentityInterface method in my User entity: public function getOriginalData() { $table = TableRegistry::getTableLocator()->get($this->getSource()); $table-