diff --git a/lib/Alchemy/Phrasea/Application/Lightbox.php b/lib/Alchemy/Phrasea/Application/Lightbox.php index 0c492f79df..747dc5530b 100644 --- a/lib/Alchemy/Phrasea/Application/Lightbox.php +++ b/lib/Alchemy/Phrasea/Application/Lightbox.php @@ -125,7 +125,7 @@ return call_user_func( $ret['note_html'] = $twig->render($template_note, array('basket_element' => $BasketElement)); $ret['caption'] = $twig->render($template_caption, array('view' => 'preview', 'record' => $BasketElement->getRecord())); - return $app->json($app['phraseanet.core']['Serializer']->serialize($ret, 'json')); + return $app->json($ret); } } )->assert('sselcont_id', '\d+'); @@ -166,7 +166,7 @@ return call_user_func( $ret['agreement_html'] = $ret['selector_html'] = $ret['note_html'] = ''; - return $app->json($app['phraseanet.core']['Serializer']->serialize($ret, 'json')); + return $app->json($ret); } } )->assert('entry_id', '\d+')->assert('item_id', '\d+'); @@ -377,7 +377,7 @@ return call_user_func( $output = array('error' => false, 'datas' => $datas); } - return $app->json($app['phraseanet.core']['Serializer']->serialize($output, 'json')); + return $app->json($output); } )->assert('sselcont_id', '\d+'); @@ -441,7 +441,7 @@ return call_user_func( $ret['datas'] = $e->getMessage(); } - return $app->json($app['phraseanet.core']['Serializer']->serialize($ret, 'json')); + return $app->json($ret); } )->assert('sselcont_id', '\d+'); @@ -506,10 +506,7 @@ return call_user_func( $datas = array('error' => true, 'datas' => $e->getMessage()); } - $response = new Response($app['phraseanet.core']['Serializer']->serialize($datas, 'json')); - $response->setCharset('UTF-8'); - - return $response; + return $app->json($datas); } )->assert('ssel_id', '\d+'); diff --git a/lib/Alchemy/Phrasea/Application/Prod.php b/lib/Alchemy/Phrasea/Application/Prod.php index a71607381b..6a8eb2b28e 100644 --- a/lib/Alchemy/Phrasea/Application/Prod.php +++ b/lib/Alchemy/Phrasea/Application/Prod.php @@ -74,7 +74,7 @@ return call_user_func(function() { , 'message' => $e->getMessage() ); - return $app->json($app['phraseanet.core']['Serializer']->serialize($datas, 'json')); + return $app->json($datas); } if ($e instanceof \Exception_BadRequest) { return new Response('Bad Request', 400); diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Fields.php b/lib/Alchemy/Phrasea/Controller/Admin/Fields.php index afaef149af..a3c88ae1c9 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Fields.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Fields.php @@ -39,7 +39,7 @@ class Fields implements ControllerProviderInterface 'is_multi' => $tag->isMulti(), ); - return $app->json($app['phraseanet.core']['Serializer']->serialize($datas, 'json')); + return $app->json($datas); }); $controllers->get('/checkreadonly/', function(PhraseaApplication $app, Request $request) { @@ -52,7 +52,7 @@ class Fields implements ControllerProviderInterface 'is_readonly' => ! $tag->isWritable(), ); - return $app->json($app['phraseanet.core']['Serializer']->serialize($datas, 'json')); + return $app->json($datas); }); return $controllers; diff --git a/lib/Alchemy/Phrasea/Controller/Setup/Upgrader.php b/lib/Alchemy/Phrasea/Controller/Setup/Upgrader.php index aa8ad53514..9a9f832175 100644 --- a/lib/Alchemy/Phrasea/Controller/Setup/Upgrader.php +++ b/lib/Alchemy/Phrasea/Controller/Setup/Upgrader.php @@ -46,9 +46,7 @@ class Upgrader implements ControllerProviderInterface $controllers->get('/status/', function() use ($app) { require_once __DIR__ . '/../../../../bootstrap.php'; - $datas = \Setup_Upgrade::get_status(); - - return $app->json($app['phraseanet.core']['Serializer']->serialize($datas, 'json')); + return $app->json(\Setup_Upgrade::get_status()); }); $controllers->post('/execute/', function() use ($app) { diff --git a/lib/Alchemy/Phrasea/Controller/Utils/ConnectionTest.php b/lib/Alchemy/Phrasea/Controller/Utils/ConnectionTest.php index dbd11c3c97..d8deb11d3c 100644 --- a/lib/Alchemy/Phrasea/Controller/Utils/ConnectionTest.php +++ b/lib/Alchemy/Phrasea/Controller/Utils/ConnectionTest.php @@ -80,7 +80,7 @@ class ConnectionTest implements ControllerProviderInterface , 'is_databox' => $is_databox ); - return $app->json($app['phraseanet.core']['Serializer']->serialize($datas, 'json')); + return $app->json($datas); }); return $controllers; diff --git a/lib/Alchemy/Phrasea/Controller/Utils/PathFileTest.php b/lib/Alchemy/Phrasea/Controller/Utils/PathFileTest.php index e754b09dff..8777f23441 100644 --- a/lib/Alchemy/Phrasea/Controller/Utils/PathFileTest.php +++ b/lib/Alchemy/Phrasea/Controller/Utils/PathFileTest.php @@ -30,30 +30,20 @@ class PathFileTest implements ControllerProviderInterface $controllers->get('/path/', function( Request $request) { $path = $request->get('path'); - return $app->json( - $app['phraseanet.core']['Serializer']->serialize( - array( - 'exists' => file_exists($path) - , 'file' => is_file($path) - , 'dir' => is_dir($path) - , 'readable' => is_readable($path) - , 'writeable' => is_writable($path) - , 'executable' => is_executable($path) - ) - , 'json' - ) - ); + return $app->json(array( + 'exists' => file_exists($path) + , 'file' => is_file($path) + , 'dir' => is_dir($path) + , 'readable' => is_readable($path) + , 'writeable' => is_writable($path) + , 'executable' => is_executable($path) + )); }); $controllers->get('/url/', function( Request $request) { $url = $request->get('url'); - return $app->json( - $app['phraseanet.core']['Serializer']->serialize( - array('code' => \http_query::getHttpCodeFromUrl($url)) - , 'json' - ) - ); + return $app->json(array('code' => \http_query::getHttpCodeFromUrl($url))); }); return $controllers; diff --git a/tests/Alchemy/Phrasea/Application/LightboxTest.php b/tests/Alchemy/Phrasea/Application/LightboxTest.php index 10127bba33..5a39881368 100644 --- a/tests/Alchemy/Phrasea/Application/LightboxTest.php +++ b/tests/Alchemy/Phrasea/Application/LightboxTest.php @@ -34,10 +34,10 @@ class ApplicationLightboxTest extends PhraseanetWebTestCaseAuthenticatedAbstract public function createApplication() { $app = require __DIR__ . '/../../../../lib/Alchemy/Phrasea/Application/Lightbox.php'; - + $app['debug'] = true; unset($app['exception_handler']); - + return $app; } diff --git a/tests/Alchemy/Phrasea/Controller/Prod/LazaretTest.php b/tests/Alchemy/Phrasea/Controller/Prod/LazaretTest.php index babcfb55eb..f941550774 100644 --- a/tests/Alchemy/Phrasea/Controller/Prod/LazaretTest.php +++ b/tests/Alchemy/Phrasea/Controller/Prod/LazaretTest.php @@ -28,7 +28,7 @@ class LazaretTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $app['debug'] = true; unset($app['exception_handler']); - $app['Core']['file-system'] = $this->getMock('Symfony\Component\Filesystem\Filesystem', array('remove')); + $app['phraseanet.core']['file-system'] = $this->getMock('Symfony\Component\Filesystem\Filesystem', array('remove')); return $app; } diff --git a/tests/Alchemy/Phrasea/Controller/Setup/FakeSetupApplication.inc b/tests/Alchemy/Phrasea/Controller/Setup/FakeSetupApplication.inc index af952c1707..043c343c28 100644 --- a/tests/Alchemy/Phrasea/Controller/Setup/FakeSetupApplication.inc +++ b/tests/Alchemy/Phrasea/Controller/Setup/FakeSetupApplication.inc @@ -10,7 +10,7 @@ use Alchemy\Phrasea\Controller\Utils as ControllerUtils; return call_user_func(function() { $app = new \Silex\Application(); - $app['Core'] = \bootstrap::getCore(); + $app['phraseanet.core'] = \bootstrap::getCore(); $app['install'] = true; diff --git a/tests/Alchemy/Phrasea/Controller/Setup/FakeUpgradeApplication.inc b/tests/Alchemy/Phrasea/Controller/Setup/FakeUpgradeApplication.inc index fb6971dbdb..4dce173707 100644 --- a/tests/Alchemy/Phrasea/Controller/Setup/FakeUpgradeApplication.inc +++ b/tests/Alchemy/Phrasea/Controller/Setup/FakeUpgradeApplication.inc @@ -2,15 +2,13 @@ namespace Alchemy\Phrasea\Application; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\Request; use Alchemy\Phrasea\Controller\Setup as Controller; use Alchemy\Phrasea\Controller\Utils as ControllerUtils; return call_user_func(function() { $app = new \Silex\Application(); - $app['Core'] = \bootstrap::getCore(); + $app['phraseanet.core'] = \bootstrap::getCore(); $app['upgrade'] = true;