PHP Class Sulu\Component\CustomUrl\Document\Subscriber\CustomUrlSubscriber

Inheritance: implements Symfony\Component\EventDispatcher\EventSubscriberInterface
显示文件 Open project: sulu/sulu

Protected Properties

Property Type Description
$inspector Sulu\Bundle\DocumentManagerBundle\Bridge\DocumentInspector

Public Methods

Method Description
__construct ( Sulu\Component\CustomUrl\Generator\GeneratorInterface $generator, Sulu\Component\DocumentManager\DocumentManagerInterface $documentManager, Sulu\Component\DocumentManager\PathBuilder $pathBuilder, DocumentInspector $inspector, Sulu\Component\Webspace\Manager\WebspaceManagerInterface $webspaceManager )
getSubscribedEvents ( )
handleHydrate ( Sulu\Component\DocumentManager\Event\HydrateEvent $event ) Set routes to custom-url.
handlePersist ( Sulu\Component\DocumentManager\Event\PersistEvent $event ) Creates routes for persisted custom-url.
handleRemove ( Sulu\Component\DocumentManager\Event\RemoveEvent $event ) Removes the routes for the given document.

Protected Methods

Method Description
createRoute ( string $domain, Sulu\Component\CustomUrl\Document\CustomUrlBehavior $document, Localization $locale, string $persistedLocale, string $routesPath ) : RouteDocument Create route-document for given domain.
findOrCreateRoute ( string $path, string $locale, Sulu\Component\CustomUrl\Document\CustomUrlBehavior $document, string $route ) : RouteDocument Find or create route-document for given path.
findReferrer ( $document, $webspaceKey ) : array Returns all route-document which referees given document.
getRoutesPath ( string $webspaceKey ) : string Return routes path for custom-url in given webspace.

Method Details

__construct() public method

public __construct ( Sulu\Component\CustomUrl\Generator\GeneratorInterface $generator, Sulu\Component\DocumentManager\DocumentManagerInterface $documentManager, Sulu\Component\DocumentManager\PathBuilder $pathBuilder, DocumentInspector $inspector, Sulu\Component\Webspace\Manager\WebspaceManagerInterface $webspaceManager )
$generator Sulu\Component\CustomUrl\Generator\GeneratorInterface
$documentManager Sulu\Component\DocumentManager\DocumentManagerInterface
$pathBuilder Sulu\Component\DocumentManager\PathBuilder
$inspector Sulu\Bundle\DocumentManagerBundle\Bridge\DocumentInspector
$webspaceManager Sulu\Component\Webspace\Manager\WebspaceManagerInterface

createRoute() protected method

Create route-document for given domain.
protected createRoute ( string $domain, Sulu\Component\CustomUrl\Document\CustomUrlBehavior $document, Localization $locale, string $persistedLocale, string $routesPath ) : RouteDocument
$domain string
$document Sulu\Component\CustomUrl\Document\CustomUrlBehavior
$locale Sulu\Component\Localization\Localization
$persistedLocale string
$routesPath string
return Sulu\Component\CustomUrl\Document\RouteDocument

findOrCreateRoute() protected method

Find or create route-document for given path.
protected findOrCreateRoute ( string $path, string $locale, Sulu\Component\CustomUrl\Document\CustomUrlBehavior $document, string $route ) : RouteDocument
$path string
$locale string
$document Sulu\Component\CustomUrl\Document\CustomUrlBehavior
$route string
return Sulu\Component\CustomUrl\Document\RouteDocument

findReferrer() protected method

Returns all route-document which referees given document.
protected findReferrer ( $document, $webspaceKey ) : array
$document
$webspaceKey
return array

getRoutesPath() protected method

Return routes path for custom-url in given webspace.
protected getRoutesPath ( string $webspaceKey ) : string
$webspaceKey string
return string

getSubscribedEvents() public static method

public static getSubscribedEvents ( )

handleHydrate() public method

Set routes to custom-url.
public handleHydrate ( Sulu\Component\DocumentManager\Event\HydrateEvent $event )
$event Sulu\Component\DocumentManager\Event\HydrateEvent

handlePersist() public method

Creates routes for persisted custom-url.
public handlePersist ( Sulu\Component\DocumentManager\Event\PersistEvent $event )
$event Sulu\Component\DocumentManager\Event\PersistEvent

handleRemove() public method

Removes the routes for the given document.
public handleRemove ( Sulu\Component\DocumentManager\Event\RemoveEvent $event )
$event Sulu\Component\DocumentManager\Event\RemoveEvent

Property Details

$inspector protected_oe property

protected DocumentInspector,Sulu\Bundle\DocumentManagerBundle\Bridge $inspector
return Sulu\Bundle\DocumentManagerBundle\Bridge\DocumentInspector