Questions about 3.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-3.x]
963 questions
0
votes
1 answer
Can I create CakePHP 3.x project without composer?
I AM using XAMPP3.2.1 which has the below configuration.
PHP5.6.14
MYSQL5.0.11
APache2.4.17
I have changed extension=php_intl.dll setting in php.ini file.
After I ran this composer create-project --prefer-dist cakephp/app [app_name] my project…

jayavel
- 81
- 7
0
votes
1 answer
CakePHP 3: Setting options for 'contain' when paginating
What's the correct way to limit the number of contained associated records when paginating?
The docs don't appear to address how to set options for 'contain' while paginating, but $paginate['contain']['AssociatedModel']['limit'] = 1; seemed to make…

Phantom Watson
- 2,667
- 4
- 25
- 39
0
votes
1 answer
How to delete data in custom finder method in CakePHP 3
I want to delete data in custom finder method.
Custom finder method document
My code:
public function findPREACTIVE(Query $query, array $options) {
$query->delete()
->where(['member_status' => -1])
->andWhere(['registered…

Nguyễn Anh Tuấn
- 1,023
- 1
- 12
- 19
0
votes
0 answers
Get max-score of Elasticsearch in CakePHP 3
I am trying to integrate Elasticsearch with CakePHP, and i couldn't figure out how to get the max-score like in json response:
"hits": {
"total": 1,
"max_score": 0.032739405,
"hits": [....]
}
The query in my controller works as…

Rachid
- 206
- 1
- 3
0
votes
2 answers
How to allow controller action in CakePhp 3.x if temporary password in url passes verification?
I have set up a forget password scenario where the user submits email address, gets a temporary password sent to them, and the user clicks link to be sent to a user's edit function to change password to something they can remember. I am passing the…

Battousai
- 503
- 7
- 17
0
votes
1 answer
Cake PHP 3 Paring Routing with a table
I have been trying to get pretty url with the router with Cake.
www.mysite.com/category/slug
www.mysite.com/slug
www.mysite.com/category/
I think there is no formula to get exactly what I want so I want explicitly match each url. I want my route…

artSir
- 540
- 1
- 8
- 29
0
votes
2 answers
Set default order to CakePHP 3.x model
In CakePHP 2.x it was possible to set an orderBy value in the Model as a default order for each query on that table.
In 3.x there is no mention of this in the docs and my attempts at using a reasonable guess for the variable or method name to…

aviemet
- 1,463
- 1
- 15
- 19
0
votes
1 answer
How to match records that are associated with a specific set of other records?
I am trying to add to two different search variations to my project.
There is a model "User" and a model "Tag". A User has many Tags.
Now I want to be able to search the Users with specific Tags.
Either I want to show all Users that has any of the…

conehead
- 125
- 9
-1
votes
1 answer
Passing json to cakephp backend android studio
Good day!, I just want to ask some help about how can I pass a json string from android to backend.
This is my code in uploading data to mysql. I am using okhttp3 library. I think the problem is in the request body. I don't know if its the right…

John Paul Bay
- 1
- 3
-1
votes
1 answer
Getting count fields of contained models using WHERE conditions
I have three models, Companies, events and assistances, where the assistances table stores the event_id and the company_id. I'd like to get a query in which the total assistances of the company to certain kind of events are stored. Nevertheless, as…

pepito
- 433
- 1
- 3
- 15
-1
votes
1 answer
You must enable the intl extension to use CakePHP on line 31
As Cakephp is successfully installed and its showing the main page.
It's giving this error while running the cake command in the cmd,
C:\xampp\htdocs\cakephpwork\bin>cake
PHP Fatal error: You must enable the intl extension to use CakePHP. in…

Ammad Hassan
- 1
- 3
-1
votes
1 answer
CakePHP matching associated data, not all values return
I've got Events and Distances, the models look like this:"
/* EventsTable.php */
class EventsTable extends Table
{
public function initialize(array $config): void
{
...
$this->belongsToMany('Distances', [
…

GreyRoofPigeon
- 17,833
- 4
- 36
- 59
-1
votes
2 answers
How to sort a `list` finder query? Results are not showing up in the defined order
The countries are not showing up in ascending order.
$coutryTable = TableRegistry::get('Country');
$getall = $coutryTable
->find('list', [
'keyField' => 'phonecode',
'valueField' => function ($row) {
return…

Jyoti Pathak
- 1
- 1
-1
votes
2 answers
Call to undefined method Cake\Validation\Validator::money()
I am attempting to validate a field that should hold US dollar amounts using the Validator method money(). I get the error "Call to undefined method Cake\Validation\Validator::money()".
I'm able to access the methods minLenthBytes() &…

jsf
- 5
- 3
-1
votes
1 answer
Cakephp 3 - 'matching' - how to filter the data for the booking system?
I have 'accommod_units' and 'accommod_bookings' table and I want to check the availability of accommodation units for a certain period. For example, Date of arrival: 2019-08-20 and Departure date: 2019-08-27.
'accommodation_units' table is shown…

user3661042
- 167
- 1
- 13