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
Use CakePHP Http Client with Magento2 rest API search criteria
I'm trying to send a GET request to a local Magento2 rest API to get all the orders after a certain time. I'm following http://devdocs.magento.com/guides/v2.1/howdoi/webapi/search-criteria.html#simple-search-using-a-timestamp. I'm using CakePHP…

BSounder
- 134
- 9
2
votes
1 answer
Remove particular query string from url in cakephp 3.x
I know that my question title sounds like duplicate but it's not. Our project is multi-lingual. I have listing page on this page cakephp pagination is applied. But the link on pagination number is…

user7738665
- 49
- 6
2
votes
2 answers
How to validate mandatory associated model in cakephp 3
I've got myself confused about the right (or best) way to make sure the associated models are being sent via POST when creating a new User. Both approaches listed bellow are working.
User hasOne UserDetails
Option 1
POST data:
{
"username":…

Bruno Serra
- 43
- 3
- 8
2
votes
1 answer
Custom model function to insert a new record in cakephp 3
I'm new to CakePHP. I have a table to keep record of user's activity by creating a log in it. The table has two columns
+----+------------+-----------+
| id | user_id | comment |
+----+------------+-----------+
I want to pass values from…

Anshuman Upadhyay
- 103
- 1
- 13
2
votes
1 answer
using connection manager with orm cakephp 3
Every tutorial or documentation regarding this subject is used with sql queries but never with new orm.
I have two data sources defined in config/app.php: default and not_default
with same tables and columns, when the user login the default database…

Web Constructors
- 21
- 3
2
votes
1 answer
how compare records and select them in third column in same table in mysql
Table Interest_log
Id user_id user_id_interested
------ ------- ------------------
3 2 3
5 3 2
6 6 2
7 6 …

learner
- 171
- 2
- 11
2
votes
2 answers
How to use INTERVAL in CakePHP 3.x
I am using CakePHP 3.x. I have converted and stored all my dates to string using the strtotime(date('Y/m/d h:i', time())); .And in DB it will store like this 1479466560 But Right now i need to select rows from exactly 14 days ago. I tried like…

Dinesh
- 197
- 1
- 12
2
votes
3 answers
CakePHP 3 - How to write COALESCE(...) in query builder?
How do I write this kind of COALESCE() statement in the query builder?
SQL
SELECT COALESCE(n.value, p.value) AS value
FROM nodes n
LEFT JOIN parents p ON p.id = n.parent_id
PHP
I can retrieve both the child and parent values and then go through the…

BadHorsie
- 14,135
- 30
- 117
- 191
2
votes
2 answers
How to get current controller action in cakephp 3.x model
I am using cakephp 3.x have put database queries in model in which i want to check the current controller action and based on that i will make my database queries.
I know i can pass controller action from my controller itself to my model function…

Mittul At TechnoBrave
- 1,142
- 3
- 25
- 70
2
votes
2 answers
How to check Cakephp version from command line?
I am using Cakephp 3.x but i want to know the exact version number using command line ? is there any command available which can show us the correct version which we are using in our application ?
i know we can use this echo Configure::version();…

Mittul At TechnoBrave
- 1,142
- 3
- 25
- 70
2
votes
0 answers
csv file export in cakephp 3.2
I have completed all the steps to generate the csv file in cakephp 3.2.Here
i have generated the vendor using composer.phar ,and in vendor i got
the csv plugin (friendsofcake) ,also i managed from controller to fetch data from database ,that one…

sradha
- 2,216
- 1
- 28
- 48
2
votes
1 answer
Cakephp 3 - make bake command require presence for foreign keys
I have a table with a foreign key defined in it.
After running the cake bake command, I got correctly generated the table file.
That is, the references ( hasMany, belongsTo, etc. ) are included in the file.
Al required fields defined as not null in…

user1077915
- 828
- 1
- 12
- 26
2
votes
2 answers
Using SQL Functions in cakephp returns error
I am following Using SQL Functions to build my query. I tend to get the first due instalment. My query was working (on cakephp3.1) before updating the cakephp to version 3.3 (by composer).
In my Controller
$this->loadModel('Orders');
$order =…

Fury
- 4,643
- 5
- 50
- 80
2
votes
3 answers
CakePHP 3.x: loading components on the fly on controller
I'm trying to load a component on the fly on controller.
The component has a startup() method and I know that this must be called manually, because the component is loaded into action.
public function startup(\Cake\Event\Event $event) {
//do…

Mirko Pagliai
- 1,220
- 1
- 19
- 36
2
votes
1 answer
Full URLs in emails in CakePHP unittest
I would like to get full URLs inside emails that get triggered by my tests in CakePHP 3.2. I tried with the full-options for $this->Html->image('image.jpg', ['fullBase' => true]) and $this->Url->build('/', true) but they don't seem to work in…

lorem monkey
- 3,942
- 3
- 35
- 49