I have multiple fields setup as FK to the same table. The FK can also be NULL. I keep getting this error: Database structure: Column definition (ie. late_agreement_exception_outcome_recommendation_id): Column relationship (ie. late_agreement_exception_outcome_recommendation_id): ExceptionTable: FK setup to Ex…
Tag: cakephp-4.x
How to display validation errors in JSON of associated fields in Cakephp4?
I’m looking for a way to display validation errors in jQuery after sending a form in ajax that returns validation errors in JSON. My code works for simple form, but the difficulties appear for more complex forms, especially for forms containing inputs for associated data. For example : Here is a form co…
cakephp 4.x query to get results from database
I came across a problem recently that I have to make a find(all) query in cakephp. Problem is I was unable to call model function to cakephp controller & add a command in function that would allow me to make a find(all) function in cakephp and retrieve all rows in a database that I was looking for. I woul…
ERROR: POST http://localhost:8765/users/delete/delete8 403 (Forbidden)
I’m using cakephp4. trying to add some sweetalert. Sweetalert is popping up when the delete button is clicked but when I click confirm for delete it’s not deleting the data. template/layout/Users/index.php template/layout/Users/index.php delete method is as follows in my UsersController.php UsersC…
How to use CakePHP ORM to query belongsToMany relationship
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 poin…
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 (“org…
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 &…