Neos\Flow\Mvc\Routing\IdentityRoutePart::getUriPattern PHP Method

getUriPattern() public method

If $this->objectType does not contain identity properties, an empty string is returned.
public getUriPattern ( ) : string
return string
    public function getUriPattern()
    {
        if ($this->uriPattern === null) {
            $classSchema = $this->reflectionService->getClassSchema($this->objectType);
            $identityProperties = $classSchema->getIdentityProperties();
            if (count($identityProperties) === 0) {
                $this->uriPattern = '';
            } else {
                $this->uriPattern = '{' . implode('}/{', array_keys($identityProperties)) . '}';
            }
        }
        return $this->uriPattern;
    }

Usage Example

 /**
  * @test
  */
 public function getUriPatternReturnsBasedOnTheIdentityPropertiesOfTheObjectTypeIfNoPatternWasSpecified()
 {
     $this->mockClassSchema->expects($this->once())->method('getIdentityProperties')->will($this->returnValue(['property1' => 'string', 'property2' => 'integer', 'property3' => 'DateTime']));
     $this->identityRoutePart->setObjectType('SomeObjectType');
     $this->assertSame('{property1}/{property2}/{property3}', $this->identityRoutePart->getUriPattern());
 }