| @@ 73-101 (lines=29) @@ | ||
| 70 | */ |
|
| 71 | private $format; |
|
| 72 | ||
| 73 | public function __construct( |
|
| 74 | ControllerHelperInterface $controllerHelper, |
|
| 75 | array $options |
|
| 76 | ) { |
|
| 77 | Assert::null($this->controllerHelper); |
|
| 78 | Assert::keyExists($options, 'entity-class'); |
|
| 79 | ||
| 80 | $options = array_merge([ |
|
| 81 | 'format' => 'json', |
|
| 82 | 'encoder' => null, |
|
| 83 | 'normalizer' => null, |
|
| 84 | 'data-template' => null, |
|
| 85 | 'authorization-attribute' => null, |
|
| 86 | 'entity-id-key' => 'entityId', |
|
| 87 | ], $options); |
|
| 88 | ||
| 89 | Assert::true(is_null($options['encoder']) || $options['encoder'] instanceof EncoderInterface); |
|
| 90 | Assert::true(is_null($options['normalizer']) || $options['normalizer'] instanceof NormalizerInterface); |
|
| 91 | Assert::classExists($options['entity-class']); |
|
| 92 | ||
| 93 | $this->controllerHelper = $controllerHelper; |
|
| 94 | $this->entityIdKey = $options['entity-id-key']; |
|
| 95 | $this->encoder = $options['encoder']; |
|
| 96 | $this->normalizer = $options['normalizer']; |
|
| 97 | $this->entityClass = $options['entity-class']; |
|
| 98 | $this->format = $options['format']; |
|
| 99 | $this->dataTemplate = $options['data-template']; |
|
| 100 | $this->authorizationAttribute = $options['authorization-attribute']; |
|
| 101 | } |
|
| 102 | ||
| 103 | public function __invoke(): Response |
|
| 104 | { |
|
| @@ 75-105 (lines=31) @@ | ||
| 72 | */ |
|
| 73 | private $dataTemplate; |
|
| 74 | ||
| 75 | public function __construct( |
|
| 76 | ControllerHelperInterface $controllerHelper, |
|
| 77 | ArgumentCompilerInterface $argumentCompiler, |
|
| 78 | array $options |
|
| 79 | ) { |
|
| 80 | Assert::null($this->controllerHelper); |
|
| 81 | Assert::keyExists($options, 'entity-class'); |
|
| 82 | Assert::classExists($options['entity-class']); |
|
| 83 | ||
| 84 | $options = array_merge([ |
|
| 85 | 'format' => 'json', |
|
| 86 | 'criteria' => [], |
|
| 87 | 'authorization-attribute' => null, |
|
| 88 | 'encoder' => null, |
|
| 89 | 'normalizer' => null, |
|
| 90 | 'data-template' => null, |
|
| 91 | ], $options); |
|
| 92 | ||
| 93 | Assert::true(is_null($options['encoder']) || $options['encoder'] instanceof EncoderInterface); |
|
| 94 | Assert::true(is_null($options['normalizer']) || $options['normalizer'] instanceof NormalizerInterface); |
|
| 95 | ||
| 96 | $this->controllerHelper = $controllerHelper; |
|
| 97 | $this->argumentCompiler = $argumentCompiler; |
|
| 98 | $this->entityClass = $options['entity-class']; |
|
| 99 | $this->criteria = $options['criteria']; |
|
| 100 | $this->encoder = $options['encoder']; |
|
| 101 | $this->normalizer = $options['normalizer']; |
|
| 102 | $this->format = $options['format']; |
|
| 103 | $this->dataTemplate = $options['data-template']; |
|
| 104 | $this->authorizationAttribute = $options['authorization-attribute']; |
|
| 105 | } |
|
| 106 | ||
| 107 | public function __invoke(): Response |
|
| 108 | { |
|