findæ¡ä»¶ã¨ããunbindModelã®ã¡ã¢
èªåç¨ã¡ã¢
findã®æ¡ä»¶ã§current_date使ãå ´åãé åã®ãã¼ãæå®ããã«ãå¤ã«å ¨é¨å ¥ãã
<php $field = array( 'id' ); $cond = array( 'activeid' => $id, 'status' => 1, 'activeid_expire >= current_date' ); $result = $this->find( 'first', array( 'conditions' => $cond, 'fields' => $field ) );
Findã®æ¡ä»¶æå®ã¯ä¸è¨ã«è²ã
ã¨æ¸ãã¦ãã
http://book.cakephp.org/ja/view/74/Complex-Find-Conditions
findã®ç¬¬1å¼æ°ã§æå®ã§ãããã®
(all / first / count / neighbors / list / threaded )
unbindModelã«ã¤ãã¦
hasManyã¨ããã¦ãå ´åãå¿ è¦ãªããã°ä¸æçã«ã¢ã½ã·ã¨ã¼ã·ã§ã³ãã¯ãã(ä¸è¨ã¯modelå ã®ã¡ã½ããã§å®è¡ããå ´å)
<?php $this->unbindModel(array('hasMany'=>array('Post')));
ä¸æçãããªãã¦æä¹ çã«ã¢ã½ã·ã¨ã¼ã·ã§ã³ãã¯ããå ´åã¯ã第2å¼æ°ã«falseãæå®ãã
<?php $this->unbindModel(array('hasMany'=>array('Post')),false);