\Charcoal\ObjectObjectRoute

Represents a route to an object (i.e., a permalink).

Intended to be used to collect all routes related to models under a single source (e.g., database table).

\Charcoal\Object\Charcoal\Object\ObjectRevision for a similar model that aggregates data under a common source.

Requirements:

  • 'model/factory'
  • 'model/collection/loader'

Summary

Methods
Properties
Constants
setDependencies()
preSave()
preUpdate()
isSlugUnique()
generateUniqueSlug()
setSlug()
setLang()
setCreationDate()
setLastModificationDate()
setRouteObjType()
setRouteObjId()
setRouteTemplate()
modelFactory()
collectionLoader()
slug()
lang()
creationDate()
lastModificationDate()
routeObjType()
routeObjId()
routeTemplate()
__toString()
No public properties found
No constants found
setModelFactory()
setCollectionLoader()
$active
$slug
$lang
$creationDate
$lastModificationDate
$routeObjType
$routeObjId
$routeTemplate
N/A
No private methods found
$originalSlug
$slugInc
$modelFactory
$collectionLoader
N/A

Properties

$active

$active : boolean

A route is active by default.

Type

boolean

$slug

$slug : string

The route's URI.

Type

string

$lang

$lang : string

The route's locale.

Type

string

$creationDate

$creationDate : \DateTime

The creation timestamp.

Type

\DateTime

$lastModificationDate

$lastModificationDate : \DateTime

The last modification timestamp.

Type

\DateTime

$routeObjType

$routeObjType : string

The foreign object type related to this route.

Type

string

$routeObjId

$routeObjId : mixed

The foreign object ID related to this route.

Type

mixed

$routeTemplate

$routeTemplate : string

The foreign object's template identifier.

Type

string

$originalSlug

$originalSlug : string

Store a copy of the original—_preferred_—slug before alterations are made.

Type

string

$slugInc

$slugInc : integer

Store the increment used to create a unique slug.

Type

integer

$modelFactory

$modelFactory : \Charcoal\Factory\FactoryInterface

Store the factory instance for the current class.

Type

\Charcoal\Factory\FactoryInterface

$collectionLoader

$collectionLoader : \Charcoal\Loader\CollectionLoader

Store the collection loader for the current class.

Type

\Charcoal\Loader\CollectionLoader

Methods

setDependencies()

setDependencies(\Pimple\Container  $container) : void

Inject dependencies from a DI Container.

Parameters

\Pimple\Container $container

A dependencies container instance.

preSave()

preSave() : boolean

Event called before _creating_ the object.

Returns

boolean

preUpdate()

preUpdate(array  $properties = null) : boolean

Event called before _updating_ the object.

Parameters

array $properties

Optional. The list of properties to update.

Returns

boolean

isSlugUnique()

isSlugUnique() : boolean

Determine if the current slug is unique.

Returns

boolean

generateUniqueSlug()

generateUniqueSlug() : self

Generate a unique URL slug for routable object.

Returns

self

setSlug()

setSlug(string  $slug) : self

Set the object route URI.

Parameters

string $slug

The route.

Returns

self

setLang()

setLang(string  $lang) : self

Set the locale of the object route.

Parameters

string $lang

The route's locale.

Returns

self

setCreationDate()

setCreationDate(\DateTime|string|null  $creationDate) : self

Parameters

\DateTime|string|null $creationDate

The Creation Date date/time.

Throws

\InvalidArgumentException

If the date/time is invalid.

Returns

self

setLastModificationDate()

setLastModificationDate(\DateTime|string|null  $lastModificationDate) : self

Parameters

\DateTime|string|null $lastModificationDate

The Last modification date date/time.

Throws

\InvalidArgumentException

If the date/time is invalid.

Returns

self

setRouteObjType()

setRouteObjType(string  $type) : self

Set the foreign object type related to this route.

Parameters

string $type

The object type.

Returns

self

setRouteObjId()

setRouteObjId(string  $id) : self

Set the foreign object ID related to this route.

Parameters

string $id

The object ID.

Returns

self

setRouteTemplate()

setRouteTemplate(string  $template) : self

Set the foreign object's template identifier.

Parameters

string $template

The template identifier.

Returns

self

modelFactory()

modelFactory() : \Charcoal\Factory\FactoryInterface

Retrieve the object model factory.

Throws

\RuntimeException

If the model factory was not previously set.

Returns

\Charcoal\Factory\FactoryInterface

collectionLoader()

collectionLoader() : \Charcoal\Loader\CollectionLoader

Retrieve the model collection loader.

Throws

\RuntimeException

If the collection loader was not previously set.

Returns

\Charcoal\Loader\CollectionLoader

slug()

slug() : string

Retrieve the object route.

Returns

string

lang()

lang() : string

Retrieve the locale of the object route.

Returns

string

creationDate()

creationDate() : \DateTime

Creation date.

Returns

\DateTime —

Creation date.

lastModificationDate()

lastModificationDate() : \DateTime

Last modification date.

Returns

\DateTime —

Last modification date.

routeObjType()

routeObjType() : string

Retrieve the foreign object type related to this route.

Returns

string

routeObjId()

routeObjId() : string

Retrieve the foreign object ID related to this route.

Returns

string

routeTemplate()

routeTemplate() : string

Retrieve the foreign object's template identifier.

Returns

string

__toString()

__toString() : string

Alias of {@see self::slug()}.

Returns

string

setModelFactory()

setModelFactory(\Charcoal\Factory\FactoryInterface  $factory) : self

Set an object model factory.

Parameters

\Charcoal\Factory\FactoryInterface $factory

The model factory, to create objects.

Returns

self

setCollectionLoader()

setCollectionLoader(\Charcoal\Loader\CollectionLoader  $loader) : self

Set a model collection loader.

Parameters

\Charcoal\Loader\CollectionLoader $loader

The collection loader.

Returns

self