cakephp-3.0

cakephp 3 parameter url

妖精的绣舞 提交于 2019-12-12 02:53:56
问题 I would like to know how is possible that if someone write a not existent link returns error in cakephp 3. Example: I have an action called test inside controller calle first. Into my routing file I have declared language in this way inside scope : $lang = 'it|en'; $routes->connect('/', ['language' => 'it', 'controller' => 'Pages', 'action' => 'index', 'index'], ['language' => $lang]); $routes->connect( '/:language/:controller', ['action' => 'index'], ['language' => $lang] ); $routes->connect

php client send binary data to CakePHP

喜欢而已 提交于 2019-12-12 02:26:44
问题 I've googled alot for this but unfortunately I found nothing close to what I'm looking for. My idea is to have a plain PHP standalone client to send an Excel 2003 file (binary) to a controller of my CakePHP project. This is what i need to figure out how it is theoretically working. Any helpful idea would be greatly appreciated. Kind regards, Marius 来源: https://stackoverflow.com/questions/43346558/php-client-send-binary-data-to-cakephp

500 internal server error occured in CakePHP 3?

和自甴很熟 提交于 2019-12-12 02:12:37
问题 My first .htaccess file in root folder: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] </IfModule> My second .htaccess file in webroot folder: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] </IfModule> My third .htaccess file in src folder: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ webroot/ [L] RewriteRule

Cakephp 3 bin/cake bake - Undefined variable: argv

被刻印的时光 ゝ 提交于 2019-12-12 01:46:39
问题 I've used Cakephp 2.x in earlier times and now I want to get in touch with the new Version 3.0.0 I installed Cakephp over composer, all worked fine. I've changed the Salt and configured database settings. When trying to run bin/cake I'm getting the following error: Welcome to CakePHP v3.0.0 Console --------------------------------------------------------------- App : src Path: /html/APP/myapp/src/ --------------------------------------------------------------- Current Paths: * app: src * root

How to rollback cakePHP 3.2 to 3.0

一世执手 提交于 2019-12-12 01:37:42
问题 I did my project in cakePHP 3.0. By updating the composer my project converted into cakePHP 3.2. I want to rollback from 3.2 to 3.0. I tried rollback options too,that is also not working. How to rollback 3.2 to 3.0 ? 回答1: The rollback command supporty by composer is for the composer itself, ie it rolls back your composer installation to an earlier version, not anything that might have been installed via composer. To change the version of the cakephp/cakephp dependency, simply require the new

remove fields from select generated by matching

冷暖自知 提交于 2019-12-12 00:05:54
问题 I have two custom find methods and I would like to make an union of them. public function findInGroup(Query $query, array $options) { return $query ->matching( 'Groups', function ($q) { return $q->where(['Groups.id' => 1]); } ); } public function findAsUser(Query $query, array $options) { return $query ->matching( 'Users', function ($q) { return $q->where(['Users.id' => 1]); } ); } The two methods generates different select list, because of the matching call. So I can not make union of them..

Translate SQL query to CakePHP 3.0

老子叫甜甜 提交于 2019-12-11 21:24:46
问题 The query is as follows select T.username, sum(T.size) as totSize, count(*) total, count(case when T.type = 'facebook' then 1 else null end) as facebook, count(case when T.type = 'instagram' then 1 else null end) as instagram, count(case when T.type = 'device' then 1 else null end) as device from (SELECT users.username, pictures.size, pictures.type from users left join pictures on pictures.user_id = users.id) as T group by T.username Associated to each 'user' there are several 'picture'.

CakePhp 3 : server php not found

不羁岁月 提交于 2019-12-11 21:17:10
问题 i'm trying cakephp v3 for a test, so i have install cake with composer, and i can't launch the server as requested by the tutorial. When i do bin/cake server in the app folder, i get this response: bin/cake: line 39: exec: php not found I tried with ./bin/cake but it's the same. For information, i have wamp on my computer and the authorization for bin are rwxr-xr-x. Any idea on how fix it? Thanks for your help 回答1: You may need to add the PHP directory to your path. On the command line (e.g.

CakePHP Entity contain without foreign key

情到浓时终转凉″ 提交于 2019-12-11 20:32:36
问题 I have an entity Villa, and I want this Entity to contain other Villas which have the same 'complex' ( Varchar(255) ). class VillasTable extends Table { /** * Initialize method * * @param array $config The configuration for the Table. * @return void */ public function initialize(array $config) { $this->table('villas'); $this->displayField('name'); $this->primaryKey('id'); $this->hasMany('Complexs', [ 'className' => 'Villas', 'foreignKey' => false, 'propertyName' => 'complexs', 'conditions' =>

How to build rule exist in or equal to a number in cakephp 3?

瘦欲@ 提交于 2019-12-11 20:24:57
问题 I have table comments with column parent_id . And this is content of CommentsTable.php : namespace App\Model\Table; use App\Model\Entity\Comment; use Cake\ORM\Query; use Cake\ORM\RulesChecker; use Cake\ORM\Table; use Cake\Validation\Validator; /** * Comments Model */ class CommentsTable extends Table { /** * Initialize method * * @param array $config The configuration for the Table. * @return void */ public function initialize(array $config) { $this->table('comments'); $this->displayField('id