cakephp-3.0

Cakephp 3 redirect in beforeFilter of parent class

不羁岁月 提交于 2019-12-08 15:09:43
问题 In our CakePHP 3 application we found a different behaviour. We're sure that it worked well in CakePHP 2, so I suppose something changed in new version. When user visits this url: /b2controller/myMethod , these methods run: AppController::beforeFilter() BController::beforeFilter() B2Controller::beforeFilter() B2Controller::myMethod() B2Controller::myMethod2() then user is redirected to this url /ccontroller/myMethod10/ But we need this: When user visits /b2controller/myMethod and $isOk

CakePHP 3.0 install with composer is broken? [closed]

偶尔善良 提交于 2019-12-08 12:52:37
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I get this error when trying to pull localhost. error: Warning: require(C:\xampp\htdocs\sync\vendor\autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\sync\config\bootstrap.php on line 23 using composer to install from the cakephp site here: http://book.cakephp.org/3.0/en

different output for model name with capital letter in cakephp3

最后都变了- 提交于 2019-12-08 11:17:20
问题 I dont understand how I get a different output for lesson_date field if in the select I use Lessons.lesson_date' or lessons.lesson_date. I thought I am supposed to use Lessons and not lessons and that the for a single name it doesnt really matter. with Lessons.lesson_date I get on the debug : 'lesson_date' => object(Cake\I18n\FrozenDate) { 'time' => '2015-07-09T00:00:00+00:00', 'timezone' => 'UTC', 'fixedNowTime' => false }, with lessons.lesson_date I get a better output: 'lessons' => [ 'id'

I cant display fields from a table with an underscore in cakephp3

梦想与她 提交于 2019-12-08 11:14:56
问题 I am getting this error on a field that does exist. I cant display any field from the TutoringTypes table. My connection is wrong and i cant see where I made the mistake as I believe I followed the conventions. However the docs talk about plural table names but give singular variables names as an example? Column not found: 1054 Unknown column 'tutoring_types.value' in 'field list' $query3 = $this->Lessons->find() ->contain(['Tutors', 'TutoringTypes']) ->select(['lessons.id','lessons.lesson

Cakephp 3 saving to an different table

我的梦境 提交于 2019-12-08 11:14:56
问题 Hi dear Stackoverflowers, im new to CakePHP 3 and if got a Problem with saving into the Database. Im using CakePHP 3. I want to save the Data of a survey into a SQL-DatabaseTable other than the one of the Controller ("First" in this case). It works so far but i can only save data for one time. After that it shows: "Your Feedback could not be saved. Please, try again.". If I delete the data in the sql table, it works again, but i have to be able to save multiple times. I have created a model

CakePHP 3: Save Associated Model Fail

∥☆過路亽.° 提交于 2019-12-08 10:38:07
问题 I'm having difficulty using Cakephp 3 patchEntity to save associated models. The models involved are summarized here My UsersTempTable public function initialize(array $config) { $this->table('users_temp'); $this->displayField('name'); $this->primaryKey('id'); $this->addBehavior('Timestamp'); $this->hasOne( 'UsersExtraTemp', [ 'foreignKey' => 'user_id' ]); } Then my UsersExtraTempTable public function initialize(array $config) { $this->table('users_extra_temp'); $this->displayField('id');

Linking tables together between two models in Cakephp

余生长醉 提交于 2019-12-08 10:30:19
问题 I want to get this result: Click Me (get a link to go to the other associate table) I'm following the official tutorial of cakephp to linking tables together but but it's not working. My database is like this: Table ciudades: | id (int 4) PK | nombreCiudad (varchar 60)| Table complejos: | idComplejo (int 11) PK | nombre (varchar 25)| ciudad_id (int 4) FK | The complete ciudad column in my complejo table is empty when I want to show the name of the another asociation model (ciudad nombreCiudad

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

Deleting Records From Associated Table With PatchEntity in CakePHP

感情迁移 提交于 2019-12-08 07:02:31
问题 I have a CakePHP model where a Job hasmany Employees and an Employee belongsTo a Job. The View I use to edit both Jobs and Employees is a Job view. Here is code from my Job Controller: $job = $this->Jobs->get($id, [ 'contain' => ['Employees'] ]); if ($this->request->is(['patch', 'post', 'put'])) { $req = $this->request->data; $job = $this->Jobs->patchEntity($job, $req, [ 'validate' => false, 'associated' => ['Employees'] ]); $saveResult = $this->Jobs->save($job, [ 'validate' => false,

cakephp 3 paginator doesn't work

倖福魔咒の 提交于 2019-12-08 06:45:37
问题 I'm curently using this query with Cakephp 3 for a little search engine $query_tweet = $this->Tweet ->find() ->select([ 'Users.username', 'Users.avatarprofil', 'Tweet.contenu_tweet', 'Tweet.created', 'Tweet.nb_commentaire', 'Tweet.nb_partage', 'Tweet.nb_like', ]) ->where([ "MATCH(Tweet.contenu_tweet) AGAINST(:search)" ]) ->where(['private' => 0]) // on ne cherche que les tweets publics ->bind(':search', '$search') ->order(['Tweet.created' => 'DESC']) ->contain(['Users']); This query works