|
@@ -7,6 +7,7 @@ use Muzich\CoreBundle\Searcher\ElementSearcher;
|
7
|
7
|
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
8
|
8
|
use Muzich\CoreBundle\Form\Search\ElementSearchForm;
|
9
|
9
|
use Muzich\CoreBundle\Form\Element\ElementAddForm;
|
|
10
|
+use Symfony\Component\HttpFoundation\Response;
|
10
|
11
|
|
11
|
12
|
class Controller extends BaseController
|
12
|
13
|
{
|
|
@@ -258,4 +259,27 @@ class Controller extends BaseController
|
258
|
259
|
);
|
259
|
260
|
}
|
260
|
261
|
|
|
262
|
+ /**
|
|
263
|
+ * Retourne une réponse contenant du json
|
|
264
|
+ *
|
|
265
|
+ * @param array $content
|
|
266
|
+ * @return Response
|
|
267
|
+ */
|
|
268
|
+ protected function jsonResponse($content)
|
|
269
|
+ {
|
|
270
|
+ $response = new Response(json_encode($content));
|
|
271
|
+ $response->headers->set('Content-Type', 'application/json; charset=utf-8');
|
|
272
|
+ return $response;
|
|
273
|
+ }
|
|
274
|
+
|
|
275
|
+ protected function getAssetUrl($path, $packageName = null)
|
|
276
|
+ {
|
|
277
|
+ return $this->container->get('templating.helper.assets')->getUrl($path, $packageName);
|
|
278
|
+ }
|
|
279
|
+
|
|
280
|
+ protected function trans($string, $params = array(), $package = null)
|
|
281
|
+ {
|
|
282
|
+ return $this->get('translator')->trans($string, $params, $package);
|
|
283
|
+ }
|
|
284
|
+
|
261
|
285
|
}
|