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
2 answers

VARBINARY field in CakePHP 4

I have a varbinary(200) NOT NULL field on a table. Let's say the table is called users and the field is called secret. In CakePHP 3.X, accessing $user->secret; after retrieving one row of the table would give me a string. In CakePHP 4.X, instead,…
mrodo
  • 565
  • 5
  • 21
0
votes
1 answer

cakephp complex db query with associated tables

im trying to retrieve some data using a cakephp methods but i'm not sure if i can do it using only one query. i have the tables mentioned below CREATE TABLE products ( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) ); CREATE TABLE…
0
votes
1 answer

CakePHP 4 checkbox not outputting value

I am using CakePHP 4.3. According to the documentation, the option value can be used to set the value of the "value" HTML attribute. Here's my code: Form->checkbox('add_' . $item->id, [ …
mrodo
  • 565
  • 5
  • 21
0
votes
0 answers

cakePhp upgrate to 4.0 - bin/cake upgrade rector --rules phpunit80

I am try to update cakePhp 3.9 to 4.0 and i follow this link https://book.cakephp.org/4/en/appendices/4-0-upgrade-guide.html But when i hit this commnd - **bin/cake upgrade rector --rules phpunit80 /opt/lampp/htdocs/newagent/cakefull/tests/ ** Get…
0
votes
0 answers

cakephp 4 multilingual route has issue with progressive web app start_url

I am making my cakephp 4 app as PWA to install on devices my application is bilangual (en , ar) the issue I am facing is when I make start_url="/" in manifest.json file then app is showing error on first page that is This site can't be reached…
0
votes
0 answers

When I am opening my admin and user panel in same browser on same time then it is login other side itself, when I am switching user tab to admin tab

How we can make two different auth in cakephp for user login and admin login, My problem is that when I am opening both admin and user in same browser then it is directly login to other means if I am login in admin then it login directly in user and…
0
votes
0 answers

I am creating an API in Cake php 4, following the CMS Tutorial - Authentication. How to deal with the Error: Missing Route that I get when I post

I am creating an API in Cake php 4, following the CMS Tutorial - Authentication, and I was getting an error when using Postman to post in Json, it was showing Error: Missing Route. I reviewed routing, controllers, etc. and could not find the cause.…
FUTOSHI
  • 1
  • 1
0
votes
0 answers

Cakephp 4 Authentication plugin stores password hash in $_SESSION

I am making a new application and I was looking into the $_SESSION data after logging in. I saw that I can find my password in hash there?!?! Like why? I want to remove the password from the $_SESSION but I don't know how I can do that. The…
0
votes
0 answers

Mailer Cakephp 4 unable to connect to tcp

I'm trying to send emails from a controller (in place of *** is my actual gmail), I'm working on local: mailer = new Mailer('default'); $mailer->setFrom(['***@gmail.com' => 'Savepets']) ->setTo('****@gmail.com') …
Iria
  • 9
  • 4
0
votes
1 answer

What's the real use of `FormProtection` if `$_accessible` is correctly used in Entities in CakePhp4?

In almost every projects I have to disable the FormProtection on front side forms to avoid a BadRequestException (when a user leaves a form open for a while before submitting) and I'm wondering what the real point of keeping FormProtection enabled…
Oliv
  • 236
  • 3
  • 12
0
votes
1 answer

curl error 6 while downloading https://api.github.com/rate_limit: Could not resolve host: api.github.com CakePHP4

I'm very new to docker and I keep getting this error from a couple of days ago and it didn't happen before. Looks like I exceeded the limit of api access or something. ``` OS: WSL(Ubuntu22.04) PHP: PHP 8.1.16 Composer: 2.5.4 Docker: Docker version…
0
votes
0 answers

TimestampBehavior not woking for custom events in Cakephp4

I am struggling to figure out how to use TimestampBehavior with custom events. In OrdersTable I have 2 fields created_at and paid_at. My OrderTable dispatches the event CommerceManager.Orders.afterPayment after an order is paid : // in…
Oliv
  • 236
  • 3
  • 12
0
votes
2 answers

Problem with Modelless Form inheritance in Cakephp4

I'm building a CommerceManager plugin to manage purchases for online shops. CommerceManager plugin side To deal with the billing/delivery step I have created a Modelless Form DeliveryForm which is useful for : Setting a list of countries available…
Oliv
  • 236
  • 3
  • 12
0
votes
1 answer

How to trim() data of a modelless form before validate in Cakephp 4

In cakephp 4, in the case of a form with Model Table I use the callback method ModelTable::beforeMarshal() to trim() data before validation, but where can I do that in the case of a Modelless Form ?
Oliv
  • 236
  • 3
  • 12
0
votes
0 answers

Cakephp4 save with associations with more than one level

I'm developing with CakePHP 4 and try to save a nested entity. The new data are looking like that: $data = [ 'device_status_id' => '3', 'name' => 'myDevice', 'modules' => [ [ 'name' => 'Autodetect', …
Oliver
  • 1