How to load models in cakephp controller

Cakephp

Posted on 19 Nov 15 by Vickey
  1377



In we are using correct naming convention in cakephp then the corresponding model automatically load. But if we are using more then one models in same controller then we need to load each model. We have two method to load the model

1. Load model where we need it

$this->loadModel('User');
$getUser	=	$this->User->find('all')

2. Load all models at once

public $uses	=array('Model1','Model2');

in the last method there is no need to load model every time


If this post help you reduce time to develop, you can help me to maintain this website :)
www.000webhost.com