$this->User->find('all',array('conditions'=>array('OR'=>array(array('nickname like '=>"%$keyword%"),array('User.id'=>$keyword),)),'fields'=>'User.id,User.nickname'));
find 的 语法糖
12345678910
#findAllBy(string $value, array $fields, array $order, int $limit, int $page, int $recursive)$this->Product->findAllByOrderStatus('3');$this->User->findAllByUsernameAndPassword('jhon','123');$this->User->findAllByEmailOrUsername('jhon','jhon');$this->User->findAllByLastName('psychic',array(),array('User.user_name'=>'asc'));#findBy(string $value[, mixed $fields[, mixed $order]]);$this->Recipe->findByType('Cookie');$this->User->findByEmailOrUsername('jhon','jhon');$this->User->findByUsernameAndPassword('jhon','123');
$this->loadModel('WifiList');$this->SearchPagination->setup('WifiList');$this->request->data['WifiList']['seller_id']=SELLER_ID;$this->paginate=array('fields'=>array('WifiList.*','WxPersistentQrcodes.ticket'),'conditions'=>$this->WifiList->parseCriteria($this->request->data['WifiList']),'order'=>'WifiList.id desc','joins'=>array(array('table'=>'wx_persistent_qrcodes','alias'=>'WxPersistentQrcodes','type'=>'LEFT','conditions'=>array('WifiList.wx_p_qrcode_id=WxPersistentQrcodes.scene_id and WxPersistentQrcodes.seller_id='.SELLER_ID))),'limit'=>10);$data=$this->paginate('WifiList');$this->set(compact('data'));
// the other model to load & useApp::uses('AnotherModel','Model');classMyModelextendsAppModel{public$name='MyModel';publicfunctiontest(){// load the Model$anotherModel=newAnotherModel();// use the Model$anotherModel->save($data);}}