@@ 134-153 (lines=20) @@ | ||
131 | * |
|
132 | * @QueryParam(name="locale", requirements="^[a-zA-Z]+", default="uk", description="Selects language of data you want to receive") |
|
133 | */ |
|
134 | public function getAction(ParamFetcher $paramFetcher, $slug) |
|
135 | { |
|
136 | $em = $this->getDoctrine()->getManager(); |
|
137 | ||
138 | $history = $em |
|
139 | ->getRepository('App:History')->findOneByslug($slug); |
|
140 | ||
141 | if (!$history) { |
|
142 | throw $this->createNotFoundException('Unable to find '.$slug.' entity'); |
|
143 | } |
|
144 | ||
145 | $history->setLocale($paramFetcher->get('locale')); |
|
146 | $em->refresh($history); |
|
147 | ||
148 | if ($history->getTranslations()) { |
|
149 | $history->unsetTranslations(); |
|
150 | } |
|
151 | ||
152 | return $history; |
|
153 | } |
|
154 | } |
|
155 |
@@ 144-163 (lines=20) @@ | ||
141 | * |
|
142 | * @QueryParam(name="locale", requirements="^[a-zA-Z]+", default="uk", description="Selects language of data you want to receive") |
|
143 | */ |
|
144 | public function getAction(ParamFetcher $paramFetcher, $slug) |
|
145 | { |
|
146 | $em = $this->getDoctrine()->getManager(); |
|
147 | ||
148 | $performance = $em |
|
149 | ->getRepository('App:Performance')->findOneByslug($slug); |
|
150 | ||
151 | if (!$performance) { |
|
152 | throw $this->createNotFoundException('Unable to find '.$slug.' entity'); |
|
153 | } |
|
154 | ||
155 | $performance->setLocale($paramFetcher->get('locale')); |
|
156 | $em->refresh($performance); |
|
157 | ||
158 | if ($performance->getTranslations()) { |
|
159 | $performance->unsetTranslations(); |
|
160 | } |
|
161 | ||
162 | return $performance; |
|
163 | } |
|
164 | ||
165 | /** |
|
166 | * @Route("/{slug}/roles", name="get_performance_roles", methods={"GET"}) |