Symfony
3
Вклад в тег
twig:
globals:
your_service: '@your_service'
{{ your_service.someMethod() }}
fetch="EAGER"
$forecast = $app['controllers_factory'];
$forecast->get('/calculations', function (Request $request) use ($app) {
$data = new \App\Services\ForecastService($app['db'], $request, $app['user']);
$return = $data->getForecastCalculations();
return new JsonResponse((array)$return, 200, ['access-control-allow-origin' => '*']);
});
$app->mount('/forecast', $forecast);
$app->after($app['cors']);
$app->run();
if ($auth instanceof User) {
// user related code
} elseif ($auth instanceof Server) {
// server related code
} else {
throw new SomeException()
}