| @@ 23-29 (lines=7) @@ | ||
| 20 | * |
|
| 21 | * @return array |
|
| 22 | */ |
|
| 23 | public function createItem($item, TransformerAbstract $transformer) |
|
| 24 | { |
|
| 25 | $resource = new Item($item, $transformer); |
|
| 26 | $data = $this->getFractalManager()->createData($resource); |
|
| 27 | ||
| 28 | return $data->toArray(); |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * Creates a collection array and sends it back to hence it came. |
|
| @@ 39-45 (lines=7) @@ | ||
| 36 | * |
|
| 37 | * @return array |
|
| 38 | */ |
|
| 39 | public function createCollection(array $collection, TransformerAbstract $transformer) |
|
| 40 | { |
|
| 41 | $resource = new Collection($collection, $transformer); |
|
| 42 | $data = $this->getFractalManager()->createData($resource); |
|
| 43 | ||
| 44 | return $data->toArray(); |
|
| 45 | } |
|
| 46 | } |
|