cakephp-3.0

Cakephp 3.0 change or remove wrapping div on input form

假装没事ソ 提交于 2019-12-03 11:55:32
问题 I am trying to remove or change the wrapping div that CakePHP uses on its form helper. When I use this code: echo $this->Form->input('contact', ['label' => false]); The output is: <div class="input text"> <input type="text" id="contact" maxlength="255" name="contact"> </div> And what I want is: <div class="myOwnClass"> <input type="text" id="contact" maxlength="255" name="contact"> </div> I used to do that on CakePHP 2 adding more options to the input method, however on the latest CakePHP

Cakephp 3.x: SQLSTATE[HY000]: General error: 11 database disk image is malformed

孤街醉人 提交于 2019-12-03 06:38:54
I'm getting this error when I upload my application to linux. This is working fine on my local windows system but gives me error on linux server. When I search regarding this then I found this is sqLite related issue. If this is sqLite issue then how can I change this to MySQL. Please help me. Delete the /tmp/debug_kit.sqlite Delete the tmp folder Delete the /tmp/* if you are getting further permission issue the set 777 permission to cakephp folder chmod -R 777 bookmarker Delete the /tmp/* directory. Hope it should be solved. I just had the samme issue on my machine with OSX 10.11 w/ MAMP

Where to place a custom PHP class in CakePHP 3?

时光总嘲笑我的痴心妄想 提交于 2019-12-03 06:29:53
I have a new PHP class which I would like to call from a Controller. Where, in the CakePHP folder structure, should I place this new class and what is the procedure to invoke or make use of it from a controller? Thanks in advance for your cooperation! monsur.hoq From my point of view, you can reuse any own class and also any third parties class as a utility class. If so, then you can place the class into src/Utility folder. Please use the proper namespace. After that, you can use that class anywhere in CakPHP 3.x. HOW TO PLACE: Say, you have a class named Jorge , save it into src/Utility

Setting up CakePHP 3 Plugin testing

我是研究僧i 提交于 2019-12-03 03:41:06
I've used bin/cake bake plugin PluginName to create a plugin. Part of it is that it creates phpunit.xml.dist , but bake doesn't create the folder structure or tests/bootstrap.php file that's required. The Problem I get a "No tests executed" message when I run phpunit : $ phpunit PHPUnit 5.1.3 by Sebastian Bergmann and contributors. Time: 239 ms, Memory: 4.50Mb No tests executed! Background information I've created my tests in my plugin folder under tests/TestCase . I don't think they are the issue, but I'll post them at the end. I'm using the default phpunit.xml.dist file, and I'm using this

How to read and write Session in Cakephp 3.0

ぐ巨炮叔叔 提交于 2019-12-03 03:08:59
I am new to cake 3.0. I have read documentation on http://book.cakephp.org/3.0/en/development/sessions.html But I am not able to write sessions. use Cake\Network\Session\DatabaseSession; $session->write('Config.language', 'eng'); $session->read('Config.language'); You need to set $session : $session = $this->request->session(); $session->write('Config.language', 'eng'); $session->read('Config.language'); And then you'll be able to read and write in your session Or you can direclty read and write : $this->request->session()->write('Config.language', 'eng'); $this->request->session()->read(

Cakephp 3.0 change or remove wrapping div on input form

。_饼干妹妹 提交于 2019-12-03 02:22:33
I am trying to remove or change the wrapping div that CakePHP uses on its form helper. When I use this code: echo $this->Form->input('contact', ['label' => false]); The output is: <div class="input text"> <input type="text" id="contact" maxlength="255" name="contact"> </div> And what I want is: <div class="myOwnClass"> <input type="text" id="contact" maxlength="255" name="contact"> </div> I used to do that on CakePHP 2 adding more options to the input method, however on the latest CakePHP version this isn't working. Any clues? Thanks Use FormHelper Templates To change wrapping for all inputs

SQLSTATE HY000 2002 while running bake command

爱⌒轻易说出口 提交于 2019-12-02 19:44:20
I have problem running the bake commands. i think it is related to mysql but i didn't find any solution to this error on Stackoverflow. This is my app.php : 'Datasources' => [ 'default' => [ 'className' => 'Cake\Database\Connection', 'driver' => 'Cake\Database\Driver\Mysql', 'persistent' => false, 'host' => 'localhost', //'port' => 'nonstandard_port_number', 'username' => 'root', 'password' => 'root', 'database' => 'laboiterose', 'encoding' => 'utf8', 'timezone' => 'UTC', 'cacheMetadata' => true, Please help, the error i get, is: Exception: SQLSTATE[HY000] [2002] No such file or directory in [

find(list) returns several blank options, find(all) returns correct data but formatted with {

时光毁灭记忆、已成空白 提交于 2019-12-02 18:48:25
问题 AvadiariesTable.php $this->belongsTo('AlumnesGrups', [ 'foreignKey' => 'alumnes_grup_id', 'joinType' => 'INNER' AlumnesGrupsTable.php $this->belongsTo('Alumnes', [ 'foreignKey' => 'alumne_id', 'joinType' => 'INNER' ]); $this->belongsTo('Grups', [ 'foreignKey' => 'grup_id', 'joinType' => 'INNER' ]); Why is this in AvadiariesController.php: public function add() { $avadiary = $this->Avadiaries->newEntity(); if ($this->request->is('post')) { $avadiary = $this->Avadiaries->patchEntity($avadiary,

cakePHP 3 Query ifnull

让人想犯罪 __ 提交于 2019-12-02 13:25:01
问题 I wonder what would be the best way to prevent null results in a ResultSet. I'm on cake 3.5.13 and I'm using cases, like: private function addCase($isforeign, $source) { $query = $this->Sales->find(); return $query->newExpr() ->addCase( $query->newExpr()->add([ 'Sales.isforeign' => $isforeign, 'Sales.source' => $source ]), 1, 'integer'); } I then put the return of my addCase function in (..) 'sourcenationalcount' => $query->func()->sum($this->addCase(0, 1)), (..) Now it is possible that

Dependent Dropdown box CakePHP 3

送分小仙女□ 提交于 2019-12-02 13:23:07
I have created a countries, cities and customers table and i'm trying to ensure that when I add a new customer from a drop down I can select a country and then a city related to that country. Currently I am able t select any city and country combination from the drop down. This is my database CREATE TABLE IF NOT EXISTS `southpac_team`.`customers` ( `id` INT NOT NULL, `name` VARCHAR(100) NULL, `country_id` INT NULL, `city_id` INT NULL, `address` VARCHAR(255) NULL, `postal_address` VARCHAR(255) NULL, `phone` VARCHAR(45) NULL, `email` VARCHAR(100) NULL, `payment_terms_id` INT NULL, `stop_credit`