コード例 #1
0
ファイル: orm.php プロジェクト: uzura8/flockbird
 public static function check_properties_updated(\Orm\Model $obj, $check_properties)
 {
     if (empty($check_properties)) {
         return false;
     }
     $check_properties = (array) $check_properties;
     foreach ($check_properties as $key => $property) {
         if (is_array($property)) {
             $conditions = $property;
             $property = $key;
             foreach ($conditions as $condition => $value) {
                 if (!$obj->is_changed($property)) {
                     continue;
                 }
                 if ($condition == 'ignore_property') {
                     if ($obj->is_changed($value)) {
                         continue;
                     }
                     return true;
                 }
                 if ($condition == 'ignore_value') {
                     list($before, $after) = \Util_Orm::get_changed_values($obj, $property);
                     if ($value == 'reduced_public_flag_range') {
                         if (Site_Util::check_is_reduced_public_flag_range($before, $after)) {
                             continue;
                         }
                     } elseif ($value == 'reduced_num') {
                         if (preg_match('/`' . $property . '`\\s+\\-\\s+1/', $after)) {
                             continue;
                         }
                         if (is_numeric($before) && is_numeric($after) && $before > $after) {
                             continue;
                         }
                     }
                     return true;
                 }
             }
         } else {
             if ($obj->is_changed($property)) {
                 return true;
             }
         }
     }
     return false;
 }