Questions tagged [cakephp-4.x]

Questions about 4.x branch of the CakePHP MVC framework. Use this tag in combination with the general [cakephp] tag. If your question applies to CakePHP more generally, use only the [cakephp] tag.

511 questions
0
votes
0 answers

Problem in using admad/cakephp-jwt-auth and CRUD on CakePHP 4

I tried to implement this tutorial using CakePHP 4 and found something strange. When Verifying JWT Auth on step 5, we need to override the CRUD's function on each Controller for it to work, meaning it will throw a 401 unauthorized asking for…
Tinkr
  • 1
0
votes
0 answers

Line break using collection in cakephp 4

I'm using collections to generate a menu of categories. The idea is to have this structure:
0
votes
1 answer

union request and pagination in cakephp4

I made two requests. The first one gives me 2419 results and I store the result in $requestFirst. The second, 1 result and I store the result in $requestTwo. I make a union : $requestTot = $requestFirst->union($requestTwo); The total of the…
tyler
  • 13
  • 6
0
votes
0 answers

CSRF token from either the request body or request headers did not match or is missing - cake php 4

i have used ajax for search functionality, whenever i am trying to pass data i am getting this issue. I am new here. Any help is very much appreciated. Thanks in Advance I have tried changing csrf token in Application.php file but the same issue is…
0
votes
0 answers

Problem with overriding a plugin element when an Admin prefix is used in Cakephp 4

My App is both using prefix Admin and having a plugin RubriquesManager. In the plugin RubriquesManager I have 2 elements articles for each side (front side and admin side) : /plugins/RubriquesManager/templates/element/articles.php displays articles…
Oliv
  • 236
  • 3
  • 12
0
votes
0 answers

Problem when declaring an association inside a plugin in Cakephp 4

I'm creating a plugin RubriquesManager in which there are the 2 associated Tables Rubriques and Blocs. Rubriques hasmany Blocs Blocs belongsTo Rubriques When Rubriques and Blocs were not in the RubriquesManager all worked well but now there are, I…
Oliv
  • 236
  • 3
  • 12
0
votes
0 answers

Dynamic associations in Model

i have a question which aims more on an general understanding, then a technical problem. i have a table named people which associates to another table named properties. This "Properties" table has a hasOne association with a table named…
0
votes
0 answers

CakePHP 4 Error running PHPUnit with Fixture: UnxepectedValueException; Could not find fixture

Running a PHPUnit controller test in Visual Studio Code terminal receives error in testIndex: UnexpectedValueException: Could not find fixture…
0
votes
0 answers

Authentication with basic type api

After a good amount of time, I found the solution through an authentication plugin that is easy to install via composer with the command: composer require "cakephp/authentication:^2.0" After that, just generate the crud via terminal and check them…
0
votes
1 answer

Redirect only working on some controller actions

A redirect, called by the private function r(), in the edit function works, but not in the delete. Even commenting out the allowMethod doesn't help. Any ideas why that would be? /** * Edit method * * @param string|null $id Task id. *…
TechFanDan
  • 3,329
  • 6
  • 46
  • 89
0
votes
0 answers

Cakephp Cookies for internalization

I'm trying to save the runtime language an offer users the option of switch it. I have this in my default.php:
Iria
  • 9
  • 4
0
votes
1 answer

Cakephp 4 can't change locales

I'm trying to set two buttons so depending of the language user can switch to the other. In my default.php I have this, to change on click on the link AppController:
0
votes
1 answer

Check if event is coming from a model inside a plugin?

I need all models inside a custom CakePHP plugin to use a database prefix. I'm trying to use an event, as suggested by @lorenzo. EventManager::instance()->on('Model.initialize', function ($event) { $instance = $event->subject(); …
ᴍᴇʜᴏᴠ
  • 4,804
  • 4
  • 44
  • 57
0
votes
1 answer

Cakephp 4 input control statment: $this->Form->control

in cakephp 4 there is a statement/method like $this->Form->control('address_id',['options' => $addresstypes...].... which mainly works fine. I my case I would like to change the label of an select box to an external link. Now safe, but in this case…
0
votes
1 answer

How to send image via form with cakephp 4 to backend via REST API?

I'm trying to send an image to a registration service made in Node.js. I have a form made like this: Form->create($product, ['enctype' => 'multipart/form-data']); ?>
E. Biagi
  • 452
  • 3
  • 12