@@ -175,29 +175,29 @@ public function getRelationValue(string $name): ?DataInterface
175
175
/**
176
176
* Set the specific relationship on the model.
177
177
*
178
- * @param string $name
179
- * @param \Swis\JsonApi\Client\Interfaces\DataInterface|false|null $data
178
+ * @param string $relation
179
+ * @param \Swis\JsonApi\Client\Interfaces\DataInterface|false|null $value
180
180
* @param \Swis\JsonApi\Client\Links|null $links
181
181
* @param \Swis\JsonApi\Client\Meta|null $meta
182
182
*
183
183
* @return static
184
184
*/
185
- public function setRelation (string $ name , $ data = false , Links $ links = null , Meta $ meta = null )
185
+ public function setRelation (string $ relation , $ value = false , Links $ links = null , Meta $ meta = null )
186
186
{
187
- $ method = Util::stringCamel ($ name );
187
+ $ method = Util::stringCamel ($ relation );
188
188
if (method_exists ($ this , $ method )) {
189
189
/** @var \Swis\JsonApi\Client\Interfaces\OneRelationInterface|\Swis\JsonApi\Client\Interfaces\ManyRelationInterface $relationObject */
190
190
$ relationObject = $ this ->$ method ();
191
- } elseif ($ data instanceof Collection) {
192
- $ relationObject = $ this ->morphToMany ($ name );
191
+ } elseif ($ value instanceof Collection) {
192
+ $ relationObject = $ this ->morphToMany ($ relation );
193
193
} else {
194
- $ relationObject = $ this ->morphTo ($ name );
194
+ $ relationObject = $ this ->morphTo ($ relation );
195
195
}
196
196
197
- if ($ data !== false ) {
197
+ if ($ value !== false ) {
198
198
$ relationObject ->dissociate ();
199
- if ($ data !== null ) {
200
- $ relationObject ->associate ($ data );
199
+ if ($ value !== null ) {
200
+ $ relationObject ->associate ($ value );
201
201
}
202
202
}
203
203
$ relationObject ->setLinks ($ links );
0 commit comments