protected function getDoc(CrudController $controller, $actionKey, $options) { $section = ucfirst(ltrim($controller->getRoutePrefix(), '/')); $parameters = array_key_exists('parameters', $options) ? $options['parameters'] : []; $filters = $actionKey === 'list' ? $this->getFilters($section) : []; $form = $controller->getFormType(); $input = $form ? get_class($form) : ''; $config = ['resource' => true, 'section' => $section, 'description' => ucfirst($actionKey) . " action", 'statusCodes' => [200 => "OK", 201 => "Created", 202 => "Accepted", 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-Status', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported'], 'filters' => $filters, 'parameters' => $parameters]; $action = $controller->getAction($actionKey); $options = $action->getOptions(); if (array_key_exists('checkAccess', $options) && array_key_exists('attributes', $options['checkAccess'])) { $config['authentication'] = true; $config['authenticationRoles'] = $options['checkAccess']['attributes']; } if ($actionKey === 'add' || $actionKey === 'edit') { $config['input'] = $input; } return new ApiDoc($config); }
/** * @return AbstractType */ public function getFormType() : AbstractType { return $this->controller->getFormType(); }
/** * @return AbstractType */ public function getFormType() { return $this->controller->getFormType(); }