31,614 questions
0
votes
1
answer
35
views
How can I find an item by id?
I'm working on a site with CakePHP 5.0. It has 2 tables: news and pages. I baked everything on the command line, and I've been able to get the pages side working ok, but I'm stumped on how to ...
0
votes
0
answers
74
views
Retrieving values from 2 tables at the same time in CakePHP 3
I'm developing a small module on CakePHP 3 and I'm currently encountering a small problem that I can't seem to solve.
I have two tables: Events and shop_ticket.
Events table:
I store information ...
1
vote
1
answer
65
views
Api Rest in CakePHP: How to return id fields (Bigint) as string and not as INT/BIGINT?
I created a REST API in CakePHP 4.5, and all the ID fields are of type Bigint. Is there a way to force CakePHP to convert these fields to strings before returning the JSON?
There are many fields, and ...
0
votes
0
answers
26
views
CakePHP Bake Error - Association alias is already set
I've just created a new site using CakePHP 5 for the first time (I've used CakePHP 2-4 before). I'm baking the models from my database, but one of them is failing.
My database tables are as follows (...
0
votes
1
answer
55
views
Resource class Administrator does not exist while implementing modeless policy
I'm trying to implement a policy for a model-less controller. The error I keep getting when I access /administrators/import
Resource class Administrator does not exist.
InvalidArgumentException
Here ...
0
votes
0
answers
72
views
Can you get CakePHP 4 to return JSON error responses automatically when writing an API?
CakePHP 4.x
We have an application which consists of a frontend web app (used by customers through a browser) and an API for some backend operations which is integrated with our other systems.
The ...
0
votes
1
answer
50
views
CakePHP 5 Middleware: Authorization check error when using custom middleware
I'm building a web application in CakePHP 5 using the Authentication and Authorization plugins.
My users can be members of multiple clubs through a many-to-many relationship (using a join table). The ...
0
votes
1
answer
38
views
Cake\ORM\Marshaller::_mergeAssociation(): Argument #1 ($original) must be of type Cake\Datasource\EntityInterface|array|null, int given
Full error:
error: [TypeError] Cake\ORM\Marshaller::_mergeAssociation(): Argument #1 ($original) must be of type Cake\Datasource\EntityInterface|array|null,
int given, called in /var/www/vhosts/dpg3....
0
votes
1
answer
78
views
File validation in CakePHP 4
Basically trying to do this https://discourse.cakephp.org/t/validate-uploaded-file-size-through-model/6755/5 in a CakePHP 4.5.9 application.
I have a Model called Whitepapers and with I'm trying to ...
0
votes
0
answers
34
views
Using `StringTemplateTrait` to build templates
I have a helper that defines the time template like this:
protected array $_defaultConfig = [
'templates' => [
` 'time' => '<time{{attrs}}><i class="far fa-clock fa-sm ...
0
votes
0
answers
48
views
Trying to understand PHP Garbage Collection [duplicate]
Forgive my ignorance but I've not played around with PHP's garbage collection before. Specifically, I'm running a CakePHP 5.x Command Script and running into memory exhausted issues.
As a test to see ...
-1
votes
1
answer
24k
views
Datasource class could not be found
i googled this error in many ways but only could find irrelevant messages
i am migrating a cakephp 4.2 PHP application to cakephp 5 and only the 'default' database is usable
in my app_local.php i have ...
0
votes
1
answer
30
views
`save()` with associated `hasMany` record fails composite UNIQUE index on "Duplicate entry"
What I have
ConfigurationsTable hasMany ValuesTable
In return,
ValuesTable belongsTo ConfigurationsTable
ValuesTable belongsTo ParametersTable
Each value can belong to a unique combination of a ...
1
vote
0
answers
48
views
having problems since recreating my database
I have a controller on my Api folder named CrudsController and I have this function. what I don't understand is this is properly working before I had issues with my database that I had to recreate. ...
1
vote
1
answer
61
views
CakePHP connect to Google SQL Proxy Container
For starters, I have a docker container running for "cloud-sql-connectors/cloud-sql-proxy:2.14.3" and it has credentials and appears to have started and is running fine.
2025-01-29 12:31:44 ...