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

Cakephp 4.0 Authentication Example

I tried cakephp 4.0 authentication tutorial from: https://book.cakephp.org/4/en/tutorials-and-examples/blog-auth-example/auth.html. But there is problem. On sql create there is only username and no email, but on source code email and password are…
Arifin K
  • 59
  • 10
0
votes
2 answers

How to add css class in li at multipe breadcrubms in cakephp?

I am trying to add css class in BreadCrubms. I am able to do it using template, Example $this->Breadcrumbs->setTemplates([ 'item' => '{{separator}}', …
Niloy Rony
  • 602
  • 1
  • 8
  • 23
0
votes
1 answer

CakePHP Method BreadcrumbsHelper::templates does not exist

I have followed cakephp version 4 breadcrumb documentation for create a simple breadcrumb. But here getting notice templates does not exist. My effort $this->Breadcrumbs->add( 'add', ['controller' => 'Products', 'action' =>…
Niloy Rony
  • 602
  • 1
  • 8
  • 23
0
votes
0 answers

Https redirection not working in cakephp 4

I have an issue related to https redirection in cakephp 4, I configured HttpsEnforcerMiddleware but it not redirect to https.It show an error related to FormProtection Component for all http requests. File src/Application.php public function…
devlogi
  • 43
  • 1
  • 12
0
votes
1 answer

how to use validationDefault( ) in cakephp 4

How can i change this code based on this question? Username can only accept character and numbers (no special characters) Password needs to have the following rules: i. At least 1 number ii. At least 1 uppercase character iii. At least 1 lowercase…
0
votes
0 answers

CakePHP 4 DefaultPasswordHassher::hash() problem. Different hash each time

I'm following the cakePHP4 Blog Tutorial and had a problem with the _setPassword(). Every time I try to edit the user using the same password I got a different hash. This is my setPassword function: protected function _setPassword(string $password)…
0
votes
1 answer

_Token was not found in request data in CakePHP 4

I have some issue with a simple signup function in cakephp 4, I enabled the FormProtection component and it return " _Token was not found in request data." The token is already generated but I don't know why the controller cannot detect it
devlogi
  • 43
  • 1
  • 12
0
votes
0 answers

Why can't CakePHP 4 CLI connect to MySQL database via PDO?

I'm using CakePHP 4 on a Linux Mint cinnamon installation with the LAMPP stack. I have a database with users and all chef hats of PHP are green. The application is also able to fetch data from my database when running in the browser. I want to bake…
Axel Köhler
  • 911
  • 1
  • 8
  • 34
0
votes
1 answer

Policy related cakePHP bake command does't work(in my case)

I am working on cakePHP (version 4.0.5) and when I tried to run bin/cake bake policy --type entity Name command, It'll gives an error . Error: Unknown option type. Can anyone encounter such problem and have any solution,kindly share...
0
votes
1 answer

CakePHP: CMS Tutorial: Getting InvalidCsrfTokenException although csrf protection it is not even activated

I set up CakePHP 4.0.6 on my Lubuntu. Using a local Apache Server. Installation went fine I can see the welcome page. Then I startet the CMS Tutorial, created the tables in the database and then created everything with bake ./cake bake all…
David
  • 23
  • 8
0
votes
1 answer

Cakephp Passing Conditions to Contain throws InvalidArgumentException

I want to limit the joined results by passing a condition (limit) to ->contain('ProductCategory') $products = $ProductTable ->find('all') ->where($where) ->contain( [ 'ProductPrice' => [ …
Jonathan
  • 1,955
  • 5
  • 30
  • 50
0
votes
1 answer

How do I resolve Composer dependency upgrading to CakePHP4?

I'm following the upgrade instructions for moving a CakePHP project to version 4. All went well until the final command: php composer.phar require --update-with-dependencies "cakephp/cakephp:4.0.*" This resulted in Problem 1 cakephp/bake…
0
votes
1 answer

How do I fetch the Validation errors in CakePHP 4?

I have already loaded the model in the initialize method and have imported the appropriate classes. I have also created the LoginsTable Model. I went through the documentation and yet I have not found the solution. This is the code, where I'm…
0
votes
1 answer

CakePHP 2 user database/password migration for Cakephp 4

My customer has program which is made with CakePHP 2 (not my project) and he wants to upgrade it to newest CakePHP. I noticed that there was tutorial for Custom Password Hasher (legacy / sha1 + blowfish) but it has been deprecated since 4.0 and…
0
votes
1 answer

Cakephp 4.x Admin Authentication repeated Controllers needed?

If I have a UsersController and want to have an admin Prefix, do I need to have one controlle for all basic user functions, and another UsersController inside /Admin with only admin functions? Am I supposed to have two UsersControllers in my code?
SrQ
  • 106
  • 7