Questions tagged [cakephp-3.x]

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.

963 questions
2
votes
1 answer

CakePHP Authentication Plugin Identity Associations

I'm using CakePHP 3.8 and migrating to the Authentication Plugin (https://book.cakephp.org/authentication/1.1/en/index.html). When calling $this->Authentication->getIdentity()->getOriginalData() in a controller, I'd like to access a couple of…
Ambie
  • 4,872
  • 2
  • 12
  • 26
2
votes
0 answers

Dynamically add columns to query results via CakePHP 3 ORM queries

I'm trying to write a query using CakePHP 3.7 ORM where it needs to add a column to the result set. I know in MySQL this sort of thing is possible: MySQL: Dynamically add columns to query results So far I've implemented 2 custom finders. The first…
Andy
  • 5,142
  • 11
  • 58
  • 131
2
votes
1 answer

cakephp authenticate with ldap and match to local user (or create one)

I'm trying to configure ldap authentication on cakephp 3.8 using the new cakephp/authentication plugin, and I'm not sure how to match the authenticated ldap user with a local entity. My config closely follows the documentation and is available in…
waspinator
  • 6,464
  • 11
  • 52
  • 78
2
votes
3 answers

CakePHP 3 - unable to generate a query with WHERE...OR conditions

CakePHP 3.7 I'm trying to generate a query which uses a WHERE...OR pattern. The equivalent in MySQL - which executes and gives the results I want is: SELECT * FROM groups Groups WHERE (regulation_id = 1 AND label like '%labelling%') OR (id…
Andy
  • 5,142
  • 11
  • 58
  • 131
2
votes
0 answers

CakePHP 3 - association is not defined - even though it appears to be

I've baked a legacy application using CakePHP 3.7 The database contains 3 tables as follows: regulations, groups, filters. The hierarchy as far as the application goes is: Regulations Groups Filters The table schemas are as follows: mysql>…
Andy
  • 5,142
  • 11
  • 58
  • 131
2
votes
1 answer

How to add class "is-invalid" in an input error in cakephp?

I'm trying to put the .is-invalid class in my input to use the bootstrap css... But I only have "inputContainerError" 'inputContainerError' => '
{{content}}{{error}}
', Does cakephp have no "inputError" in…
2
votes
2 answers

CakePHP 3.x - Save many-to-many data

I am attempting to patchEntity with a join table, but I am unable to get it to save the associated records, and I think I have the backend code correct, but I am unsure of what the frontend code should look like... Here is the scenario, I have…
Jeffrey L. Roberts
  • 2,844
  • 5
  • 34
  • 69
2
votes
1 answer

How can CakePHP Authorization plugin authorize access to indexes?

I'm converting my app to CakePHP 3.6, and working now on using the new Authorization plugin. I'm not sure how to check authorization for things like indexes or other reports, where there is no "resource" to pass to the can() or authorize()…
Greg Schmidt
  • 5,010
  • 2
  • 14
  • 35
2
votes
1 answer

POST Requests for CakePHP 3 API are not working

I am developing an API using CakePHP 3.x documentation. To develop this API I am using their official documentation: https://book.cakephp.org/3.0/en/development/rest.html When I try to access my api using GET request on url…
Mayank
  • 145
  • 1
  • 11
2
votes
0 answers

CakePHP 3 CakePdf wkhtmltopdf css problems when generating views from shell

This question is about wkhtmltopdf finding CSS files when used from CLI / shell Background To make fully formed links when generating views from shell (i.e. for email generation), I have configured my bootstrap_cli.php file to define the…
taekwondoalex
  • 386
  • 4
  • 12
2
votes
2 answers

CakePHP 3 - access params of Query object

In CakePHP 3.x I can do this: $Substances = TableRegistry::get('Substances'); $query = $Substances->find()->where($where_conditions)->select(['id']); debug($query); This will show me the Query object. If I want to get the SQL string I can use…
Andy
  • 5,142
  • 11
  • 58
  • 131
2
votes
1 answer

CakePHP 3 - How to define multiple conditions for one and the same field?

I'm working on an application in CakePHP 3.5.13. It is tied to a "legacy" database - i.e. one which hasn't been written according to CakePHP naming conventions. Nonetheless I've baked it and produced the Table and Entity files. I'm having problems…
Andy
  • 5,142
  • 11
  • 58
  • 131
2
votes
2 answers

How do you calculate the OFFSET value used by page() in CakePHP 3.x?

CakePHP 3.x According to the docs To limit the number of rows or set the row offset you can use the limit() and page() methods: // Fetch rows 50 to 100 $query = $articles->find() ->limit(50) ->page(2); What this does is generates the equivalent…
Andy
  • 5,142
  • 11
  • 58
  • 131
2
votes
0 answers

Errors when link method is used in cakephp 3.5

I am trying to practice the section of Saving BelongsToMany Associations where an example given in the document is to make an association between two existing entities. I followed below examples in my ArticlesController.php …
Bayezid Alam
  • 270
  • 5
  • 17
2
votes
1 answer

BelongstoMany relationship between a table and itself

I have a database with a table Users and i need to store information about one relationship between them: users that have permissions to manage other users. Also those managed users can be managers too, so any user can be manager or be managed by…
Baalhug
  • 43
  • 4