| @@ 113-135 (lines=23) @@ | ||
| 110 | ); |
|
| 111 | } |
|
| 112 | ||
| 113 | public function registerReadAction($name, $path, $repository) |
|
| 114 | { |
|
| 115 | $definition = new Definition(ReadController::class); |
|
| 116 | $definition->setArguments( |
|
| 117 | [ |
|
| 118 | $repository, |
|
| 119 | new Reference('event_dispatcher'), |
|
| 120 | ] |
|
| 121 | ); |
|
| 122 | ||
| 123 | $controllerId = $this->normalize('cruds_api_' . $name . '_read_controller'); |
|
| 124 | $this->container->setDefinition($controllerId, $definition); |
|
| 125 | ||
| 126 | $this->getLoaderDefinition()->addMethodCall( |
|
| 127 | 'addRoute', |
|
| 128 | [ |
|
| 129 | $this->normalize('cruds_api_' . $name . '_read'), |
|
| 130 | $path, |
|
| 131 | $controllerId . ':' . ReadController::ACTION, |
|
| 132 | ['GET'], |
|
| 133 | ] |
|
| 134 | ); |
|
| 135 | } |
|
| 136 | ||
| 137 | public function registerUpdateAction($name, $path, $repository, $processor, $manager) |
|
| 138 | { |
|
| @@ 169-192 (lines=24) @@ | ||
| 166 | ); |
|
| 167 | } |
|
| 168 | ||
| 169 | public function registerDeleteAction($name, $path, $repository, $manager) |
|
| 170 | { |
|
| 171 | $definition = new Definition(DeleteController::class); |
|
| 172 | $definition->setArguments( |
|
| 173 | [ |
|
| 174 | $repository, |
|
| 175 | $manager, |
|
| 176 | new Reference('event_dispatcher'), |
|
| 177 | ] |
|
| 178 | ); |
|
| 179 | ||
| 180 | $controllerId = $this->normalize('cruds_api_' . $name . '_delete_controller'); |
|
| 181 | $this->container->setDefinition($controllerId, $definition); |
|
| 182 | ||
| 183 | $this->getLoaderDefinition()->addMethodCall( |
|
| 184 | 'addRoute', |
|
| 185 | [ |
|
| 186 | $this->normalize('cruds_api_' . $name . '_delete'), |
|
| 187 | $path, |
|
| 188 | $controllerId . ':' . DeleteController::ACTION, |
|
| 189 | ['POST'], |
|
| 190 | ] |
|
| 191 | ); |
|
| 192 | } |
|
| 193 | ||
| 194 | public function registerSearchAction($name, $path, $class, $repository, array $criteria = []) |
|
| 195 | { |
|