Gallery model
var $validate = array(
'id' => array('rule' => 'numeric', 'required' => true, 'allowEmpty' => false, 'on' => 'update'),
'name' => array('rule' => 'notEmpty', 'required' => true, 'allowEmpty' => false, 'on' => 'create'),
'model' => array('rule' => 'notEmpty', 'required' => true, 'allowEmpty' => false, 'on' => 'create'),
'model_id' => array('rule' => 'numeric', 'required' => true, 'allowEmpty' => false, 'on' => 'create'),
'status' => array('rule' => array('inList', array('Draft', 'Publish')), 'message' => 'FAILED', 'allowEmpty' => false)
);
action controller
private function admin_edit() {
if (!empty($this->data['Gallery']['id'])) {
debug($this->data);
if ($this->Gallery->save($this->data)) {
}
debug($this->Gallery->invalidFields());
}
$this->redirect('/');
}
This is error , please help me
app\controllers\galleries_controller.php (line 149)
Array
(
[Gallery] => Array
(
[id] => 38
[name] => Chap 6
[status] => Publish
)
)
app\controllers\galleries_controller.php (line 153)
Array
(
[id] => This field cannot be left blank
)
why it error miss id when data have id field, MODEL dont use behavior, only ContainableBehavior