예제 #1
0
파일: album.php 프로젝트: uzura8/flockbird
 public static function _init()
 {
     static::$_properties['name']['label'] = term('album') . '名';
     static::$_properties['public_flag']['form'] = \Site_Form::get_public_flag_configs();
     static::$_properties['public_flag']['validation']['in_array'][] = \Site_Util::get_public_flags();
     static::$_properties['foreign_table']['validation']['in_array'][] = Site_Util::get_album_foreign_tables();
     if (is_enabled('notice')) {
         static::$_observers['MyOrm\\Observer_DeleteNotice'] = array('events' => array('before_delete'), 'conditions' => array('foreign_table' => array('album' => 'value'), 'foreign_id' => array('id' => 'property')));
     }
     if (\Module::loaded('timeline')) {
         // 更新時に timeline の sort_datetime を更新
         $observer_key = \Config::get('timeline.types.album');
         static::$_observers['MyOrm\\Observer_UpdateRelationalTables'] = array('events' => array('after_update'), 'relations' => array('model_to' => '\\Timeline\\Model_Timeline', 'conditions' => array('foreign_table' => array('album' => 'value'), 'foreign_id' => array('id' => 'property'), 'type' => array($observer_key => 'value')), 'check_changed' => array('check_properties' => array('name', 'body', 'public_flag')), 'update_properties' => array('sort_datetime' => array('updated_at' => 'property'))));
         if (\Config::get('timeline.articles.cache.is_use')) {
             static::$_observers['MyOrm\\Observer_ExecuteToRelations'] = array('events' => array('after_update'), 'relations' => array('model_to' => '\\Timeline\\Model_Timeline', 'execute_func' => array('method' => '\\Timeline\\Site_Util::delete_cache', 'params' => array('id' => 'property')), 'conditions' => array('foreign_table' => array('album' => 'value'), 'foreign_id' => array('id' => 'property'))));
         }
     }
 }