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
1
vote
0 answers
CakePHP sum of deep association
Consider the following models:
/* HerdsTable.php */
class HerdsTable extends Table
{
public function initialize(array $config)
{
...
$this->belongsTo('Users', [
'foreignKey' => 'user_id',
'joinType' =>…

GreyRoofPigeon
- 17,833
- 4
- 36
- 59
1
vote
1 answer
How can set css on head and js on footer dynamically from Controller/View in Cakephp 3.5
Hi I am finding a solution where we can pass css and js array and its automatically set to css(in Header) and js(footer) default layout in cakephp 3.5
the problem is all css and js is calling in each page which is not required.
can you help.
…

Mithilesh Kumar
- 92
- 1
- 2
- 13
1
vote
0 answers
convert array to object orm entity and pass into pagination in cakephp 3
I have array that I have to pass into pagination. So how can i convert the array to Object ORM to set into pagination?
I can't $this->paginate = []; because I have to apply some foreach and conditions that's why i did first find all.
…

Devendra
- 219
- 2
- 22
1
vote
1 answer
CakePhp 3.5: save other data in beforeDelete() which returns false
I am implementing a ReviewableBehavior to implement a four eyes principle. The behavior implements beforeDelete(), beforeSave() and afterSave() and uses a reviews table to store CUD requests.
for added records, a $review record is created and saved…

Christian Kirchhoff
- 285
- 1
- 5
- 15
1
vote
0 answers
CakePHP session inside Joomla component
I'm writing a Joomla plugin, which is basically just a wrapper around an application written in CakePHP (version 3.3; not in a good position to upgrade this at the current moment). I'm running into various issues with session data.
First problem is…

Greg Schmidt
- 5,010
- 2
- 14
- 35
1
vote
2 answers
In CakePHP3.6, how to call function of another controller into other controller?
I am using CakePHP3.6 for my project. I have created following function in Options controller:
public function getValue($id = null){
$options=$this->Options->find()->where(['id'=>$id])->first();
return $options->value;
}
then I am calling this…

Gurpreet Kaur
- 19
- 1
- 7
1
vote
1 answer
How to use own element file for flash instead of Bootstrap-ui's default, CakePHP 3?
I am using bootstrap-ui plugin for Form but it automatically loads flash. I want to use my own element file for Success/Error/Warning etc but bootstrap-ui automatically uses its default.ctp element for rending flash message.
So how can I use my own…

bikash.bilz
- 821
- 1
- 13
- 33
1
vote
1 answer
Swift 4 WKWebView Authentication From Keychain
I have a very simple web page using CakePHP 3.x and I wrote a simple Swift 4 app to display that site. As long as the app stays open sessions will continue to work. As soon as the app is closed, the user has to login again. I believe this is the…

Nelson Ripoll
- 23
- 1
- 8
1
vote
2 answers
How can I make ResultSet as a instance of Collection?
I have this QueryService function:
public static function findAllOrderStatus(): Collection
{
$orders = TableRegistry::get('b2c_orders');
$query = $orders->find();
return $query->select([
'shop_code' => 'm.mall_code',
…

andil01
- 377
- 4
- 19
1
vote
1 answer
How to use $this->autoRender = false in cakephp 3.6.10?
I am trying to display the test data on the screen by running function test() in the pagesController. Used $this->autoRender = false for it, but it is still giving me error:
Please help me out. I think some version problem is there, but I can't…

Sumeet Mathew
- 23
- 6
1
vote
1 answer
Cakephp - Cannot commit transaction - rollback()
I have a little problem. I have a Cakephp 3.6 project. All work fine, but when I want to delete a record in one controller show my a error.
Cannot commit transaction - rollback() has been already called in the nested…

l3nox
- 15
- 2
- 8
1
vote
1 answer
CakePhp 3 - All roles of my Users Table are register in my Client Table, but I only want Client role
I'm a newbee in Cakephp and I have to build a project-management interface for the company where I work in internship. My boss gave me the tables and I have to make the associations.
I have 3 main tables :
MyUsers = a User can have a role between…

Amélie
- 17
- 7
1
vote
1 answer
CakePHP 3.6: routes and middleware
I have a cakephp plugin that creates image thumbnails.
Currently, thumbnails are "served" by an action of a controller that returns a file as response (here).
This is the route:
Router::plugin(THUMBER, ['path' => '/thumb'], function (RouteBuilder…

Mirko Pagliai
- 1,220
- 1
- 19
- 36
1
vote
1 answer
Cakephp 3 sortBy DESC two are out of order
Okay more details sorry. I have two tables:
Table 1.
**faculty_salaries**
id
personnel_profile_id
faculty_position_id
faculty_salary
Table 2.
**personnel_profiles**
id
azinstitution_id
fy_year
title
faculty_turnover_rate
staff_turnover_rate
my…

Ken
- 41
- 9
1
vote
1 answer
Access non associated tables in cakephp3 controller
I am a newbie to cakephp3, I am trying to access a "table A" which is not linked to "table B" in the controller of table 2
I want to user category table in UsersController. How to achieve that?
e.g.
user table has three fields id, name,…

Tarun Madaan
- 401
- 1
- 8
- 20