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
1
vote
1 answer

Argument 1 passed to pluginSplit() must be of the type string, array given

I'm currently attempting a migration from 3.10.2 to 4.0. I've gone through the guide and I'm now trying to fix issues as they come up. I'm finding this one rather cryptic. Argument 1 passed to pluginSplit() must be of the type string, array given,…
TechFanDan
  • 3,329
  • 6
  • 46
  • 89
1
vote
0 answers

How to remove `contain()` added to the query by a behavior in Cakephp 4?

I'm looking for the way to do an equivalent to cakephp2's 'recursive' => -1 on a find(). I have a Model Categories that uses the TreeBehavior. In my controller I get the path of the category : // in CategoriesController.php $path =…
Oliv
  • 236
  • 3
  • 12
1
vote
1 answer

cakephp 4 - How to find max and min values from a related table

I'm doing some development in CakePHP 4. Still very new to it so this might be straightforward. I have a table of housing developments that has a simple structure - development_id, name, address, etc Each development has a number of plots for sale…
1
vote
0 answers

CakePHP 4 can't load plugin's controller

What I have done: fresh composer install of CakePHP 4.3.1 bin/cake bake plugin Admin config the db connection successfully bin/cake bake all Articles --plugin Admin put this route $routes->connect('/admin/articles', ['plugin' => 'Admin',…
petiar
  • 1,047
  • 2
  • 14
  • 31
1
vote
0 answers

cakephp how to find group by range data?

Using Case I trying to find the group by count by range, The query that I have written like: $this->find() ->select([ 'count' => $this->find()->func()->count('*') ]) ->where(function ($exp, $q) { …
Abu Sayed
  • 75
  • 7
1
vote
1 answer

How to add variables in a form textarea

I would like to create custom confirmation messages that could be easily updated by the admins. Like contact_name and contact_place are fields that will be completed…
user11791297
1
vote
1 answer

How to use cookie value globally in cakephp 4 version?

I want to set cookie value in one function and their value use everywhere in cakephp 4 version. Currently , i can use cookie value inside the only one function which i have set their value. I can get cookie value in index() function but i can't get…
developer
  • 23
  • 3
1
vote
1 answer

How to pass variable to $callback Collection::map($callback) in CakePHP 4.2?

I'm not an expert of Collections concept in CakePhp 4, and I don't know how to pass a variable in Collection::map() $item = [ 'attributes' => [ 'class' => 'mon-li-{{id}}', 'data-truc' => 'li-{{id}}' ], …
Oliv
  • 236
  • 3
  • 12
1
vote
1 answer

How to Check if user is logged in cakephp 4 application using CakeDC users plugin?

How to Check if user is logged in cakephp 4 application using CakeDC users plugin ? I need to change the theme when the user is logged in In Application.php public function bootstrap(): void { $this->addPlugin('BootstrapUI'); // Call parent…
1
vote
1 answer

Unit testing getting error class could not be found

I have a class for dynamoDB in location src/Dynamo/shop.php My class looks like below I am trying to implement unit test for this class, So I have…
Niloy Rony
  • 602
  • 1
  • 8
  • 23
1
vote
1 answer

Disable password hasing in CakePHP 4.x / Authenticator 2.x

I am using CakePHP for a school project where a filled in database is given to you. Users are required to login by a username / password which I already made. The problem however, users in the database have an unencrypted password which I want to…
siebsie23
  • 41
  • 5
1
vote
2 answers

Cakephp unit test how I will write a test method for test buildRules

I am trying to write a test case for below codes public function buildRules(RulesChecker $rules) { $rules->add($rules->isUnique(['email'])); return $rules; } I already created AdminUsersFixture and AdminUsersTableTest. In…
Niloy Rony
  • 602
  • 1
  • 8
  • 23
1
vote
2 answers

Getting unexpected result if using pagination on random find query in cakephp 4?

I am trying to find all products in random order using pagination. But getting an unexpected result. This is my controller code: $this->paginate = ['maxLimit' => 20]; $articlesData =…
USER1359
  • 13
  • 3
1
vote
2 answers

Cakephp 4: JWT Authorization fails in Browser, Postman works

I'm having trouble migrating my Backend CakePHP App, from CakePHP 3.9 to CakePHP 4. The App serves as an API for my sveltejs/sapper Javascript Application. As for the JWT Authentication I'm using the admad/cakephp-jwt-auth plugin. The App before…
1
vote
2 answers

Return value of Cake\Database\TypeFactory::build() must implement interface Cake\Database\TypeInterface, instance of App\Database\Type\CryptedType

After upgrading to cakephp 4 I have this error when I try to do any query: Return value of Cake\Database\TypeFactory::build() must implement interface Cake\Database\TypeInterface, instance of App\Database\Type\CryptedType returned
Lurtz 963
  • 11
  • 2