$violations = $this->get('validator')->validate($dto);
$dto = $this->get('serializer')->deserialize(
$request->getContent(),
DTO::class
);
public function editAction(DTO $dto)
{
}
CustomUserMessageAuthenticationException
- подкласс AuthenticationException
) и обрабатывает их по-свойму. $now = new \DateTime();
$now->add(new \DateInterval('PT3H2M30S'));
echo $now->format('H:i:s');
$process = new Process("bin/console app:check-api $orderId > /dev/null 2>&1 &");
{% block password_widget %}
<div class="form-control">
{{ block('password_widget') }}
</div>
{% endblock %}
{% form_theme form _self %}
{% block password_widget %}
<div class="form-control">
{{ block('password_widget') }}
</div>
{% endblock %}
{% block password_widget %}
<div class="form-control">
{%- set type = type|default('password') -%}
{{ block('form_widget_simple') }}
</div>
{% endblock %}
FrameworkBundle/Resources/views/Form
лежат шаблоны для php-форм $from = new \DateTime('2018-05-03 00:00:00');
$to = new \DateTime('2018-05-03 23:59:59');
$period = new \DatePeriod($from, new \DateInterval('PT30M'), $to);
$result = [];
foreach ($period as $dateTime) {
$dinner = clone $dateTime;
$dinner->add(new \DateInterval('PT30M'));
$result[] = $dateTime->format('H:i') . ' - ' . $dinner->format('H:i');
}
var_dump($result);
RequestAttributeValueResolver
отрабатывает раньше, соответственно до вашего резолвера дело не доходит.App\ArgumentResolver\UserIdResolver:
class: App\ArgumentResolver\UserIdResolver
tags:
- { name: controller.argument_value_resolver, priority: 101 }
class UserController {
/**
* @Rest\Get("/users/{userId}")
*/
public function getUserById(UserId $id): void {
var_dump($id);
die('1234');
}
}
App\ArgumentResolver\UserIdResolver:
class: App\ArgumentResolver\UserIdResolver
tags:
- { name: controller.argument_value_resolver, priority: 50 }
controller.argument_value_resolver
добавляется автоматически на основании интерфейса page_item:
path: /{parameters}
defaults: { _controller: AppBundle\Controller\Page\PageController:itemAction }
requirements:
parameters: ".+"
public function itemAction(Request $request, $parameters)
{
$parts = explode('/', $parameters);
// ...
}