Overview

Namespaces

  • Charcoal
    • Admin
      • Widget
        • Cms
    • Cms
      • Config
      • Mixin
        • Traits
      • Route
      • Section
      • Service
        • Loader
        • Manager
      • ServiceProvider
      • Support
        • Helpers
        • Interfaces
        • Traits
    • Property

Classes

  • EventRoute
  • GenericRoute
  • NewsRoute
  • SectionRoute
  • Overview
  • Namespace
  • Class

Class GenericRoute

Generic Object Route Handler

Uses implementations of \Charcoal\Object\ObjectRouteInterface to match routes for catch-all routing patterns.

Charcoal\App\Route\TemplateRoute
Extended by Charcoal\Cms\Route\GenericRoute uses Charcoal\Translator\TranslatorAwareTrait (not available)
Namespace: Charcoal\Cms\Route
Located at Charcoal/Cms/Route/GenericRoute.php
Methods summary
public
# __construct( array $data )

Returns new template route object.

Returns new template route object.

Parameters

$data
Class depdendencies.
public
# setDependencies( Pimple\Container $container )

Inject dependencies from a DI Container.

Inject dependencies from a DI Container.

Parameters

$container
A dependencies container instance.
public boolean
# pathResolvable( Pimple\Container $container )

Determine if the URI path resolves to an object.

Determine if the URI path resolves to an object.

Parameters

$container
A DI (Pimple) container.

Returns

boolean
public Psr\Http\Message\ResponseInterface
# __invoke( Pimple\Container $container, Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response )

Resolve the dynamic route.

Resolve the dynamic route.

Parameters

$container
A DI (Pimple) container.
$request
A PSR-7 compatible Request instance.
$response
A PSR-7 compatible Response instance.

Returns

Psr\Http\Message\ResponseInterface
protected Psr\Http\Message\ResponseInterface
# resolveLatestObjectRoute( Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response )

Parameters

$request
A PSR-7 compatible Request instance.
$response
A PSR-7 compatible Response instance.

Returns

Psr\Http\Message\ResponseInterface
protected Charcoal\Cms\Route\GenericRoute
# resolveTemplateContextObject( )

Returns

Charcoal\Cms\Route\GenericRoute
protected string
# createTemplate( Pimple\Container $container, Psr\Http\Message\RequestInterface $request )

Parameters

$container
A DI (Pimple) container.
$request
The request to intialize the template with.

Returns

string
public Charcoal\Object\ObjectRouteInterface
# createRouteObject( )

Create a route object.

Create a route object.

Returns

Charcoal\Object\ObjectRouteInterface
protected Charcoal\Cms\Route\GenericRoute
# setObjectRouteClass( string $className )

Set the class name of the object route model.

Set the class name of the object route model.

Parameters

$className
The class name of the object route model.

Returns

Charcoal\Cms\Route\GenericRoute

Throws

InvalidArgumentException
If the class name is not a string.
public string
# objectRouteClass( )

Retrieve the class name of the object route model.

Retrieve the class name of the object route model.

Returns

string
protected Charcoal\Object\RoutableInterface
# loadContextObject( )

Load the object associated with the matching object route.

Load the object associated with the matching object route.

Validating if the object ID exists is delegated to the GenericRoute Chainable::pathResolvable() method.

Returns

Charcoal\Object\RoutableInterface
protected Charcoal\Object\ObjectRouteInterface
# loadObjectRouteFromPath( )

Load the object route matching the URI path.

Load the object route matching the URI path.

Returns

Charcoal\Object\ObjectRouteInterface
public Charcoal\Object\ObjectRouteInterface
# getLatestObjectPathHistory( Charcoal\Object\ObjectRouteInterface $route )

Retrieve the latest object route from the given object route's associated object.

Retrieve the latest object route from the given object route's associated object.

The object routes are ordered by descending creation date (latest first). Should never MISS, the given object route should exist.

Parameters

$route
Routable Object.

Returns

Charcoal\Object\ObjectRouteInterface
protected Charcoal\Cms\Route\GenericRoute
# setPath( string $path )

Set the specified URI path.

Set the specified URI path.

Parameters

$path
The path to use for route resolution.

Returns

Charcoal\Cms\Route\GenericRoute
protected Charcoal\Cms\Route\GenericRoute
# setModelFactory( Charcoal\Factory\FactoryInterface $factory )

Set an object model factory.

Set an object model factory.

Parameters

$factory
The model factory, to create objects.

Returns

Charcoal\Cms\Route\GenericRoute
public Charcoal\Cms\Route\GenericRoute
# setCollectionLoader( Charcoal\Loader\CollectionLoader $loader )

Set a model collection loader.

Set a model collection loader.

Parameters

$loader
The collection loader.

Returns

Charcoal\Cms\Route\GenericRoute
protected
# setLocale( string $langCode )

Sets the environment's current locale.

Sets the environment's current locale.

Parameters

$langCode
The locale's language code.
protected string
# path( )

Retrieve the URI path.

Retrieve the URI path.

Returns

string
public Charcoal\Factory\FactoryInterface
# modelFactory( )

Retrieve the object model factory.

Retrieve the object model factory.

Returns

Charcoal\Factory\FactoryInterface

Throws

RuntimeException
If the model factory was not previously set.
protected Charcoal\Loader\CollectionLoader
# collectionLoader( )

Retrieve the model collection loader.

Retrieve the model collection loader.

Returns

Charcoal\Loader\CollectionLoader

Throws

RuntimeException
If the collection loader was not previously set.
protected boolean
# cacheEnabled( )

Returns

boolean
protected integer
# cacheTtl( )

Returns

integer
protected string
# cacheIdent( )

Returns

string
Properties summary
protected string $objectRouteClass

The class name of the object route model.

The class name of the object route model.

Must be a fully-qualified PHP namespace and an implementation of \Charcoal\Object\ObjectRouteInterface. Used by the model factory.

# Charcoal\Cms\Route\ObjectRoute::class
protected array $availableTemplates

Store the available templates.

Store the available templates.

# []
API documentation generated by ApiGen