0

I have this model named UserRecord which is not directly related to UserLimit model.

class UserRecord extends AppModel {


public function afterSave($created,$option=array()){ 

    $id=$this->data['UserRecord']['id'];
    $user_rec = $this->find('first', array('conditions' => array('UserRecord.id' => $id)));
    $uid = $user_rec['UserRecord']['user_id'];
    $UserLimit = ClassRegistry::init('UserLimit');

    $user_limit = $UserLimit->find('first', array('conditions' => array('UserLimit.uid' => $uid)));

}
}

Is it the right way to use another unassociate model with find query and conditions in CakePHP?

Arnab
  • 4,216
  • 2
  • 28
  • 50
  • 1
    possible duplicate of [Can I use one model inside of a different model in CakePHP?](http://stackoverflow.com/a/4753244/2666289) – Holt Aug 11 '15 at 15:21
  • I have make correction to the code. It's working. [More Details][1] [1]: http://stackoverflow.com/questions/980556/can-i-use-one-model-inside-of-a-different-model-in-cakephp – Arnab Aug 12 '15 at 06:46
  • If you have found your answer in the possible duplicate, please close/flag your answer as duplicate, it will help people searching for a solution in the future ;) – Holt Aug 12 '15 at 06:47

0 Answers0