/** * ファイル名をフリマ画像情報に登録する * * @access private * @param object $fleamarket フリマ情報 * @param array $files フリマ画像情報 * @return void * @author kobayashi */ private function registerFleamarketImage($fleamarket, $files) { foreach ($files as $file) { $matches = array(); if (preg_match('/^upload(\\d+)$/', $file['field'], $matches)) { $priority = $matches[1]; $data = array('fleamarket_id' => $fleamarket->fleamarket_id, 'file_name' => $file['saved_as'], 'priority' => $priority); $fleamarket_image = \Model_Fleamarket_Image::query()->where('fleamarket_id', $fleamarket->fleamarket_id)->where('priority', $priority)->get_one(); $administrator_id = $this->administrator->administrator_id; if ($fleamarket_image) { $data['updated_user'] = $administrator_id; } else { $fleamarket_image = \Model_Fleamarket_Image::forge(array('fleamarket_id' => $fleamarket->fleamarket_id, 'priority' => $priority)); $data['created_user'] = $administrator_id; } $fleamarket_image->set($data)->save(); } } }
/** * フリマイメージ画像情報を削除する * * @access private * @param mixed $fleamarket_id フリマID * @return object Fieldsetオブジェクト * @author ida */ private function deleteFleamarketImage($fleamarket_id) { $delete_image = \Session::get_flash('delete_image'); if (!$delete_image) { return null; } foreach ($delete_image as $key => $priority) { $fleamarket_image = \Model_Fleamarket_Image::query()->where('fleamarket_id', $fleamarket_id)->where('priority', $priority)->get_one(); $fleamarket_image->delete(); } }