PHP Class Neos\Flow\Mvc\Routing\IdentityRoutePart

This handler is used by default, if an objectType is specified for a route part in the routing configuration: - name: 'Some route for xyz entities' uriPattern: '{xyz}' routeParts: 'xyz': objectType: 'Some\Package\Domain\Model\Xyz'
See also: Neos\Flow\Mvc\Routing\ObjectPathMapping
Inheritance: extends DynamicRoutePart
Afficher le fichier Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Свойство Type Description
$objectPathMappingRepository ObjectPathMappingRepository
$objectType string The object type (class name) of the entity this route part belongs to
$persistenceManager Neos\Flow\Persistence\PersistenceManagerInterface
$reflectionService Neos\Flow\Reflection\ReflectionService
$uriPattern string pattern for the URI representation (for example "{date:Y}/{date:m}/{date.d}/{title}")

Méthodes publiques

Méthode Description
getObjectType ( ) : string
getUriPattern ( ) : string If $this->uriPattern is specified, this will be returned, otherwise identity properties of $this->objectType are returned in the format {property1}/{property2}/{property3}.
setObjectType ( string $objectType ) : void
setUriPattern ( string $uriPattern ) : void

Méthodes protégées

Méthode Description
createPathSegmentForObject ( mixed $object ) : string Creates a URI representation (path segment) for the given object matching $this->uriPattern.
findValueToMatch ( string $routePath ) : string Returns the first part of $routePath that should be evaluated in matchValue().
getObjectIdentifierFromPathSegment ( string $pathSegment ) : string | integer Retrieves the object identifier from the given $pathSegment.
getPathSegmentByIdentifier ( string $identifier ) : string | integer Generates a unique string for the given identifier according to $this->uriPattern.
matchValue ( string $value ) : boolean Checks, whether given value can be matched.
resolveValue ( mixed $value ) : boolean Resolves the given entity and sets the value to a URI representation (path segment) that matches $this->uriPattern and is unique for the given object.
rewriteForUri ( string $value ) : string Transforms the given string into a URI compatible format without special characters.
storeObjectPathMapping ( string $pathSegment, string | integer $identifier ) : void Creates a new ObjectPathMapping and stores it in the repository

Method Details

createPathSegmentForObject() protected méthode

Creates a URI representation (path segment) for the given object matching $this->uriPattern.
protected createPathSegmentForObject ( mixed $object ) : string
$object mixed object of type $this->objectType
Résultat string URI representation (path segment) of the given object

findValueToMatch() protected méthode

If no split string is set (route part is the last in the routes uriPattern), the complete $routePart is returned. Otherwise the part is returned that matches the specified uriPattern of this route part.
protected findValueToMatch ( string $routePath ) : string
$routePath string The request path to be matched
Résultat string value to match, or an empty string if $routePath is empty, split string was not found or uriPattern could not be matched

getObjectIdentifierFromPathSegment() protected méthode

If no UriPattern is set, the $pathSegment is expected to be the (URL-encoded) identifier otherwise a matching ObjectPathMapping fetched from persistence If no matching ObjectPathMapping was found or the given $pathSegment is no valid identifier NULL is returned.
protected getObjectIdentifierFromPathSegment ( string $pathSegment ) : string | integer
$pathSegment string the query path segment to convert
Résultat string | integer the technical identifier of the object or NULL if it couldn't be found

getObjectType() public méthode

public getObjectType ( ) : string
Résultat string

getPathSegmentByIdentifier() protected méthode

If no UriPattern is set, the path segment is equal to the (URL-encoded) $identifier - otherwise a matching ObjectPathMapping is fetched from persistence. If no ObjectPathMapping exists for the given identifier, a new ObjectPathMapping is created.
protected getPathSegmentByIdentifier ( string $identifier ) : string | integer
$identifier string the technical identifier of the object
Résultat string | integer the resolved path segment(s)

getUriPattern() public méthode

If $this->objectType does not contain identity properties, an empty string is returned.
public getUriPattern ( ) : string
Résultat string

matchValue() protected méthode

If the value is empty, FALSE is returned. Otherwise the ObjectPathMappingRepository is asked for a matching ObjectPathMapping. If that is found the identifier is stored in $this->value, otherwise this route part does not match.
protected matchValue ( string $value ) : boolean
$value string value to match, usually the current query path segment(s)
Résultat boolean TRUE if value could be matched successfully, otherwise FALSE

resolveValue() protected méthode

Resolves the given entity and sets the value to a URI representation (path segment) that matches $this->uriPattern and is unique for the given object.
protected resolveValue ( mixed $value ) : boolean
$value mixed
Résultat boolean TRUE if the object could be resolved and stored in $this->value, otherwise FALSE.

rewriteForUri() protected méthode

In the long term this should be done with proper transliteration
protected rewriteForUri ( string $value ) : string
$value string
Résultat string

setObjectType() public méthode

public setObjectType ( string $objectType ) : void
$objectType string
Résultat void

setUriPattern() public méthode

public setUriPattern ( string $uriPattern ) : void
$uriPattern string
Résultat void

storeObjectPathMapping() protected méthode

Creates a new ObjectPathMapping and stores it in the repository
protected storeObjectPathMapping ( string $pathSegment, string | integer $identifier ) : void
$pathSegment string
$identifier string | integer
Résultat void

Property Details

$objectPathMappingRepository protected_oe property

protected ObjectPathMappingRepository,Neos\Flow\Mvc\Routing $objectPathMappingRepository
Résultat ObjectPathMappingRepository

$objectType protected_oe property

The object type (class name) of the entity this route part belongs to
protected string $objectType
Résultat string

$persistenceManager protected_oe property

protected PersistenceManagerInterface,Neos\Flow\Persistence $persistenceManager
Résultat Neos\Flow\Persistence\PersistenceManagerInterface

$reflectionService protected_oe property

protected ReflectionService,Neos\Flow\Reflection $reflectionService
Résultat Neos\Flow\Reflection\ReflectionService

$uriPattern protected_oe property

pattern for the URI representation (for example "{date:Y}/{date:m}/{date.d}/{title}")
protected string $uriPattern
Résultat string