Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route::generateStaticPrefix PHP Method

generateStaticPrefix() public method

public generateStaticPrefix ( string $id, string $idPrefix ) : string
$id string PHPCR id of this document
$idPrefix string part of the id that can be removed
return string the static part of the pattern of this route
    public function generateStaticPrefix($id, $idPrefix)
    {
        if (0 == strlen($idPrefix)) {
            throw new \LogicException('Can not determine the prefix. Either this is a new, unpersisted document or the listener that calls setPrefix is not set up correctly.');
        }
        if (strncmp($id, $idPrefix, strlen($idPrefix))) {
            throw new \LogicException("The id prefix '{$idPrefix}' does not match the route document path '{$id}'");
        }
        $url = substr($id, strlen($idPrefix));
        if (empty($url)) {
            $url = '/';
        }
        return $url;
    }