| @@ 40-46 (lines=7) @@ | ||
| 37 | * |
|
| 38 | * @return JsonResponse |
|
| 39 | */ |
|
| 40 | public function createWithItem($item, $callback) |
|
| 41 | { |
|
| 42 | $resource = new Item($item, $callback); |
|
| 43 | $rootScope = $this->fractal->createData($resource); |
|
| 44 | ||
| 45 | return $this->createWithArray($rootScope->toArray()); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * @param mixed $collection |
|
| @@ 54-60 (lines=7) @@ | ||
| 51 | * |
|
| 52 | * @return JsonResponse |
|
| 53 | */ |
|
| 54 | public function createWithCollection($collection, $callback) |
|
| 55 | { |
|
| 56 | $resource = new Collection($collection, $callback); |
|
| 57 | $rootScope = $this->fractal->createData($resource); |
|
| 58 | ||
| 59 | return $this->createWithArray($rootScope->toArray()); |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * @param array $array |
|