Esempio n. 1
0
 public function delete_with_relations()
 {
     // album_image の削除
     if (\Module::loaded('album') && ($album_images = Model_NoteAlbumImage::get_album_image4note_id($this->id))) {
         $album_image_ids = array();
         foreach ($album_images as $album_image) {
             $album_image_ids[] = $album_image->id;
         }
         \Album\Model_AlbumImage::delete_multiple($album_image_ids);
     }
     // timeline 投稿の削除
     if (\Module::loaded('timeline')) {
         \Timeline\Model_Timeline::delete4foreign_table_and_foreign_ids('note', $this->id);
     }
     // note の削除
     $this->delete();
 }
Esempio n. 2
0
 public function delete_with_album_image($member_id)
 {
     $album_image_ids = array();
     $deleted_files = null;
     if (Site_Util::check_type($this->type, 'album_image_timeline')) {
         try {
             $album = \Album\Model_Album::check_authority($this->foreign_id, $member_id);
         } catch (\FuelException $e) {
             $album = null;
         }
         $album_image_ids = $album ? Model_TimelineChildData::get_foreign_ids4timeline_id($this->id) : null;
     }
     if ($album_image_ids) {
         \Album\Model_AlbumImage::delete_multiple($album_image_ids);
     }
     $this->delete();
 }