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
0
votes
0 answers
Jquery .each() only works for second iteration should work til n div iteration
I have written code to process an image slide show - carousel bootstrap slideshow.
where i face an issue is when i according to my algorithm i find that images show up and load as HTML but when JQuery loop works i see first and second images show…

Prabhakar Siddhant
- 129
- 3
- 15
0
votes
1 answer
CakePHP 4 How to assign date field created_at to created
I have a table called products. In product table I have 2 fields created_at and update_at. I don't want to change it to created and modified.
Without change table fields name, how can I assign that created_at field is created to get cakephp time…

Niloy Rony
- 602
- 1
- 8
- 23
0
votes
0 answers
CakePHP 4 : Simple JSON view return
I am new in cakephp,
I am trying to develop a simple REST BREAD (BROWSE, READ, EDIT, ADD, DELETE) using cakephp version 4.
After installed I created a simple controller called UsersController with method index,view,edit,delete. Not created any…

Niloy Rony
- 602
- 1
- 8
- 23
0
votes
1 answer
Font Awesome glyph not being displayed as the form helpers button title
CakePHP version: 4.0.1
Font Awesome version: free-5.12.0 - here
I've just upgraded from Cake version 3.7.5 to 4.0.1 and the font awesome glyph is not being displayed as the buttons title anymore.
I followed the information here in the cookbook for…

Zenzs
- 138
- 13
0
votes
1 answer
Is that possible to build small modules so that code doesn't repeat with every view
I have Written code for HTML View with Cakephp 4.x and i would build code so that i don't repeat code i only call a module/element/template or whatever that's called please enlighten me with what that's called as per Cakephp 4.x norms and put…

Prabhakar Siddhant
- 129
- 3
- 15
0
votes
1 answer
Is that possible to save data with form submission
controller code:
public function login()
{
$this->LoadModel('Users');
pr($this->data);
}
View code:

Prabhakar Siddhant
- 129
- 3
- 15
0
votes
1 answer
is that possible to make pagination work as single item per page with navigation
Controller code:
public $paginate = [
'Employers' => ['scope' => 'employer'],
'Stories' => ['scope' => 'story',
'page' => 1,
'limit' => 1]
];
public function index()
{
…

Prabhakar Siddhant
- 129
- 3
- 15
0
votes
2 answers
is there a possibility to make pagination work for multiple tables within same controller and view
controller code : code for controller works for Employers pagination but unable to work pagination about Stories controller.
public $paginate = [
'Employers' => ['scope' => 'employer'],
'Stories' => ['scope' => 'story']
];
…

Prabhakar Siddhant
- 129
- 3
- 15
0
votes
1 answer
CakePHP 4 Date format for FormHelper->date() how to change to UK format
I have the following code in a template:
= $this->Form->date('selected_date', ['required' => true]) ?>
This displays a lovely new dynamic date picker, but with the US format "mm/dd/yyyy". What I want is "dd/mm/YYYY"
In app.php I've set…

bemoore
- 84
- 7
0
votes
1 answer
Routing for multiple hosts in Cakephp
As cookbook says:
Routes can use the _host option to only match specific hosts. You can use the *. wildcard to match any subdomain.
But what if I would like set same route for multiple hosts at once?
For example:
$routes->connect(
'/images', …

danny3b
- 313
- 5
- 17
0
votes
1 answer
Cakephp 4.0.1 ElasticSearch plugin issue
I am getting below error:
Fatal error: Declaration of Cake\ElasticSearch\Plugin::bootstrap(Cake\Core\PluginApplicationInterface $app) must be compatible with Cake\Core\BasePlugin::bootstrap(Cake\Core\PluginApplicationInterface $app): void in…

kadam sunil
- 233
- 2
- 3
0
votes
1 answer
How to Fix Cakephp 4 Composer Install Error
Having issues installing all packages for cakephp 4.0 via Composer. Running a fresh wamp server install on Windows with PHP 7.4.0
Here is composer output. Using the command found in the cakephp docs.
www/> composer create-project --prefer-dist…

mk97
- 264
- 1
- 6
- 15
0
votes
1 answer
why does the table is not being found when i'm using cakephp 4?
I'm using CakePHP 4 which come out this week and i tried to implement a registration form but when i submit the form this error shows up
public function register()
{
if($this->request->is('post')){
$userTable =…

Alastair Micallef
- 79
- 2
- 10
-1
votes
1 answer
how to use hasOne and belongsToMany together in cakephp 4?
$this->hasOne('Users');
$this->belongsToMany('Users', [
'through' => 'Memberships'
]);
$this->hasMany('Memberships', [
'foreignKey' => 'profile_id',
]);

aaaa
- 73
- 1
- 6
-1
votes
1 answer
Using $this when not in object context when reading cookies
I'm attempting to read cookies inside a Component and getting an error in the Cookie class?
Using $this when not in object context
CORE\src\Http\Cookie\Cookie.php:738
[![enter image description here][1]][1]
Code:

TechFanDan
- 3,329
- 6
- 46
- 89