I am working on a custom query builder piece of code that supports a CakePHP 3 based API. I recently got a request to make it search against a Task item for associated Users. The association from a Task to users is a belongsToMany, which has not been supported in the custom query functionality up to this point. The relationship
Tag: cakephp
CakePHP 4 – how to validate forms that need to save data to multiple tables
Apologies if this has been asked before. All of the examples I can find are old or apply to legacy versions of CakePHP, e.g. cakephp: saving to multiple models using one form is 7 years old. I have an application in CakePHP 4.1.6. Two of the tables in the database are called tbl_users and tbl_orgs (“orgs” in this case means
sort data by id in cake php
where i want to sort it. following array.. and i want array like notice that , i need sort by sortByFID wise if sortByFID id common then sort their id ascending order. i tried like this in cake php i am new in cake php, and i am still get struggle to solve it. Answer umm it seems to much
How to access packages in vendor directory
Calling any package from the vendor directory structure within any CakePHP controller works, as the composer set up everything correctly. For example this MCVE from https://github.com/giggsey/libphonenumber-for-php#quick-examples When I run the equal code directly in webroot/sample.php so it fails : Got error ‘PHP message: PHP Fatal error: Uncaught Error: Class ‘libphonenumberPhoneNumberUtil’ not found in …sample.php My question: What do I have
CakePHP DC Users 8.5.1 customising to use email
I have a CakePHP application running on Cake PHP 3.8.13 and CakeDC Users 8.5.1. I am currently able to log on using the username field, but I would like to use the email field for authentication. I …
CakePHP4 – Create Record with Ajax
I’m new working with CakePHP and I’m having a hell of a time trying to figure out how to add a form that can post to a different db table with ajax. Basically, I’ve got a form that carries out a search which works fine, but before the user carries out the search I need to capture his email &
CakePHP 4 Modifying Query Results IN TABLE
I am looking for an example or explanation on how I can modify a query result every time a specific table is called. All the examples I’ve seen are mainly meant for the controller. I’m kind of looking for something similar to the old function afterFind(). My goal is to put a function within my Table file to automatically modify
array_key_exists() expects parameter 2 to be array, null given – Cakephp 3
Friends, I appreciate any comments. I’m having problems with array_key_exists. I need to check if a product already exists in the shopping cart. I’m doing it this way: I received the error below, but now with the update it no longer exists. But the function still doesn’t help me. The product is added to the cart even if it has
How to get the index of an array of sessions? – cakephp
Friends, I have an array where I need to get the index dynamically to be able to delete the specific session. enter image description here I tried to link the delete button like this in cart.ctp: …
Where to put custom SQL code in CakePHP 3?
I’m building an application in CakePHP 3. It uses a number of legacy databases which are not built in the Cake conventions. I do not want to use any of the ORM features Cake provides, as it’s more tedious to set up all the relations than just write “Raw SQL”. We are also not going to make any changes to