コード例 #1
0
 public function deleteCollection(Request $request)
 {
     $this->deleteAll();
     //
     $this->response->setData(array('message' => 'ok'));
     return $this->response;
 }
コード例 #2
0
ファイル: app.php プロジェクト: myurasov/spa-bootstrap
require __DIR__ . '/../../vendor/autoload.php';
/** @var Application $app */
$app = new Application();
// service providers
$app->register(new DoctrineServiceProvider());
$app->register(new DoctrineOrmServiceProvider());
$app->register(new ServiceControllerServiceProvider());
$app->register(new TwigServiceProvider());
// configuration
$app['enviroment'] = (require __DIR__ . '/../../env.php');
require_once __DIR__ . '/config.prod.php';
require_once __DIR__ . '/config.' . $app['enviroment'] . '.php';
// services
// serialized response
$app['serialized_response'] = function () use($app) {
    $s = new SerializedResponse();
    $s->setFormat('json');
    $s->setCacheDir($app['serialized_response.cache_dir']);
    if ($app['debug']) {
        $s->setJsonOptions($s->getJsonOptions() | JSON_PRETTY_PRINT);
    }
    return $s;
};
// auth service
$app['auth'] = $app->share(function () use($app) {
    $auth = new DoctrineAuthService();
    $auth->setConnection($app['db']);
    return $auth;
});
// twig
$app['twig'] = $app->share($app->extend('twig', function (\Twig_Environment $twig) {