@@ 63-85 (lines=23) @@ | ||
60 | } |
|
61 | } |
|
62 | ||
63 | public function registerCreateAction($name, $repository, $path) |
|
64 | { |
|
65 | $definition = new Definition(CreateController::class); |
|
66 | $definition->setArguments( |
|
67 | [ |
|
68 | $repository, |
|
69 | new Reference('event_dispatcher'), |
|
70 | ] |
|
71 | ); |
|
72 | ||
73 | $controllerId = $this->normalize('cruds_api_'.$name.'_create_controller'); |
|
74 | $this->container->setDefinition($controllerId, $definition); |
|
75 | ||
76 | $this->getLoaderDefinition()->addMethodCall( |
|
77 | 'addRoute', |
|
78 | [ |
|
79 | $this->normalize('cruds_api_'.$name.'_create'), |
|
80 | $path, |
|
81 | '@'.$controllerId.':'.CreateController::ACTION, |
|
82 | ['POST'], |
|
83 | ] |
|
84 | ); |
|
85 | } |
|
86 | ||
87 | public function registerReadAction($name, $path, $repository) |
|
88 | { |
|
@@ 87-109 (lines=23) @@ | ||
84 | ); |
|
85 | } |
|
86 | ||
87 | public function registerReadAction($name, $path, $repository) |
|
88 | { |
|
89 | $definition = new Definition(ReadController::class); |
|
90 | $definition->setArguments( |
|
91 | [ |
|
92 | $repository, |
|
93 | new Reference('event_dispatcher'), |
|
94 | ] |
|
95 | ); |
|
96 | ||
97 | $controllerId = $this->normalize('cruds_api_'.$name.'_read_controller'); |
|
98 | $this->container->setDefinition($controllerId, $definition); |
|
99 | ||
100 | $this->getLoaderDefinition()->addMethodCall( |
|
101 | 'addRoute', |
|
102 | [ |
|
103 | $this->normalize('cruds_api_'.$name.'_read'), |
|
104 | $path, |
|
105 | '@'.$controllerId.':'.ReadController::ACTION, |
|
106 | ['GET'], |
|
107 | ] |
|
108 | ); |
|
109 | } |
|
110 | ||
111 | public function registerUpdateAction($name, $path, $repository) |
|
112 | { |
|
@@ 111-133 (lines=23) @@ | ||
108 | ); |
|
109 | } |
|
110 | ||
111 | public function registerUpdateAction($name, $path, $repository) |
|
112 | { |
|
113 | $definition = new Definition(UpdateController::class); |
|
114 | $definition->setArguments( |
|
115 | [ |
|
116 | $repository, |
|
117 | new Reference('event_dispatcher'), |
|
118 | ] |
|
119 | ); |
|
120 | ||
121 | $controllerId = $this->normalize('cruds_api_'.$name.'_update_controller'); |
|
122 | $this->container->setDefinition($controllerId, $definition); |
|
123 | ||
124 | $this->getLoaderDefinition()->addMethodCall( |
|
125 | 'addRoute', |
|
126 | [ |
|
127 | $this->normalize('cruds_api_'.$name.'_update'), |
|
128 | $path, |
|
129 | '@'.$controllerId.':'.UpdateController::ACTION, |
|
130 | ['POST'], |
|
131 | ] |
|
132 | ); |
|
133 | } |
|
134 | ||
135 | public function registerDeleteAction($name, $path, $repository) |
|
136 | { |
|
@@ 135-157 (lines=23) @@ | ||
132 | ); |
|
133 | } |
|
134 | ||
135 | public function registerDeleteAction($name, $path, $repository) |
|
136 | { |
|
137 | $definition = new Definition(DeleteController::class); |
|
138 | $definition->setArguments( |
|
139 | [ |
|
140 | $repository, |
|
141 | new Reference('event_dispatcher'), |
|
142 | ] |
|
143 | ); |
|
144 | ||
145 | $controllerId = $this->normalize('cruds_api_'.$name.'_delete_controller'); |
|
146 | $this->container->setDefinition($controllerId, $definition); |
|
147 | ||
148 | $this->getLoaderDefinition()->addMethodCall( |
|
149 | 'addRoute', |
|
150 | [ |
|
151 | $this->normalize('cruds_api_'.$name.'_delete'), |
|
152 | $path, |
|
153 | '@'.$controllerId.':'.DeleteController::ACTION, |
|
154 | ['POST'], |
|
155 | ] |
|
156 | ); |
|
157 | } |
|
158 | ||
159 | public function registerSearchAction($name, $path, $repository, array $filters = []) |
|
160 | { |