protected function detectAction(IRequest $request)
{
$method = $this->detectMethod($request);
switch ($method) {
case 'GET':
return 'read';
case 'POST':
return 'create';
case 'PATCH':
return 'partialUpdate';
case 'PUT':
return 'update';
case 'DELETE':
return 'delete';
case 'OPTIONS':
return 'options';
default:
throw new InvalidStateException('Method ' . $method . ' is not allowed.');
}
}