Fix FOSRestBundle compatibility

This commit is contained in:
Ener-Getick 2015-11-30 19:35:49 +01:00
parent 67b7b46627
commit 5541412e69

View File

@ -33,7 +33,7 @@ class FosRestHandler implements HandlerInterface
$requirements = $this->handleRequirements($annot->requirements);
$data = array(
'required' => $annot->strict && $annot->nullable === false && $annot->default === null,
'dataType' => $requirements.($annot->array ? '[]' : ''),
'dataType' => $requirements.((property_exists($annot, 'map') ? $annot->map : $annot->array) ? '[]' : ''),
'actualType' => $this->inferType($requirements),
'subType' => null,
'description' => $annot->description,
@ -46,19 +46,19 @@ class FosRestHandler implements HandlerInterface
} elseif ($annot instanceof QueryParam) {
if ($annot->strict && $annot->nullable === false && $annot->default === null) {
$annotation->addRequirement($annot->name, array(
'requirement' => $this->handleRequirements($annot->requirements).($annot->array ? '[]' : ''),
'requirement' => $this->handleRequirements($annot->requirements).((property_exists($annot, 'map') ? $annot->map : $annot->array) ? '[]' : ''),
'dataType' => '',
'description' => $annot->description,
));
} elseif ($annot->default !== null) {
$annotation->addFilter($annot->name, array(
'requirement' => $this->handleRequirements($annot->requirements).($annot->array ? '[]' : ''),
'requirement' => $this->handleRequirements($annot->requirements).((property_exists($annot, 'map') ? $annot->map : $annot->array) ? '[]' : ''),
'description' => $annot->description,
'default' => $annot->default,
));
} else {
$annotation->addFilter($annot->name, array(
'requirement' => $this->handleRequirements($annot->requirements).($annot->array ? '[]' : ''),
'requirement' => $this->handleRequirements($annot->requirements).((property_exists($annot, 'map') ? $annot->map : $annot->array) ? '[]' : ''),
'description' => $annot->description,
));
}