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