| @@ 174-180 (lines=7) @@ | ||
| 171 | if (true === isset($m['objectName'], $m['objectId'])) { |
|
| 172 | $id = (int)$m['objectId']; |
|
| 173 | switch (strtolower($m['objectName'])) { |
|
| 174 | case "page" : |
|
| 175 | if (null !== $model = Page::findById($id)) { |
|
| 176 | $dependency->tags [] = ActiveRecordHelper::getCommonTag(Page::className()); |
|
| 177 | $dependency->tags [] = $model->objectTag(); |
|
| 178 | $output = Url::to(['@article', 'id' => $id]); |
|
| 179 | } |
|
| 180 | break; |
|
| 181 | case "category" : |
|
| 182 | if (null !== $model = Category::findById($id)) { |
|
| 183 | $dependency->tags [] = ActiveRecordHelper::getCommonTag(Category::className()); |
|
| @@ 181-193 (lines=13) @@ | ||
| 178 | $output = Url::to(['@article', 'id' => $id]); |
|
| 179 | } |
|
| 180 | break; |
|
| 181 | case "category" : |
|
| 182 | if (null !== $model = Category::findById($id)) { |
|
| 183 | $dependency->tags [] = ActiveRecordHelper::getCommonTag(Category::className()); |
|
| 184 | $dependency->tags [] = $model->objectTag(); |
|
| 185 | $output = Url::to( |
|
| 186 | [ |
|
| 187 | '@category', |
|
| 188 | 'last_category_id' => $id, |
|
| 189 | 'category_group_id' => $model->category_group_id |
|
| 190 | ] |
|
| 191 | ); |
|
| 192 | } |
|
| 193 | break; |
|
| 194 | case "product" : |
|
| 195 | if (null !== $model = app\modules\shop\models\Product::findById($id)) { |
|
| 196 | $dependency->tags [] = ActiveRecordHelper::getCommonTag(Product::className()); |
|
| @@ 194-206 (lines=13) @@ | ||
| 191 | ); |
|
| 192 | } |
|
| 193 | break; |
|
| 194 | case "product" : |
|
| 195 | if (null !== $model = app\modules\shop\models\Product::findById($id)) { |
|
| 196 | $dependency->tags [] = ActiveRecordHelper::getCommonTag(Product::className()); |
|
| 197 | $dependency->tags [] = $model->objectTag(); |
|
| 198 | $output = Url::to( |
|
| 199 | [ |
|
| 200 | '@product', |
|
| 201 | 'model' => $model, |
|
| 202 | 'category_group_id' => $model->getMainCategory()->category_group_id |
|
| 203 | ] |
|
| 204 | ); |
|
| 205 | } |
|
| 206 | break; |
|
| 207 | } |
|
| 208 | } |
|
| 209 | return $output; |
|