| 1 | <?php |
||
| 14 | class Relationship |
||
| 15 | { |
||
| 16 | use LinksTrait; |
||
| 17 | use MetaTrait; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * The data object. |
||
| 21 | * |
||
| 22 | * @var \Tobscure\JsonApi\ElementInterface|null |
||
| 23 | */ |
||
| 24 | protected $data; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Create a new relationship. |
||
| 28 | * |
||
| 29 | * @param \Tobscure\JsonApi\ElementInterface|null $data |
||
| 30 | */ |
||
| 31 | 15 | public function __construct(ElementInterface $data = null) |
|
| 35 | |||
| 36 | /** |
||
| 37 | * Get the data object. |
||
| 38 | * |
||
| 39 | * @return \Tobscure\JsonApi\ElementInterface|null |
||
| 40 | */ |
||
| 41 | 12 | public function getData() |
|
| 45 | |||
| 46 | /** |
||
| 47 | * Set the data object. |
||
| 48 | * |
||
| 49 | * @param \Tobscure\JsonApi\ElementInterface|null $data |
||
| 50 | * |
||
| 51 | * @return $this |
||
| 52 | */ |
||
| 53 | public function setData($data) |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Map everything to an array. |
||
| 62 | * |
||
| 63 | * @return array |
||
| 64 | */ |
||
| 65 | 12 | public function toArray() |
|
| 83 | } |
||
| 84 |