@@ -5,9 +5,9 @@ |
||
5 | 5 | |
6 | 6 | namespace tuyakhov\jsonapi\actions; |
7 | 7 | |
8 | +use Yii; |
|
8 | 9 | use yii\base\Model; |
9 | 10 | use yii\db\ActiveRecord; |
10 | -use Yii; |
|
11 | 11 | use yii\web\ServerErrorHttpException; |
12 | 12 | |
13 | 13 | class UpdateAction extends Action |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | { |
194 | 194 | $result = []; |
195 | 195 | foreach (['id', 'type'] as $key) { |
196 | - $getter = 'get' . ucfirst($key); |
|
196 | + $getter = 'get'.ucfirst($key); |
|
197 | 197 | $value = $identifier->$getter(); |
198 | 198 | if ($value === null || is_array($value) || (is_object($value) && !method_exists($value, '__toString'))) { |
199 | - throw new InvalidValueException("The value {$key} of resource object " . get_class($identifier) . ' MUST be a string.'); |
|
199 | + throw new InvalidValueException("The value {$key} of resource object ".get_class($identifier).' MUST be a string.'); |
|
200 | 200 | } |
201 | 201 | if ($key === 'type' && $this->pluralize) { |
202 | 202 | $value = Inflector::pluralize($value); |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | if (!$model instanceof ResourceInterface) { |
245 | 245 | continue; |
246 | 246 | } |
247 | - $uniqueKey = $model->getType() . '/' . $model->getId(); |
|
247 | + $uniqueKey = $model->getType().'/'.$model->getId(); |
|
248 | 248 | if (!isset($data[$uniqueKey])) { |
249 | 249 | $data[$uniqueKey] = $this->serializeModel($model, $inclusion[$name]); |
250 | 250 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | } |
41 | 41 | return []; |
42 | 42 | } |
43 | - $data = ArrayHelper::getValue($array, 'data', []); |
|
43 | + $data = ArrayHelper::getValue($array, 'data', []); |
|
44 | 44 | if (empty($data)) { |
45 | 45 | return []; |
46 | 46 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Links the relationships with primary model. |
28 | - * @param $model ActiveRecordInterface |
|
28 | + * @param BaseActiveRecord $model ActiveRecordInterface |
|
29 | 29 | * @param array $data relationship links |
30 | 30 | */ |
31 | 31 | protected function linkRelationships($model, array $data = []) |
@@ -61,7 +61,7 @@ |
||
61 | 61 | |
62 | 62 | /** |
63 | 63 | * Removes the relationships from primary model. |
64 | - * @param $model ActiveRecordInterface |
|
64 | + * @param BaseActiveRecord $model ActiveRecordInterface |
|
65 | 65 | * @param array $data relationship links |
66 | 66 | */ |
67 | 67 | protected function unlinkRelationships($model, array $data = []) |
@@ -5,11 +5,11 @@ |
||
5 | 5 | |
6 | 6 | namespace tuyakhov\jsonapi\actions; |
7 | 7 | |
8 | +use Yii; |
|
8 | 9 | use yii\data\ActiveDataProvider; |
9 | 10 | use yii\db\BaseActiveRecord; |
10 | 11 | use yii\web\BadRequestHttpException; |
11 | 12 | use yii\web\NotFoundHttpException; |
12 | -use Yii; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * UpdateRelationshipAction implements the API endpoint for updating relationships. |
@@ -6,10 +6,10 @@ |
||
6 | 6 | namespace tuyakhov\jsonapi\actions; |
7 | 7 | |
8 | 8 | |
9 | +use Yii; |
|
9 | 10 | use tuyakhov\jsonapi\Inflector; |
10 | 11 | use yii\data\ActiveDataProvider; |
11 | 12 | use yii\data\DataFilter; |
12 | -use Yii; |
|
13 | 13 | |
14 | 14 | class IndexAction extends Action |
15 | 15 | { |