Completed
Push — master ( 57caab...071e5c )
by Marc
07:08 queued 03:44
created
core/console/commands/CrudController.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             
57 57
             if ($sqlTable == '?') {
58 58
                 foreach ($this->getSqlTablesArray() as $table) {
59
-                    $this->outputInfo("- " . $table);
59
+                    $this->outputInfo("- ".$table);
60 60
                 }
61 61
             }
62 62
             
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
                 case 'model':
154 154
 
155 155
                     if (!$extended) {
156
-                        $modelName = $modelName . 'NgRest';
157
-                        $item['file'] = $modelName . '.php';
156
+                        $modelName = $modelName.'NgRest';
157
+                        $item['file'] = $modelName.'.php';
158 158
                         $item['class'] = $modelName;
159 159
                     }
160 160
                     
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@
 block discarded – undo
207 207
                         'extended' => $extended,
208 208
                         'textFields' => $textFields,
209 209
                         'properties' => $properties,
210
-                    	'rules' => $this->generateRules($shema),
210
+                        'rules' => $this->generateRules($shema),
211 211
                     ]);
212 212
                     
213 213
                     break;
Please login to merge, or discard this patch.
core/console/commands/ModuleController.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -34,22 +34,22 @@  discard block
 block discarded – undo
34 34
             }
35 35
         }
36 36
         
37
-        $appModulesFolder = Yii::$app->basePath . DIRECTORY_SEPARATOR . 'modules';
38
-        $moduleFolder = $appModulesFolder . DIRECTORY_SEPARATOR . $moduleName;
37
+        $appModulesFolder = Yii::$app->basePath.DIRECTORY_SEPARATOR.'modules';
38
+        $moduleFolder = $appModulesFolder.DIRECTORY_SEPARATOR.$moduleName;
39 39
         
40 40
         if (file_exists($moduleFolder)) {
41
-            return $this->outputError("The folder " . $moduleFolder . " exists already.");
41
+            return $this->outputError("The folder ".$moduleFolder." exists already.");
42 42
         }
43 43
         
44 44
         $folders = [
45 45
             'basePath' => $moduleFolder,
46
-            'adminPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'admin',
47
-            'adminPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . 'aws',
48
-            'frontendPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend',
49
-            'blocksPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'blocks',
50
-            'blocksPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'controllers',
51
-            'blocksPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'views',
52
-            'modelsPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'models',
46
+            'adminPath' => $moduleFolder.DIRECTORY_SEPARATOR.'admin',
47
+            'adminPath' => $moduleFolder.DIRECTORY_SEPARATOR.'admin'.DIRECTORY_SEPARATOR.'aws',
48
+            'frontendPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend',
49
+            'blocksPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend'.DIRECTORY_SEPARATOR.'blocks',
50
+            'blocksPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend'.DIRECTORY_SEPARATOR.'controllers',
51
+            'blocksPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend'.DIRECTORY_SEPARATOR.'views',
52
+            'modelsPath' => $moduleFolder.DIRECTORY_SEPARATOR.'models',
53 53
         ];
54 54
 
55 55
         $vars = ['folders' => $folders, 'name' => $moduleName, 'ns' => 'app\\modules\\'.$moduleName];
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
         }
60 60
         
61 61
         $contents = [
62
-            $moduleFolder. DIRECTORY_SEPARATOR . 'README.md' => $this->view->render('@luya/console/commands/views/module/readme.php', $vars),
63
-            $moduleFolder. DIRECTORY_SEPARATOR . 'admin/Module.php' => $this->view->render('@luya/console/commands/views/module/adminmodule.php', $vars),
64
-            $moduleFolder. DIRECTORY_SEPARATOR . 'frontend/Module.php' => $this->view->render('@luya/console/commands/views/module/frontendmodule.php', $vars),
62
+            $moduleFolder.DIRECTORY_SEPARATOR.'README.md' => $this->view->render('@luya/console/commands/views/module/readme.php', $vars),
63
+            $moduleFolder.DIRECTORY_SEPARATOR.'admin/Module.php' => $this->view->render('@luya/console/commands/views/module/adminmodule.php', $vars),
64
+            $moduleFolder.DIRECTORY_SEPARATOR.'frontend/Module.php' => $this->view->render('@luya/console/commands/views/module/frontendmodule.php', $vars),
65 65
         ];
66 66
         
67 67
         foreach ($contents as $fileName => $content) {
Please login to merge, or discard this patch.
core/helpers/ArrayHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
         foreach ($array as $k => $v) {
51 51
             if (is_numeric($v)) {
52 52
                 if (is_float($v)) {
53
-                    $return[$k] = (float)$v;
53
+                    $return[$k] = (float) $v;
54 54
                 } else {
55
-                    $return[$k] = (int)$v;
55
+                    $return[$k] = (int) $v;
56 56
                 }
57 57
             } elseif (is_array($v)) {
58 58
                 $return[$k] = self::typeCast($v);
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     public static function search($array, $searchText, $sensitive = false)
93 93
     {
94 94
         $function = ($sensitive) ? 'strpos' : 'stripos';
95
-        return array_filter($array, function ($item) use ($searchText, $function) {
95
+        return array_filter($array, function($item) use ($searchText, $function) {
96 96
             $response = false;
97 97
             foreach ($item as $key => $value) {
98 98
                 if ($response) {
Please login to merge, or discard this patch.
core/console/commands/BaseCrudController.php 2 patches
Indentation   +182 added lines, -182 removed lines patch added patch discarded remove patch
@@ -16,191 +16,191 @@
 block discarded – undo
16 16
  */
17 17
 abstract class BaseCrudController extends Command
18 18
 {
19
-	public function getSqlTablesArray()
20
-	{
21
-		$names = Yii::$app->db->schema->tableNames;
19
+    public function getSqlTablesArray()
20
+    {
21
+        $names = Yii::$app->db->schema->tableNames;
22 22
 	
23
-		return array_combine($names, $names);
24
-	}
25
-	/**
26
-	 * Generates validation rules for the specified table.
27
-	 * @param \yii\db\TableSchema $table the table schema
28
-	 * @return array the generated validation rules
29
-	 */
30
-	public function generateRules($table)
31
-	{
32
-		$types = [];
33
-		$lengths = [];
34
-		foreach ($table->columns as $column) {
35
-			if ($column->autoIncrement) {
36
-				continue;
37
-			}
38
-			if (!$column->allowNull && $column->defaultValue === null) {
39
-				$types['required'][] = $column->name;
40
-			}
41
-			switch ($column->type) {
42
-				case Schema::TYPE_SMALLINT:
43
-				case Schema::TYPE_INTEGER:
44
-				case Schema::TYPE_BIGINT:
45
-					$types['integer'][] = $column->name;
46
-					break;
47
-				case Schema::TYPE_BOOLEAN:
48
-					$types['boolean'][] = $column->name;
49
-					break;
50
-				case Schema::TYPE_FLOAT:
51
-				case 'double': // Schema::TYPE_DOUBLE, which is available since Yii 2.0.3
52
-				case Schema::TYPE_DECIMAL:
53
-				case Schema::TYPE_MONEY:
54
-					$types['number'][] = $column->name;
55
-					break;
56
-				case Schema::TYPE_DATE:
57
-				case Schema::TYPE_TIME:
58
-				case Schema::TYPE_DATETIME:
59
-				case Schema::TYPE_TIMESTAMP:
60
-					$types['safe'][] = $column->name;
61
-					break;
62
-				default: // strings
63
-					if ($column->size > 0) {
64
-						$lengths[$column->size][] = $column->name;
65
-					} else {
66
-						$types['string'][] = $column->name;
67
-					}
68
-			}
69
-		}
70
-		$rules = [];
71
-		foreach ($types as $type => $columns) {
72
-			$rules[] = "[['" . implode("', '", $columns) . "'], '$type']";
73
-		}
74
-		foreach ($lengths as $length => $columns) {
75
-			$rules[] = "[['" . implode("', '", $columns) . "'], 'string', 'max' => $length]";
76
-		}
77
-		$db = $this->getDbConnection();
78
-		// Unique indexes rules
79
-		try {
80
-			$uniqueIndexes = $db->getSchema()->findUniqueIndexes($table);
81
-			foreach ($uniqueIndexes as $uniqueColumns) {
82
-				// Avoid validating auto incremental columns
83
-				if (!$this->isColumnAutoIncremental($table, $uniqueColumns)) {
84
-					$attributesCount = count($uniqueColumns);
85
-					if ($attributesCount === 1) {
86
-						$rules[] = "[['" . $uniqueColumns[0] . "'], 'unique']";
87
-					} elseif ($attributesCount > 1) {
88
-						$labels = array_intersect_key($this->generateLabels($table), array_flip($uniqueColumns));
89
-						$lastLabel = array_pop($labels);
90
-						$columnsList = implode("', '", $uniqueColumns);
91
-						$rules[] = "[['$columnsList'], 'unique', 'targetAttribute' => ['$columnsList'], 'message' => 'The combination of " . implode(', ', $labels) . " and $lastLabel has already been taken.']";
92
-					}
93
-				}
94
-			}
95
-		} catch (NotSupportedException $e) {
96
-			// doesn't support unique indexes information...do nothing
97
-		}
98
-		// Exist rules for foreign keys
99
-		foreach ($table->foreignKeys as $refs) {
100
-			$refTable = $refs[0];
101
-			$refTableSchema = $db->getTableSchema($refTable);
102
-			if ($refTableSchema === null) {
103
-				// Foreign key could point to non-existing table: https://github.com/yiisoft/yii2-gii/issues/34
104
-				continue;
105
-			}
106
-			$refClassName = $this->generateClassName($refTable);
107
-			unset($refs[0]);
108
-			$attributes = implode("', '", array_keys($refs));
109
-			$targetAttributes = [];
110
-			foreach ($refs as $key => $value) {
111
-				$targetAttributes[] = "'$key' => '$value'";
112
-			}
113
-			$targetAttributes = implode(', ', $targetAttributes);
114
-			$rules[] = "[['$attributes'], 'exist', 'skipOnError' => true, 'targetClass' => $refClassName::className(), 'targetAttribute' => [$targetAttributes]]";
115
-		}
116
-		return $rules;
117
-	}
23
+        return array_combine($names, $names);
24
+    }
25
+    /**
26
+     * Generates validation rules for the specified table.
27
+     * @param \yii\db\TableSchema $table the table schema
28
+     * @return array the generated validation rules
29
+     */
30
+    public function generateRules($table)
31
+    {
32
+        $types = [];
33
+        $lengths = [];
34
+        foreach ($table->columns as $column) {
35
+            if ($column->autoIncrement) {
36
+                continue;
37
+            }
38
+            if (!$column->allowNull && $column->defaultValue === null) {
39
+                $types['required'][] = $column->name;
40
+            }
41
+            switch ($column->type) {
42
+                case Schema::TYPE_SMALLINT:
43
+                case Schema::TYPE_INTEGER:
44
+                case Schema::TYPE_BIGINT:
45
+                    $types['integer'][] = $column->name;
46
+                    break;
47
+                case Schema::TYPE_BOOLEAN:
48
+                    $types['boolean'][] = $column->name;
49
+                    break;
50
+                case Schema::TYPE_FLOAT:
51
+                case 'double': // Schema::TYPE_DOUBLE, which is available since Yii 2.0.3
52
+                case Schema::TYPE_DECIMAL:
53
+                case Schema::TYPE_MONEY:
54
+                    $types['number'][] = $column->name;
55
+                    break;
56
+                case Schema::TYPE_DATE:
57
+                case Schema::TYPE_TIME:
58
+                case Schema::TYPE_DATETIME:
59
+                case Schema::TYPE_TIMESTAMP:
60
+                    $types['safe'][] = $column->name;
61
+                    break;
62
+                default: // strings
63
+                    if ($column->size > 0) {
64
+                        $lengths[$column->size][] = $column->name;
65
+                    } else {
66
+                        $types['string'][] = $column->name;
67
+                    }
68
+            }
69
+        }
70
+        $rules = [];
71
+        foreach ($types as $type => $columns) {
72
+            $rules[] = "[['" . implode("', '", $columns) . "'], '$type']";
73
+        }
74
+        foreach ($lengths as $length => $columns) {
75
+            $rules[] = "[['" . implode("', '", $columns) . "'], 'string', 'max' => $length]";
76
+        }
77
+        $db = $this->getDbConnection();
78
+        // Unique indexes rules
79
+        try {
80
+            $uniqueIndexes = $db->getSchema()->findUniqueIndexes($table);
81
+            foreach ($uniqueIndexes as $uniqueColumns) {
82
+                // Avoid validating auto incremental columns
83
+                if (!$this->isColumnAutoIncremental($table, $uniqueColumns)) {
84
+                    $attributesCount = count($uniqueColumns);
85
+                    if ($attributesCount === 1) {
86
+                        $rules[] = "[['" . $uniqueColumns[0] . "'], 'unique']";
87
+                    } elseif ($attributesCount > 1) {
88
+                        $labels = array_intersect_key($this->generateLabels($table), array_flip($uniqueColumns));
89
+                        $lastLabel = array_pop($labels);
90
+                        $columnsList = implode("', '", $uniqueColumns);
91
+                        $rules[] = "[['$columnsList'], 'unique', 'targetAttribute' => ['$columnsList'], 'message' => 'The combination of " . implode(', ', $labels) . " and $lastLabel has already been taken.']";
92
+                    }
93
+                }
94
+            }
95
+        } catch (NotSupportedException $e) {
96
+            // doesn't support unique indexes information...do nothing
97
+        }
98
+        // Exist rules for foreign keys
99
+        foreach ($table->foreignKeys as $refs) {
100
+            $refTable = $refs[0];
101
+            $refTableSchema = $db->getTableSchema($refTable);
102
+            if ($refTableSchema === null) {
103
+                // Foreign key could point to non-existing table: https://github.com/yiisoft/yii2-gii/issues/34
104
+                continue;
105
+            }
106
+            $refClassName = $this->generateClassName($refTable);
107
+            unset($refs[0]);
108
+            $attributes = implode("', '", array_keys($refs));
109
+            $targetAttributes = [];
110
+            foreach ($refs as $key => $value) {
111
+                $targetAttributes[] = "'$key' => '$value'";
112
+            }
113
+            $targetAttributes = implode(', ', $targetAttributes);
114
+            $rules[] = "[['$attributes'], 'exist', 'skipOnError' => true, 'targetClass' => $refClassName::className(), 'targetAttribute' => [$targetAttributes]]";
115
+        }
116
+        return $rules;
117
+    }
118 118
 	
119
-	/**
120
-	 * Generates a class name from the specified table name.
121
-	 * @param string $tableName the table name (which may contain schema prefix)
122
-	 * @param boolean $useSchemaName should schema name be included in the class name, if present
123
-	 * @return string the generated class name
124
-	 */
125
-	protected function generateClassName($tableName, $useSchemaName = null)
126
-	{
127
-		if (isset($this->classNames[$tableName])) {
128
-			return $this->classNames[$tableName];
129
-		}
130
-		$schemaName = '';
131
-		$fullTableName = $tableName;
132
-		if (($pos = strrpos($tableName, '.')) !== false) {
133
-			if (($useSchemaName === null && $this->useSchemaName) || $useSchemaName) {
134
-				$schemaName = substr($tableName, 0, $pos) . '_';
135
-			}
136
-			$tableName = substr($tableName, $pos + 1);
137
-		}
138
-		$db = $this->getDbConnection();
139
-		$patterns = [];
140
-		$patterns[] = "/^{$db->tablePrefix}(.*?)$/";
141
-		$patterns[] = "/^(.*?){$db->tablePrefix}$/";
142
-		if (strpos($this->tableName, '*') !== false) {
143
-			$pattern = $this->tableName;
144
-			if (($pos = strrpos($pattern, '.')) !== false) {
145
-				$pattern = substr($pattern, $pos + 1);
146
-			}
147
-			$patterns[] = '/^' . str_replace('*', '(\w+)', $pattern) . '$/';
148
-		}
149
-		$className = $tableName;
150
-		foreach ($patterns as $pattern) {
151
-			if (preg_match($pattern, $tableName, $matches)) {
152
-				$className = $matches[1];
153
-				break;
154
-			}
155
-		}
156
-		return $this->classNames[$fullTableName] = Inflector::id2camel($schemaName.$className, '_');
157
-	}
119
+    /**
120
+     * Generates a class name from the specified table name.
121
+     * @param string $tableName the table name (which may contain schema prefix)
122
+     * @param boolean $useSchemaName should schema name be included in the class name, if present
123
+     * @return string the generated class name
124
+     */
125
+    protected function generateClassName($tableName, $useSchemaName = null)
126
+    {
127
+        if (isset($this->classNames[$tableName])) {
128
+            return $this->classNames[$tableName];
129
+        }
130
+        $schemaName = '';
131
+        $fullTableName = $tableName;
132
+        if (($pos = strrpos($tableName, '.')) !== false) {
133
+            if (($useSchemaName === null && $this->useSchemaName) || $useSchemaName) {
134
+                $schemaName = substr($tableName, 0, $pos) . '_';
135
+            }
136
+            $tableName = substr($tableName, $pos + 1);
137
+        }
138
+        $db = $this->getDbConnection();
139
+        $patterns = [];
140
+        $patterns[] = "/^{$db->tablePrefix}(.*?)$/";
141
+        $patterns[] = "/^(.*?){$db->tablePrefix}$/";
142
+        if (strpos($this->tableName, '*') !== false) {
143
+            $pattern = $this->tableName;
144
+            if (($pos = strrpos($pattern, '.')) !== false) {
145
+                $pattern = substr($pattern, $pos + 1);
146
+            }
147
+            $patterns[] = '/^' . str_replace('*', '(\w+)', $pattern) . '$/';
148
+        }
149
+        $className = $tableName;
150
+        foreach ($patterns as $pattern) {
151
+            if (preg_match($pattern, $tableName, $matches)) {
152
+                $className = $matches[1];
153
+                break;
154
+            }
155
+        }
156
+        return $this->classNames[$fullTableName] = Inflector::id2camel($schemaName.$className, '_');
157
+    }
158 158
 	
159
-	/**
160
-	 * Checks if any of the specified columns is auto incremental.
161
-	 * @param \yii\db\TableSchema $table the table schema
162
-	 * @param array $columns columns to check for autoIncrement property
163
-	 * @return boolean whether any of the specified columns is auto incremental.
164
-	 */
165
-	protected function isColumnAutoIncremental($table, $columns)
166
-	{
167
-		foreach ($columns as $column) {
168
-			if (isset($table->columns[$column]) && $table->columns[$column]->autoIncrement) {
169
-				return true;
170
-			}
171
-		}
172
-		return false;
173
-	}
159
+    /**
160
+     * Checks if any of the specified columns is auto incremental.
161
+     * @param \yii\db\TableSchema $table the table schema
162
+     * @param array $columns columns to check for autoIncrement property
163
+     * @return boolean whether any of the specified columns is auto incremental.
164
+     */
165
+    protected function isColumnAutoIncremental($table, $columns)
166
+    {
167
+        foreach ($columns as $column) {
168
+            if (isset($table->columns[$column]) && $table->columns[$column]->autoIncrement) {
169
+                return true;
170
+            }
171
+        }
172
+        return false;
173
+    }
174 174
 	
175
-	/**
176
-	 * Generates the attribute labels for the specified table.
177
-	 * @param \yii\db\TableSchema $table the table schema
178
-	 * @return array the generated attribute labels (name => label)
179
-	 */
180
-	public function generateLabels($table)
181
-	{
182
-		$labels = [];
183
-		foreach ($table->columns as $column) {
184
-			if ($this->generateLabelsFromComments && !empty($column->comment)) {
185
-				$labels[$column->name] = $column->comment;
186
-			} elseif (!strcasecmp($column->name, 'id')) {
187
-				$labels[$column->name] = 'ID';
188
-			} else {
189
-				$label = Inflector::camel2words($column->name);
190
-				if (!empty($label) && substr_compare($label, ' id', -3, 3, true) === 0) {
191
-					$label = substr($label, 0, -3) . ' ID';
192
-				}
193
-				$labels[$column->name] = $label;
194
-			}
195
-		}
196
-		return $labels;
197
-	}
175
+    /**
176
+     * Generates the attribute labels for the specified table.
177
+     * @param \yii\db\TableSchema $table the table schema
178
+     * @return array the generated attribute labels (name => label)
179
+     */
180
+    public function generateLabels($table)
181
+    {
182
+        $labels = [];
183
+        foreach ($table->columns as $column) {
184
+            if ($this->generateLabelsFromComments && !empty($column->comment)) {
185
+                $labels[$column->name] = $column->comment;
186
+            } elseif (!strcasecmp($column->name, 'id')) {
187
+                $labels[$column->name] = 'ID';
188
+            } else {
189
+                $label = Inflector::camel2words($column->name);
190
+                if (!empty($label) && substr_compare($label, ' id', -3, 3, true) === 0) {
191
+                    $label = substr($label, 0, -3) . ' ID';
192
+                }
193
+                $labels[$column->name] = $label;
194
+            }
195
+        }
196
+        return $labels;
197
+    }
198 198
 	
199
-	/**
200
-	 * @return Connection the DB connection as specified by [[db]].
201
-	 */
202
-	protected function getDbConnection()
203
-	{
204
-		return Yii::$app->get('db', false);
205
-	}
199
+    /**
200
+     * @return Connection the DB connection as specified by [[db]].
201
+     */
202
+    protected function getDbConnection()
203
+    {
204
+        return Yii::$app->get('db', false);
205
+    }
206 206
 }
207 207
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 		}
70 70
 		$rules = [];
71 71
 		foreach ($types as $type => $columns) {
72
-			$rules[] = "[['" . implode("', '", $columns) . "'], '$type']";
72
+			$rules[] = "[['".implode("', '", $columns)."'], '$type']";
73 73
 		}
74 74
 		foreach ($lengths as $length => $columns) {
75
-			$rules[] = "[['" . implode("', '", $columns) . "'], 'string', 'max' => $length]";
75
+			$rules[] = "[['".implode("', '", $columns)."'], 'string', 'max' => $length]";
76 76
 		}
77 77
 		$db = $this->getDbConnection();
78 78
 		// Unique indexes rules
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
 				if (!$this->isColumnAutoIncremental($table, $uniqueColumns)) {
84 84
 					$attributesCount = count($uniqueColumns);
85 85
 					if ($attributesCount === 1) {
86
-						$rules[] = "[['" . $uniqueColumns[0] . "'], 'unique']";
86
+						$rules[] = "[['".$uniqueColumns[0]."'], 'unique']";
87 87
 					} elseif ($attributesCount > 1) {
88 88
 						$labels = array_intersect_key($this->generateLabels($table), array_flip($uniqueColumns));
89 89
 						$lastLabel = array_pop($labels);
90 90
 						$columnsList = implode("', '", $uniqueColumns);
91
-						$rules[] = "[['$columnsList'], 'unique', 'targetAttribute' => ['$columnsList'], 'message' => 'The combination of " . implode(', ', $labels) . " and $lastLabel has already been taken.']";
91
+						$rules[] = "[['$columnsList'], 'unique', 'targetAttribute' => ['$columnsList'], 'message' => 'The combination of ".implode(', ', $labels)." and $lastLabel has already been taken.']";
92 92
 					}
93 93
 				}
94 94
 			}
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		$fullTableName = $tableName;
132 132
 		if (($pos = strrpos($tableName, '.')) !== false) {
133 133
 			if (($useSchemaName === null && $this->useSchemaName) || $useSchemaName) {
134
-				$schemaName = substr($tableName, 0, $pos) . '_';
134
+				$schemaName = substr($tableName, 0, $pos).'_';
135 135
 			}
136 136
 			$tableName = substr($tableName, $pos + 1);
137 137
 		}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 			if (($pos = strrpos($pattern, '.')) !== false) {
145 145
 				$pattern = substr($pattern, $pos + 1);
146 146
 			}
147
-			$patterns[] = '/^' . str_replace('*', '(\w+)', $pattern) . '$/';
147
+			$patterns[] = '/^'.str_replace('*', '(\w+)', $pattern).'$/';
148 148
 		}
149 149
 		$className = $tableName;
150 150
 		foreach ($patterns as $pattern) {
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 			} else {
189 189
 				$label = Inflector::camel2words($column->name);
190 190
 				if (!empty($label) && substr_compare($label, ' id', -3, 3, true) === 0) {
191
-					$label = substr($label, 0, -3) . ' ID';
191
+					$label = substr($label, 0, -3).' ID';
192 192
 				}
193 193
 				$labels[$column->name] = $label;
194 194
 			}
Please login to merge, or discard this patch.
core/console/commands/views/crud/create_model.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 /**
23 23
  * NgRest Model created at <?= date("d.m.Y H:i"); ?> on LUYA Version <?= $luyaVersion; ?>.
24 24
  *
25
-<?php foreach ($properties as $name => $type): ?> * @property <?= $type; ?> $<?= $name . PHP_EOL; ?>
26
-<?php endforeach;?>
25
+<?php foreach ($properties as $name => $type): ?> * @property <?= $type; ?> $<?= $name.PHP_EOL; ?>
26
+<?php endforeach; ?>
27 27
  */
28 28
 <?php if (!$extended): ?>abstract <?php endif; ?>class <?= $className; ?> extends \luya\admin\ngrest\base\NgRestModel
29 29
 {
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     public function rules()
54 54
     {
55 55
         return [
56
-        <?php foreach($rules as $rule): ?>
56
+        <?php foreach ($rules as $rule): ?>
57 57
     <?=$rule?>,
58 58
         <?php endforeach; ?>];
59 59
     }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     {
99 99
         return [
100 100
         <?php foreach ($fieldConfigs as $name => $type): ?>
101
-    '<?=$name; ?>' => '<?= $type;?>',
101
+    '<?=$name; ?>' => '<?= $type; ?>',
102 102
         <?php endforeach; ?>];
103 103
     }
104 104
     
Please login to merge, or discard this patch.