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
1 answer
CakePHP: upgrade from 3.6.x to 4.0 "Missing Template Exception"
I followed the upgrade guide (after I upgraded from 3.6 to 3.8) but I get this error:
Error: [Cake\View\Exception\MissingTemplateException] Template file "Error\error500.ctp" is missing
....
If you want to customize this error message, create…

thelaw
- 385
- 5
- 12
1
vote
0 answers
CakePHP 4 - support for named parameters?
I looked at the CakePHP 4 docs and noticed, that the support for named parameters via Router::parseNamedParams is removed.
I have an application where I make heavy use of named parameters and any other way would definitely make everything much more…

boindil
- 95
- 1
- 9
1
vote
1 answer
Migrations in CakePHP 4 not working correctly?
I'm running a fresh install of CakePHP 4 and I'm trying to create an initial migration for the database. The migration itself is build correctly but the command fails to mark the migrations as done:
~/code$ bin/cake bake migration_snapshot…

wouter
- 247
- 2
- 6
1
vote
0 answers
CakePHP 4: Cake Bake error, file not found exception
I'm developing an CakePHP 4 app (with MySQL, and PHP 7.2) and when I bake, something go wrong and throw this:
MacBook-Pro-de-JP:ldb jp$ bin/cake bake all people Bake All
…

Juan Pablo Pola Demoro
- 153
- 1
- 3
- 16
1
vote
1 answer
$this->request->getData() empty after upgrade to CakePHP 4.0
After upgrading to CakepPHP 4.0 my POST request trough XMLHttpRequest stopped passing data to $this->request->getData()
The data is accesible by $this->request->input('json_decode'); though and GET requests work as well.
But I wonder what has…

danny3b
- 313
- 5
- 17
1
vote
2 answers
CakePHP 4.0 database configuration
'default' => [
'className' => Connection::class,
'driver' => Mysql::class,
'persistent' => false,
'username' => 'root',
'password' => 'root',
'port' => '8889',
'database' =>…

Prabhakar Siddhant
- 129
- 3
- 15
1
vote
1 answer
Array structure of raw SQL query results in CakePHP 3.8 / CakePHP 4 vs CakePHP 2
After CakePHP 4.0 has been released, we are considering to migrate our CakePHP 2.x application to 3.8 or 4.0. Currently, we are stuck with this issue:
Our application uses raw SQL statements sometimes using the Model::query() method.
For example,…

anweibel
- 485
- 4
- 10
0
votes
0 answers
General error: 1364 Field doesn't have a default value after upgrade to 4.4 from low 3.3
I'm currently working on finalizing an upgrade from CakePHP 3.3 to 4.4. I now have the same problem in a few places, which all are the same SQLSTATE error:
SQLSTATE[HY000]: General error: 1364 Field 'cert_request' doesn't have a default value
The…

dyXur
- 3
- 1
0
votes
0 answers
Where do I put custom helper functions for CakePHP 4.0 model logic
Sorry if this has been asked I've been searching documentation and stack overflow and can't find it being solved.
Here is my scenario. I have a model for a league, this model has many teams, each team has many team_members.
I have a view that is…

Hazmit
- 165
- 6
0
votes
0 answers
CakePHP 4.4: retrieve data that contains an association that matches an association
I need an indication, having not been able to find anything about it (but maybe it's my fault...). An indication also to the CakeBook will be fine.
In my application I have the PatientsTable. A Patient has many Notes and each Note belongs to a…

Mirko Pagliai
- 1,220
- 1
- 19
- 36
0
votes
1 answer
FrozenDate::parseDate doesn't work with September
Is there a reason why FrozenDate::parseDate, called with the month of September (ex. Sep), the date doesn't get parsed?
Code:
$months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
foreach($months as $m)
{
$d =…

TechFanDan
- 3,329
- 6
- 46
- 89
0
votes
0 answers
Using a Single Template for Both Edit and View Methods in CRUD Plugin for CakePHP
I have PHP experience but first time working with CakePHP 4.
"cakephp/cakephp": "~4.4",
"friendsofcake/crud": "^6.1.1"
The project is using the friends of cake CRUD plugin.
A controller already had a view method in it and an associated view.php…

Jean Riker
- 1
- 2
0
votes
0 answers
Upgrade cakephp 3.10 to cakephp 4 throws Hash::insert() error
Following all the migration steps from the CakePHP manual, I end up with a error 500 on all pages.
The log tells me this:
> [Wed Jul 19 11:56:02.566953 2023] [proxy_fcgi:error] [pid 12776]
> [client 178.117.91.131:57762] AH01071: Got error 'PHP…

Joost
- 418
- 5
- 17
0
votes
1 answer
Sharing variables between CakePHP 4 view blocks
I have a "general" layout template, in which I would like to define a general set of options to pass to all the forms I'm creating in the specialized templates the contain the blocks I'm fetching:
…

mrodo
- 565
- 5
- 21
0
votes
0 answers
Is it possible to inspect the Request Headers when using Cake\Http\Client?
I am trying to login to a website from a Command. I would like to inspect what headers are sent to the site so that I can compare them with what the browser sends. I am ASSuming the Cake Http Client will send some headers by default, I want view…

Heath
- 13
- 3