if (!empty($this->data)) {
+ // 新hasProfile処理
+ if ($this->data['CharactersHasProfile']) {
+ foreach ($this->data['CharactersHasProfile'] as $k => $v) {
+ // 空の値は保存しない
+ if (empty($v['value'])) {
+ unset($this->data['CharactersHasProfile'][$k]);
+ continue;
+ }
+
+ // select設定のvalue
+ if (isset($v['profile_select_id'])) {
+ $this->data['CharactersHasProfile'][$k]['value'] = null;
+ }
+ }
+ }
+
/* validate */
$this->Character->CharactersHasProfile->validate['profile_id']['validProfileId'] = array(
'rule' => array('validProfileId', $character['System']['id']),
'allowEmpty' => true,
);
+ /* validate */
if ($this->Character->saveAll($this->data, array('validate' => 'only'))) {
- /* 空のProfile設定削除 */
- if (isset($this->data['CharactersHasProfile'])) {
- foreach ($this->data['CharactersHasProfile'] as $k => $v) {
- if (empty($v['value'])) {
- unset($this->data['CharactersHasProfile'][$k]);
- continue;
- }
- if (isset($v['profile_select_id'])) {
- $this->data['CharactersHasProfile'][$k]['value'] = null;
- }
-
- }
- }
-
// 現在のhas_profiles削除
$this->Character->CharactersHasProfile->deleteAll(array(
'CharactersHasProfile.character_id' => $id
));
- /* 保存 */
+ /* データ保存 */
$this->data['Character']['id'] = $id;
+ $this->Character->create();
+
if ($this->Character->saveAll($this->data, array(
'validate' => false,
- 'atomic' => true,
- 'fieldList' => array_merge($this->Character->fields['edit'], $this->Character->CharactersHasProfile->fields['add'])))) {
- $this->Session->setFlash(__('The Character has been saved', true));
+ 'fieldList' => array_merge(
+ $this->Character->fields['edit'],
+ $this->Character->CharactersHasProfile->fields['add']
+ )
+ ))) {
+ $this->Session->setFlash(__('The Character has been saved.', true));
$this->redirect(array('action'=>'view', $id));
- } else {
- $this->Session->setFlash(__('The Character could not be saved. Please, try again.', true));
}
}
$this->data['Character']['id'] = $id;
}
}
-?>
+
);
var $fields = array(
- 'add' => array('name', 'system_id', 'sort_order', 'status', 'public_flag', 'user_id', 'detail'),
- 'edit' => array('Character.name', 'Character.sort_order', 'Character.status', 'Character.public_flag', 'Character.detail'),
+ 'add' => array('name', 'system_id', 'sort_order', 'status', 'public_flag', 'user_id', 'notes'),
+ 'edit' => array('name', 'sort_order', 'status', 'public_flag', 'notes'),
'escape' => array(
'name' => array(
'html' => true,
var $name = 'CharactersHasProfile';
var $fields = array(
- 'add' => array('CharactersHasProfile.profile_id', 'CharactersHasProfile.profile_select_id', 'CharactersHasProfile.profile_table_id', 'CharactersHasProfile.value', 'CharactersHasProfile.public_flag', 'CharactersHasProfile.link_value'), // Character\98A\8cg\91Î\89\9e
+ 'add' => array('character_id', 'profile_id', 'profile_select_id', 'profile_table_id', 'value', 'public_flag', 'link_value'),
'escape' => array(
'value' => array(
'html' => true,