To register a custom node type, use the phpcr:node-type:register console command (use help phpcr:node-type:register for the syntax; see Tools for more information).
$constraints = new Collection(
[
'hazardous' => [
new Optional(new Type(['type' => 'boolean'])),
],
]
);
$errors = $this->validate(['hazardous'=>$request->get('hazardous', false)], $constraints);
if ($errors) {
return $this->json($errors, 400);
}
$isHazardous = filter_var($request->get('hazardous', false), FILTER_VALIDATE_BOOLEAN);
dump($isHazardous);
/**
* @Route("/neo/fastest/{hazardous}", name="neo_fastest", defaults={"hazardous"="0"}, requirements={"hazardous"="0|1"})
*/
public function getFastestNearEarthObject(bool $hazardous)
{
// ...
}