PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, January 5, 2022

[FIXED] i want to load multiple models in a particular function in a controller in cakephp3?

 January 05, 2022     cakephp, cakephp-3.0     No comments   

Issue

i tried to set $uses in cakePhp3, it's working in cakePhp2.6 but not in 3

public $uses = array('model1', 'model2', 'model3', .... );

but i get error like

{
    "message": "Call to a member function find() on boolean",
    "url": "/JobPosts/Test/1042.json",
    "code": 500,
    "file": "/home/task24/public_html/clientApi/src/Controller/JobPostsController.php",
    "line": 1304
}

Solution

You don't use $uses anymore in Cake 3.

$this->loadModel('MyModel');


Answered By - BadHorsie
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing