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.
Questions tagged [cakephp-4.x]
511 questions
1
vote
0 answers
Usage of FormProtection component in CakePHP 4.x
I created a simple application to find scrabble valid words in Cakephp 4.2. It has several forms with a single input in which the user can write a word (or randomly sorted letters) and the application generates all possible anagrams for that word, o…

Jesús Ortega
- 11
- 2
1
vote
1 answer
Cakephp 4 with Authoirzation plugin: Custom errror message when Authorization fails
everyone. I apologize if this has been asked before, but I’m having a hard time finding anything on this subject.
I have the Authorization plugin loaded in my application, and it works fine, except for the messages the user gets back when they’re…

Chris
- 535
- 3
- 20
1
vote
0 answers
Check if same user is logged in from another device ( web or mobile)
I am using CakePhp4 and Authentication Plugin. I have no clue for both.
What I want to achieve When a user logs in, determine if that user is already logged in using another device then either prompt the user or logout the user What I tried?…

Chirag Arora
- 357
- 3
- 13
1
vote
0 answers
Cakephp upgrading from 3.6.16 to 4.2 rector command not working bin/cake upgrade rector --rules phpunit80 C:\Apache24\htdocs\Techno\tests
I am upgrading the existing Cakephp-3.6.16 to Cakephp-4.2and when firing the below step-4 Rector command it return the PHP Fatal error.
I followed the below steps for the upgrade
1 Install the upgrade tool
git clone…

user15101991
- 21
- 2
1
vote
1 answer
how can i set email by a variable in cakehphp app_local
In app_local how can i set username and password with variables in cakephp 4 ? I want to get the values from a table.
Or if i cant use a variable to set the email then is there another way?
'EmailTransport' => [
'default' => [
…

atown99
- 109
- 12
1
vote
2 answers
cakephp4 authentication login not working
I am testing the cakephp 4 login authentication. I copied all the code from the cakephp4 tutorial authentication (see below for link) and copied all code to my project as required and no errors were found.
i can create new logins but i cant…

atown99
- 109
- 12
1
vote
1 answer
Remember me cookie cakephp 4 not working correctly after logout
I’m working with CakePHP 4.
Following the documentation, I set up ‘remember me’ cookie, when I pass login, I see in the browser the CookieAuth controller with correct values for username e password.
Point is that when I logout, I still see the…

Ethan
- 45
- 10
1
vote
1 answer
MissingRouteException in test of Table Object
I have a TableObject that sends an email in the afterSave-Event to notify the admin of a change. After the switch from cakephp-3 to cakephp-4 the test for this fails with this error message:
Cake\Routing\Exception\MissingRouteException: A route…

David Albrecht
- 634
- 1
- 4
- 15
1
vote
1 answer
Using OR in the query builder with eager loading
CakePHP Version: 4.1.4
Introduction
I'm trying to use the query builder to build complex where clauses and use eager loading.
SQL
I'm using 10.4.14-MariaDB as the database server and PHP version 7.4.10 in an xampp environment. The following query…

Zenzs
- 138
- 13
1
vote
1 answer
About the implementation of Remember Me using AuthenticationPlugin's Cookie Authenticator
I use CakePHP's AuthenticationPlugin. I was trying to implement RememberMe functionality into this.
I found the following article when I was reading the Cakephp documentation.
Cookie Authenticator aka “Remember Me”
However, the documentation here is…

IjIj
- 17
- 5
1
vote
1 answer
Cake\Routing\Router not found in shell after migration to cakephp-4
After updating my app from 3.9 to 4.1.4 shell scripts stopped working. Typing this bin/cake plugin assets symlink yields this error message:
PHP Fatal error: Uncaught Error: Class 'Cake\Routing\Router' not found in…

David Albrecht
- 634
- 1
- 4
- 15
1
vote
1 answer
How to register afterMarshal in CakePHP 4.1
I noticed that there is new afterMarshal event in 4.1.
Where to put it? In Table model? And how?
I want to do some work with results every time it's loaded.
Thanks for help

M.U.
- 35
- 4
1
vote
1 answer
CakePHP 4 sub view or sub action routing
In cakePHP 4
I have a controller and view.php connected with it.
I can use a route like this: sitename.com/projects/45, where 45 - is sample project ID.
Using this url I can reach a page with the content of particular project. But If I want to…

John O Johnson
- 13
- 2
1
vote
1 answer
What do I do when I want to separate models with authentication plugins?
I'm currently implementing the login feature in CakePHP4.
So I wanted to divide it into a normal user model and an administrative user model.
I didn't know how to do this at all, and I spent all day looking for ways to implement it, but I couldn't…

IjIj
- 23
- 4
1
vote
1 answer
CakePHP select no longer executes after upgrade to 4.1
A query that has been running for years in CakePHP 3.X no longer executes after upgrading to CakePHP 4.1. The $order array contains correct values and the SQL query looks good and identical to the CakePHP 3.X version. All other queries in the…

Andre Hartman
- 11
- 1