@@ -173,7 +173,7 @@ |
||
173 | 173 | |
174 | 174 | /** |
175 | 175 | * @param integer $termId |
176 | - * @return array An array of TaxonomyTerms |
|
176 | + * @return \yii\db\BaseActiveRecord[] An array of TaxonomyTerms |
|
177 | 177 | */ |
178 | 178 | public function getChildren($termId) |
179 | 179 | { |
@@ -55,7 +55,7 @@ |
||
55 | 55 | { |
56 | 56 | $result = []; |
57 | 57 | |
58 | - foreach(TaxonomyTerms::findAll((array) $params) as $term) { |
|
58 | + foreach (TaxonomyTerms::findAll((array) $params) as $term) { |
|
59 | 59 | $data['term_id'] = $term->id; |
60 | 60 | $data['object_id'] = $object_id; |
61 | 61 |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | |
36 | 36 | public function removeTerm($object_id, $params = []) |
37 | 37 | { |
38 | - if(empty($params)) { |
|
38 | + if (empty($params)) { |
|
39 | 39 | $params = $this->getTerms($object_id); |
40 | 40 | } |
41 | 41 | |
42 | - foreach($params as $item) { |
|
42 | + foreach ($params as $item) { |
|
43 | 43 | $term = $this->getTaxonomyTerm($item); |
44 | 44 | $data['term_id'] = $term->id; |
45 | 45 | $data['object_id'] = $object_id; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $this->getDb()->createCommand()->delete($this->table, $data)->execute(); |
50 | 50 | |
51 | 51 | $term->updateCounters(['total_count' => -1]); |
52 | - Taxonomydef::updateAllCounters(['total_count' => -1], [ 'id' => $this->id ]); |
|
52 | + Taxonomydef::updateAllCounters(['total_count' => -1], ['id' => $this->id]); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | ->andFilterWhere(['taxonomy_terms.term' => $name]); |
63 | 63 | |
64 | 64 | if ($object_id) { |
65 | - $query->innerJoin($this->table, $this->table . '.term_id = taxonomy_terms.id') |
|
65 | + $query->innerJoin($this->table, $this->table.'.term_id = taxonomy_terms.id') |
|
66 | 66 | ->onCondition("$this->table.object_id = $object_id"); |
67 | 67 | } |
68 | 68 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | public function canInstall() { |
110 | - if(!$this->getTable()) |
|
110 | + if (!$this->getTable()) |
|
111 | 111 | return 'Missing "table" property'; |
112 | 112 | return true; |
113 | 113 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | public function getTaxonomyTerm($name, $create = true) |
116 | 116 | { |
117 | 117 | $term = TaxonomyTerms::findOne(['term'=>$name, 'taxonomy_id' => $this->id]); |
118 | - if($create and !isset($term)) { |
|
118 | + if ($create and !isset($term)) { |
|
119 | 119 | $term = new TaxonomyTerms(); |
120 | 120 | $term->taxonomy_id = $this->id; |
121 | 121 | $term->term = $name; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | public function getRefTableName() |
130 | 130 | { |
131 | - if(strpos($this->refTable, '\\') === FALSE) //not an AR class but a table name |
|
131 | + if (strpos($this->refTable, '\\') === FALSE) //not an AR class but a table name |
|
132 | 132 | return $this->refTable; |
133 | 133 | else |
134 | 134 | return call_user_func([$this->refTable, 'tableName']); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | if (!preg_match('/^\w+$/', $this->name)) { |
150 | 150 | throw new Exception('The migration name should contain letters, digits and/or underscore characters only.'); |
151 | 151 | } |
152 | - $name = 'm' . gmdate('ymd_His') . '_' . $this->name; |
|
152 | + $name = 'm'.gmdate('ymd_His').'_'.$this->name; |
|
153 | 153 | return $name; |
154 | 154 | } |
155 | 155 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | { |
158 | 158 | |
159 | 159 | $name = $this->getMigrationFile(); |
160 | - $file = Yii::getAlias($this->migrationPath . DIRECTORY_SEPARATOR . $name . '.php'); |
|
160 | + $file = Yii::getAlias($this->migrationPath.DIRECTORY_SEPARATOR.$name.'.php'); |
|
161 | 161 | |
162 | 162 | //$data = get_object_vars($this); |
163 | 163 | $data = []; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $data['migration'] = $name; |
169 | 169 | |
170 | 170 | $this->migration = $name; |
171 | - $content = Yii::$app->getView()->renderFile(Yii::getAlias($this->templateFile), [ 'data' => $data ]); |
|
171 | + $content = Yii::$app->getView()->renderFile(Yii::getAlias($this->templateFile), ['data' => $data]); |
|
172 | 172 | file_put_contents($file, $content); |
173 | 173 | return $name; |
174 | 174 | } |