Completed
Push — master ( 1dd400...cdfa80 )
by Alexey
04:26
created
system/Inji/Model.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
             $relModel = $relations[$colInfo['colParams']['relation']]['model'];
210 210
             $relModel = strpos($relModel, '\\') === 0 ? substr($relModel, 1) : $relModel;
211 211
             if ($manageHref) {
212
-              $value = $relValue ? "<a href='/admin/" . str_replace('\\', '/view/', $relModel) . "/" . $relValue->pk() . "'>" . $relValue->name() . "</a>" : 'Не задано';
212
+              $value = $relValue ? "<a href='/admin/".str_replace('\\', '/view/', $relModel)."/".$relValue->pk()."'>".$relValue->name()."</a>" : 'Не задано';
213 213
             } else {
214 214
               $value = $relValue ? $relValue->name() : 'Не задано';
215 215
             }
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
       case 'image':
220 220
         $file = Files\File::get($item->$colName);
221 221
         if ($file) {
222
-          $value = '<img src="' . $file->path . '?resize=60x120" />';
222
+          $value = '<img src="'.$file->path.'?resize=60x120" />';
223 223
         } else {
224 224
           $value = '<img src="/static/system/images/no-image.png?resize=60x120" />';
225 225
         }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
       case 'file':
228 228
         $file = Files\File::get($item->$colName);
229 229
         if ($file) {
230
-          $value = '<a href="' . $file->path . '">' . $file->name . '.' . $file->type->ext . '</a>';
230
+          $value = '<a href="'.$file->path.'">'.$file->name.'.'.$file->type->ext.'</a>';
231 231
         } else {
232 232
           $value = 'Файл не загружен';
233 233
         }
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
       case 'map':
244 244
         if ($item->$colName && json_decode($item->$colName, true)) {
245 245
           $addres = json_decode($item->$colName, true);
246
-          $name = $addres['address'] ? $addres['address'] : 'lat:' . $addres['lat'] . ': lng:' . $addres['lng'];
246
+          $name = $addres['address'] ? $addres['address'] : 'lat:'.$addres['lat'].': lng:'.$addres['lng'];
247 247
           \App::$cur->libs->loadLib('yandexMap');
248 248
           ob_start();
249 249
           $uid = Tools::randomString();
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
           <?php
276 276
           $content = ob_get_contents();
277 277
           ob_end_clean();
278
-          $onclick = 'inji.Ui.modals.show("' . addcslashes($addres['address'], '"') . '", $("#map' . $uid . '_container script").html().replace(/^\/\*/g, "").replace(/\*\/$/g, "")+"</script>","mapmodal' . $uid . '","modal-lg");';
278
+          $onclick = 'inji.Ui.modals.show("'.addcslashes($addres['address'], '"').'", $("#map'.$uid.'_container script").html().replace(/^\/\*/g, "").replace(/\*\/$/g, "")+"</script>","mapmodal'.$uid.'","modal-lg");';
279 279
           $onclick .= 'return false;';
280 280
           $value = "<a href ='#' onclick='{$onclick}' >{$name}</a>";
281 281
           $value .= $content;
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
                 case 'map':
316 316
                   if ($item->$colName && json_decode($item->$colName, true)) {
317 317
                     $addres = json_decode($item->$colName, true);
318
-                    $name = $addres['address'] ? $addres['address'] : 'lat:' . $addres['lat'] . ': lng:' . $addres['lng'];
318
+                    $name = $addres['address'] ? $addres['address'] : 'lat:'.$addres['lat'].': lng:'.$addres['lng'];
319 319
                     \App::$cur->libs->loadLib('yandexMap');
320 320
                     ob_start();
321 321
                     $uid = Tools::randomString();
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
                     <?php
348 348
                     $content = ob_get_contents();
349 349
                     ob_end_clean();
350
-                    $onclick = 'inji.Ui.modals.show("' . addcslashes($addres['address'], '"') . '", $("#map' . $uid . '_container script").html().replace(/^\/\*/g, "").replace(/\*\/$/g, "")+"</script>","mapmodal' . $uid . '","modal-lg");';
350
+                    $onclick = 'inji.Ui.modals.show("'.addcslashes($addres['address'], '"').'", $("#map'.$uid.'_container script").html().replace(/^\/\*/g, "").replace(/\*\/$/g, "")+"</script>","mapmodal'.$uid.'","modal-lg");';
351 351
                     $onclick .= 'return false;';
352 352
                     $value = "<a href ='#' onclick='{$onclick}' >{$name}</a>";
353 353
                     $value .= $content;
@@ -387,12 +387,12 @@  discard block
 block discarded – undo
387 387
       return;
388 388
     }
389 389
     if (!is_array($array)) {
390
-      if (!isset($cols[static::colPrefix() . $array]) && isset(static::$cols[$array])) {
390
+      if (!isset($cols[static::colPrefix().$array]) && isset(static::$cols[$array])) {
391 391
         static::createCol($array);
392 392
         $cols = static::cols(true);
393 393
       }
394
-      if (!isset($cols[$array]) && isset($cols[static::colPrefix() . $array])) {
395
-        $array = static::colPrefix() . $array;
394
+      if (!isset($cols[$array]) && isset($cols[static::colPrefix().$array])) {
395
+        $array = static::colPrefix().$array;
396 396
       } else {
397 397
         static::checkForJoin($array, $rootModel);
398 398
       }
@@ -401,14 +401,14 @@  discard block
 block discarded – undo
401 401
     switch ($searchtype) {
402 402
       case 'key':
403 403
         foreach ($array as $key => $item) {
404
-          if (!isset($cols[static::colPrefix() . $key]) && isset(static::$cols[$key])) {
404
+          if (!isset($cols[static::colPrefix().$key]) && isset(static::$cols[$key])) {
405 405
             static::createCol($key);
406 406
             $cols = static::cols(true);
407 407
           }
408
-          if (!isset($cols[$key]) && isset($cols[static::colPrefix() . $key])) {
409
-            $array[static::colPrefix() . $key] = $item;
408
+          if (!isset($cols[$key]) && isset($cols[static::colPrefix().$key])) {
409
+            $array[static::colPrefix().$key] = $item;
410 410
             unset($array[$key]);
411
-            $key = static::colPrefix() . $key;
411
+            $key = static::colPrefix().$key;
412 412
           }
413 413
           if (is_array($array[$key])) {
414 414
             static::fixPrefix($array[$key], 'key', $rootModel);
@@ -419,12 +419,12 @@  discard block
 block discarded – undo
419 419
         break;
420 420
       case 'first':
421 421
         if (isset($array[0]) && is_string($array[0])) {
422
-          if (!isset($cols[static::colPrefix() . $array[0]]) && isset(static::$cols[$array[0]])) {
422
+          if (!isset($cols[static::colPrefix().$array[0]]) && isset(static::$cols[$array[0]])) {
423 423
             static::createCol($array[0]);
424 424
             $cols = static::cols(true);
425 425
           }
426
-          if (!isset($cols[$array[0]]) && isset($cols[static::colPrefix() . $array[0]])) {
427
-            $array[0] = static::colPrefix() . $array[0];
426
+          if (!isset($cols[$array[0]]) && isset($cols[static::colPrefix().$array[0]])) {
427
+            $array[0] = static::colPrefix().$array[0];
428 428
           } else {
429 429
             static::checkForJoin($array[0], $rootModel);
430 430
           }
@@ -456,11 +456,11 @@  discard block
 block discarded – undo
456 456
       $changes_text = [];
457 457
       foreach ($this->_changedParams as $fullColName => $oldValue) {
458 458
         $colName = substr($fullColName, strlen($class::colPrefix()));
459
-        if(isset($class::$cols[$colName]['logging']) && !$class::$cols[$colName]['logging']){
459
+        if (isset($class::$cols[$colName]['logging']) && !$class::$cols[$colName]['logging']) {
460 460
           continue;
461 461
         }
462 462
         if (strlen($oldValue) + strlen($this->_params[$fullColName]) < 200) {
463
-          $changes_text[] = (!empty($class::$labels[$colName]) ? $class::$labels[$colName] : $colName) . ": \"{$oldValue}\" => \"{$this->$colName}\"";
463
+          $changes_text[] = (!empty($class::$labels[$colName]) ? $class::$labels[$colName] : $colName).": \"{$oldValue}\" => \"{$this->$colName}\"";
464 464
         } else {
465 465
           $changes_text[] = !empty($class::$labels[$colName]) ? $class::$labels[$colName] : $colName;
466 466
         }
@@ -512,13 +512,13 @@  discard block
 block discarded – undo
512 512
           case 'to':
513 513
             $relCol = $relations[$rel]['col'];
514 514
             static::fixPrefix($relCol);
515
-            $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
515
+            $rootModel::$relJoins[$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol];
516 516
             break;
517 517
           case 'one':
518 518
           case 'many':
519 519
             $relCol = $relations[$rel]['col'];
520 520
             $relations[$rel]['model']::fixPrefix($relCol);
521
-            $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
521
+            $rootModel::$relJoins[$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), static::index().' = '.$relCol];
522 522
             break;
523 523
         }
524 524
         $relations[$rel]['model']::fixPrefix($col, 'key', $rootModel);
@@ -557,13 +557,13 @@  discard block
 block discarded – undo
557 557
             $relCol = $relations[$rel]['col'];
558 558
             static::fixPrefix($relCol);
559 559
             //$info['modelName'] = $relations[$rel]['model'];
560
-            $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
560
+            $info['joins'][$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol];
561 561
             break;
562 562
           case 'one':
563 563
             $relCol = $relations[$rel]['col'];
564 564
             $relations[$rel]['model']::fixPrefix($relCol);
565 565
             //$info['modelName'] = $relations[$rel]['model'];
566
-            $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
566
+            $info['joins'][$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), static::index().' = '.$relCol];
567 567
             break;
568 568
         }
569 569
         $info = $relations[$rel]['model']::parseColRecursion($info);
@@ -581,8 +581,8 @@  discard block
 block discarded – undo
581 581
       } else {
582 582
         $info['colParams'] = [];
583 583
       }
584
-      if (!isset($cols[$info['col']]) && isset($cols[static::colPrefix() . $info['col']])) {
585
-        $info['col'] = static::colPrefix() . $info['col'];
584
+      if (!isset($cols[$info['col']]) && isset($cols[static::colPrefix().$info['col']])) {
585
+        $info['col'] = static::colPrefix().$info['col'];
586 586
       }
587 587
       $info['modelName'] = get_called_class();
588 588
     }
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
     if ($params === false) {
690 690
       return false;
691 691
     }
692
-    return App::$cur->db->addCol(static::table(), static::colPrefix() . $colName, $params);
692
+    return App::$cur->db->addCol(static::table(), static::colPrefix().$colName, $params);
693 693
   }
694 694
 
695 695
   public static function createTable() {
@@ -718,28 +718,28 @@  discard block
 block discarded – undo
718 718
       return true;
719 719
     }
720 720
     $cols = [
721
-        $colPrefix . 'id' => 'pk'
721
+        $colPrefix.'id' => 'pk'
722 722
     ];
723 723
     $className = get_called_class();
724 724
     if (!empty($className::$cols)) {
725 725
       foreach ($className::$cols as $colName => $colParams) {
726 726
         if ($colName == 'date_create') {
727
-          $cols[$colPrefix . 'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP';
727
+          $cols[$colPrefix.'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP';
728 728
           continue;
729 729
         }
730 730
         $params = $className::genColParams($colName);
731 731
         if ($params) {
732
-          $cols[$colPrefix . $colName] = $params;
732
+          $cols[$colPrefix.$colName] = $params;
733 733
         }
734 734
       }
735 735
     }
736
-    if (empty($cols[$colPrefix . 'date_create'])) {
737
-      $cols[$colPrefix . 'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP';
736
+    if (empty($cols[$colPrefix.'date_create'])) {
737
+      $cols[$colPrefix.'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP';
738 738
     }
739 739
     $tableIndexes = [];
740 740
     if ($indexes) {
741 741
       foreach ($indexes as $indexName => $index) {
742
-        $tableIndexes[] = $index['type'] . ' ' . App::$cur->db->table_prefix . $indexName . ' (' . implode(',', $index['cols']) . ')';
742
+        $tableIndexes[] = $index['type'].' '.App::$cur->db->table_prefix.$indexName.' ('.implode(',', $index['cols']).')';
743 743
       }
744 744
     }
745 745
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
    */
764 764
   public static function index() {
765 765
 
766
-    return static::colPrefix() . 'id';
766
+    return static::colPrefix().'id';
767 767
   }
768 768
 
769 769
   /**
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
   public static function colPrefix() {
775 775
     $classPath = explode('\\', get_called_class());
776 776
     $classPath = array_slice($classPath, 1);
777
-    return strtolower(implode('_', $classPath)) . '_';
777
+    return strtolower(implode('_', $classPath)).'_';
778 778
   }
779 779
 
780 780
   /**
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
    * @return string
809 809
    */
810 810
   public function name() {
811
-    return $this->{$this->nameCol()} ? $this->{$this->nameCol()} : '№' . $this->pk();
811
+    return $this->{$this->nameCol()} ? $this->{$this->nameCol()} : '№'.$this->pk();
812 812
   }
813 813
 
814 814
   /**
@@ -842,12 +842,12 @@  discard block
 block discarded – undo
842 842
           case 'to':
843 843
             $relCol = $relations[$rel]['col'];
844 844
             static::fixPrefix($relCol);
845
-            App::$cur->db->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol);
845
+            App::$cur->db->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol);
846 846
             break;
847 847
           case 'one':
848 848
             $col = $relations[$rel]['col'];
849 849
             $relations[$rel]['model']::fixPrefix($col);
850
-            App::$cur->db->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col);
850
+            App::$cur->db->join($relations[$rel]['model']::table(), static::index().' = '.$col);
851 851
             break;
852 852
         }
853 853
       }
@@ -862,8 +862,8 @@  discard block
 block discarded – undo
862 862
       }
863 863
       if ($param !== null) {
864 864
         $cols = static::cols();
865
-        if (!isset($cols[$col]) && isset($cols[static::colPrefix() . $col])) {
866
-          $col = static::colPrefix() . $col;
865
+        if (!isset($cols[$col]) && isset($cols[static::colPrefix().$col])) {
866
+          $col = static::colPrefix().$col;
867 867
         }
868 868
         App::$cur->db->where($col, $param);
869 869
       } else {
@@ -927,12 +927,12 @@  discard block
 block discarded – undo
927 927
           case 'to':
928 928
             $relCol = $relations[$rel]['col'];
929 929
             static::fixPrefix($relCol);
930
-            $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol);
930
+            $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol);
931 931
             break;
932 932
           case 'one':
933 933
             $col = $relations[$rel]['col'];
934 934
             $relations[$rel]['model']::fixPrefix($col);
935
-            $query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col);
935
+            $query->join($relations[$rel]['model']::table(), static::index().' = '.$col);
936 936
             break;
937 937
         }
938 938
       }
@@ -1254,12 +1254,12 @@  discard block
 block discarded – undo
1254 1254
           case 'to':
1255 1255
             $relCol = $relations[$rel]['col'];
1256 1256
             static::fixPrefix($relCol);
1257
-            $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol);
1257
+            $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol);
1258 1258
             break;
1259 1259
           case 'one':
1260 1260
             $col = $relations[$rel]['col'];
1261 1261
             $relations[$rel]['model']::fixPrefix($col);
1262
-            $query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col);
1262
+            $query->join($relations[$rel]['model']::table(), static::index().' = '.$col);
1263 1263
             break;
1264 1264
         }
1265 1265
       }
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
     } else {
1277 1277
       $cols .= '*';
1278 1278
     }
1279
-    $cols .=') as `count`' . (!empty($options['cols']) ? ',' . $options['cols'] : '');
1279
+    $cols .= ') as `count`'.(!empty($options['cols']) ? ','.$options['cols'] : '');
1280 1280
     $query->cols = $cols;
1281 1281
     if (!empty($options['group'])) {
1282 1282
       $query->group($options['group']);
@@ -1409,25 +1409,25 @@  discard block
 block discarded – undo
1409 1409
     $itemModel = $class::$treeCategory;
1410 1410
     $oldPath = $this->tree_path;
1411 1411
     $this->tree_path = $this->getCatalogTree($this);
1412
-    $itemsTable = \App::$cur->db->table_prefix . $itemModel::table();
1413
-    $itemTreeCol = $itemModel::colPrefix() . 'tree_path';
1412
+    $itemsTable = \App::$cur->db->table_prefix.$itemModel::table();
1413
+    $itemTreeCol = $itemModel::colPrefix().'tree_path';
1414 1414
 
1415
-    $categoryTreeCol = $this->colPrefix() . 'tree_path';
1416
-    $categoryTable = \App::$cur->db->table_prefix . $this->table();
1415
+    $categoryTreeCol = $this->colPrefix().'tree_path';
1416
+    $categoryTable = \App::$cur->db->table_prefix.$this->table();
1417 1417
     if ($oldPath) {
1418 1418
       \App::$cur->db->query('UPDATE
1419
-                ' . $categoryTable . ' 
1419
+                ' . $categoryTable.' 
1420 1420
                     SET 
1421
-                        ' . $categoryTreeCol . ' = REPLACE(' . $categoryTreeCol . ', "' . $oldPath . $this->id . '/' . '", "' . $this->tree_path . $this->id . '/' . '") 
1422
-                    WHERE ' . $categoryTreeCol . ' LIKE "' . $oldPath . $this->id . '/' . '%"');
1421
+                        ' . $categoryTreeCol.' = REPLACE('.$categoryTreeCol.', "'.$oldPath.$this->id.'/'.'", "'.$this->tree_path.$this->id.'/'.'") 
1422
+                    WHERE ' . $categoryTreeCol.' LIKE "'.$oldPath.$this->id.'/'.'%"');
1423 1423
 
1424 1424
       \App::$cur->db->query('UPDATE
1425
-                ' . $itemsTable . '
1425
+                ' . $itemsTable.'
1426 1426
                     SET 
1427
-                        ' . $itemTreeCol . ' = REPLACE(' . $itemTreeCol . ', "' . $oldPath . $this->id . '/' . '", "' . $this->tree_path . $this->id . '/' . '") 
1428
-                    WHERE ' . $itemTreeCol . ' LIKE "' . $oldPath . $this->id . '/' . '%"');
1427
+                        ' . $itemTreeCol.' = REPLACE('.$itemTreeCol.', "'.$oldPath.$this->id.'/'.'", "'.$this->tree_path.$this->id.'/'.'") 
1428
+                    WHERE ' . $itemTreeCol.' LIKE "'.$oldPath.$this->id.'/'.'%"');
1429 1429
     }
1430
-    $itemModel::update([$itemTreeCol => $this->tree_path . $this->id . '/'], [$itemModel::colPrefix() . $this->index(), $this->id]);
1430
+    $itemModel::update([$itemTreeCol => $this->tree_path.$this->id.'/'], [$itemModel::colPrefix().$this->index(), $this->id]);
1431 1431
   }
1432 1432
 
1433 1433
   /**
@@ -1441,9 +1441,9 @@  discard block
 block discarded – undo
1441 1441
     $catalogParent = $catalogClass::get($catalog->parent_id);
1442 1442
     if ($catalog && $catalogParent) {
1443 1443
       if ($catalogParent->tree_path) {
1444
-        return $catalogParent->tree_path . $catalogParent->id . '/';
1444
+        return $catalogParent->tree_path.$catalogParent->id.'/';
1445 1445
       } else {
1446
-        return $this->getCatalogTree($catalogParent) . $catalogParent->id . '/';
1446
+        return $this->getCatalogTree($catalogParent).$catalogParent->id.'/';
1447 1447
       }
1448 1448
     }
1449 1449
     return '/';
@@ -1457,7 +1457,7 @@  discard block
 block discarded – undo
1457 1457
     $categoryModel = $class::$categoryModel;
1458 1458
     $category = $categoryModel::get($this->{$categoryModel::index()});
1459 1459
     if ($category) {
1460
-      $this->tree_path = $category->tree_path . $category->pk() . '/';
1460
+      $this->tree_path = $category->tree_path.$category->pk().'/';
1461 1461
     } else {
1462 1462
       $this->tree_path = '/';
1463 1463
     }
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
       $this->changeCategoryTree();
1483 1483
     }
1484 1484
     if (!empty($this->_changedParams) && $this->pk()) {
1485
-      Inji::$inst->event('modelItemParamsChanged-' . get_called_class(), $this);
1485
+      Inji::$inst->event('modelItemParamsChanged-'.get_called_class(), $this);
1486 1486
     }
1487 1487
     $this->beforeSave();
1488 1488
     $values = [];
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
     }
1528 1528
     $this->_params = $result->fetch();
1529 1529
     if ($new) {
1530
-      Inji::$inst->event('modelCreatedItem-' . get_called_class(), $this);
1530
+      Inji::$inst->event('modelCreatedItem-'.get_called_class(), $this);
1531 1531
     }
1532 1532
     $this->afterSave();
1533 1533
     return $this->{$this->index()};
@@ -1665,7 +1665,7 @@  discard block
 block discarded – undo
1665 1665
     static::fixPrefix($params);
1666 1666
     $className = get_called_class();
1667 1667
     foreach ($params as $paramName => $value) {
1668
-      $shortName = preg_replace('!' . $this->colPrefix() . '!', '', $paramName);
1668
+      $shortName = preg_replace('!'.$this->colPrefix().'!', '', $paramName);
1669 1669
       if (!empty($className::$cols[$shortName])) {
1670 1670
         switch ($className::$cols[$shortName]['type']) {
1671 1671
           case 'decimal':
@@ -1942,7 +1942,7 @@  discard block
 block discarded – undo
1942 1942
   public function __set($name, $value) {
1943 1943
     static::fixPrefix($name);
1944 1944
     $className = get_called_class();
1945
-    $shortName = preg_replace('!' . $this->colPrefix() . '!', '', $name);
1945
+    $shortName = preg_replace('!'.$this->colPrefix().'!', '', $name);
1946 1946
     if (!empty($className::$cols[$shortName])) {
1947 1947
       switch ($className::$cols[$shortName]['type']) {
1948 1948
         case 'decimal':
Please login to merge, or discard this patch.