ApiPlatform\Core\PathResolver\DashOperationPathResolver::resolveOperationPath PHP Method

resolveOperationPath() public method

public resolveOperationPath ( string $resourceShortName, array $operation, boolean $collection ) : string
$resourceShortName string
$operation array
$collection boolean
return string
    public function resolveOperationPath(string $resourceShortName, array $operation, bool $collection) : string
    {
        $path = '/' . Inflector::pluralize(strtolower(preg_replace('~(?<=\\w)([A-Z])~', '-$1', $resourceShortName)));
        if (!$collection) {
            $path .= '/{id}';
        }
        $path .= '.{_format}';
        return $path;
    }

Usage Example

 public function testResolveItemOperationPath()
 {
     $dashOperationPathResolver = new DashOperationPathResolver();
     $this->assertSame('/short-names/{id}.{_format}', $dashOperationPathResolver->resolveOperationPath('ShortName', [], false));
 }
DashOperationPathResolver