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
2
votes
1 answer
CakePHP 3 Get Current Host in View
I am attempting to build the full URI for images in my view, however, I am unsuccessful at this time because I am unsure of how to get the current host inside a view template...
How do I get the host/domain of the current url inside of a view?

Jeffrey L. Roberts
- 2,844
- 5
- 34
- 69
2
votes
1 answer
cakephp 3.x datetime field comparison in query not returning correct result
Trying to get all the records with which has been created 24 hr or prior. Here 'created' is a datatime field. I've three records in DB which must satisfy this condition, but returning 0 records.
$my_table_tbl =…

Augustine Chris Dev
- 21
- 2
2
votes
0 answers
CakePHP 3 - Query COUNT() returning incorrect number
I have a fairly complex query, which includes a SQL count in a subquery join.
The problem is Cake's query builder returns a count of 23, but I know this is incorrect. So I debugged the SQL query it built, and ran it directly in MySQL. The strange…

BadHorsie
- 14,135
- 30
- 117
- 191
2
votes
2 answers
How to get a segment URL cakephp 3
Hi I got trouble in retrieve URL segment CAkephp3 in view. I want to get the ID from current URL.
Lets say my URL is http://localhost/admin/financial_agreements/edit/50
and I want redirect to…

Nasihun Amin Suhardiyan
- 113
- 2
- 17
2
votes
0 answers
cakephp3 form radio control access other entity value
I need to populate some entity value into the radio HTML code, I look
through all documentation but does not seem to be able to find any help
below is the php code, {{entity->description}} is the entity value I want to…

cakephp_dev1
- 159
- 1
- 6
2
votes
3 answers
CakePHP 3: get a list of all table objects
I'm looking for a way to get a list of all available table objects. These are all the classes that are (by default) located under App/Modal/Table and that are handled by TableRegistry. How to get a list of all those objects?
I know it's possible to…

mixable
- 1,068
- 2
- 12
- 42
2
votes
1 answer
CakePHP 3.3.15 multiple matching() chained with OR
I'm trying to implement a global search mechenism in my CakePHP 3.3.15 app - this involves searching the Parent table for a value plus searching all the associated tables for the same value. I'm using matching(), but I can't find a way to combine…

Tomasz Cz.
- 315
- 5
- 22
2
votes
1 answer
How to make multiple values selected in dropdown in cakephp 3.x
Form->input('area', array('label' => false,
'placeholder' => 'Enter Zone Name',
'type' => 'select',
'class' => 'form-control',
'id'=>'area',
'multiple' =>…

kohinoor
- 47
- 11
2
votes
4 answers
Why is the `LIKE` operator not working with integer columns?
I'm trying to receive some ids from my database for an autocomplete search on my CAKEPHP 3.3 site. But my problem is that its only returning the id if I type in the exact id and not part of it.
Here is my function to search the data. The name…

mark.nz
- 127
- 1
- 14
2
votes
0 answers
CakePHP 3 - Joining data across multiple databases
I am trying to retrieve some data from tables which exist in two separate databases. Nothing seems to work - even the suggestions from the official documentation.
Let's say we have two tables in two databases:
db1 (default)
- orders
db2
-…

BadHorsie
- 14,135
- 30
- 117
- 191
2
votes
1 answer
How to integrate bootstrap template to cakephp 3.x
Copied css, js and relevant file to webroot folder. Then call css and js file to src->Template->Layout->default.php i.e.
= $this->Html->charset() ?>

Vivek Ranjan
- 65
- 7
2
votes
1 answer
How to inject an error message into entity without using validation in cakephp3?
I have a model wich checks a lot of things in beforeSave callback. I do not want to use cakephp validation system for that purpose because it is more simple for me in this case.
If the checking chain fails in somewhere I return false and no saving…

sipiatti
- 904
- 1
- 9
- 21
2
votes
1 answer
Cakephp 3 - How to find using the find query an entity by its translation
I have a "Pages" model with a Translate behavior. And I want to search a page matching in another language with CakePHP 3.x.
class PagesTable extends Table
{
public function initialize(array $config)
{
…

RedBeard
- 79
- 4
2
votes
1 answer
Preventing SQL injections in CakePHP3 full text index match
I need to do a fulltext search on a table in CakePHP3. I do the search like this:
$ids = $this->I18n->find('list', [
'valueField' => 'foreign_key',
'conditions' => [
'field IN' => ['name', 'description_search',…

Rytis
- 1,447
- 1
- 19
- 38
2
votes
1 answer
Class 'Router' not found in cakephp 3
I am upgrading my cakephp version from 2.6.7 to 3.3.4. The following code was properly working to refer the home url:
But this not working in cakephp 3.3.4 and it shows the following error message:
Error: Class…

Abdus Sattar Bhuiyan
- 3,016
- 4
- 38
- 72