【PHP】フレームワーク CakePHP 8ホール目【1.3】
■ このスレッドは過去ログ倉庫に格納されています
0818名無しさん@そうだ選挙に行こう
2010/07/10(土) 16:37:18ID:v/ICs0IKP82-84 バリデーションルールの追加で
var $validate = array(
'from' => array(
'date_format' => array('rule' => array('datetime'), 'required' => true),
'compare_from_to'=> array('rule' => array('compareFromTo')),
'not_duplicate_schedule' => array('rule' => array('isDuplicate'))
中省略
function isDuplicate($value) {
$from = $this->data[$this->name]['from'];
$to = $this->data[$this->name]['to'];
$conditions = array('or' => array(
array("from BETWEEN ? AND ?" => array($from, $to)),
array("to BETWEEN ? AND ?" => array($from, $to))
));
if($this->id) {
$conditions[$this->alias . '.' . $this->primaryKey] = '!= '.$this->id;
}
$count = $this->find('count', compact('conditions'));
return $count == 0;
}
この中の $conditions[$this->alias . '.' . $this->primaryKey] = '!= '.$this->id; で
aliasとは何が入るのでしょう? 漠然と同レコードのIDを排除して比較してるような
気はしますが、$condtionsの2番目配列には何がはいるのでしょうか?
■ このスレッドは過去ログ倉庫に格納されています