Properties

$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

$objType

$objType : object

Type

object — The object to load.

$sectionRoutes

$sectionRoutes : array

Type

array — The section's routes.

$baseSection

$baseSection : integer

Type

integer — The id of the base section.

$snakeCache

$snakeCache : array

The cache of snake-cased words.

Type

array

Methods

__construct()

__construct(array  $data) 

NewsLoader constructor.

Parameters

array $data

The Data.

Throws

\Exception

When there is missing data.

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

fromId()

fromId(integer  $id) : mixed

Parameters

integer $id

The section's id.

Returns

mixed

fromSlug()

fromSlug(string  $slug) : mixed

Parameters

string $slug

The section's slug.

Returns

mixed

all()

all() : \Charcoal\Loader\CollectionLoader

Returns

\Charcoal\Loader\CollectionLoader

masters()

masters() : \ArrayAccess|\Traversable

Returns

\ArrayAccess|\Traversable

children()

children() : \ArrayAccess|\Traversable

Returns

\ArrayAccess|\Traversable

sectionRoutes()

sectionRoutes() : array

Pair routes slug to sections ID

Returns

array

resolveRoute()

resolveRoute(string  $route) : string

Resolve latest route from route slug.

Parameters

string $route

The route to resolve.

Returns

string

resolveSectionId()

resolveSectionId(string  $route) : integer

Resolve section ID from route slug.

Parameters

string $route

The route to resolve.

Returns

integer

objType()

objType() : object

Returns

object

baseSection()

baseSection() : integer

Returns

integer

sectionTypes()

sectionTypes() : array

Returns

array

setObjType()

setObjType(object  $objType) : self

Parameters

object $objType

The object type.

Returns

self

setBaseSection()

setBaseSection(integer  $baseSection) : self

Parameters

integer $baseSection

The base section id.

Returns

self

setSectionTypes()

setSectionTypes(array  $sectionTypes) : self

Parameters

array $sectionTypes

Section types array | null.

Returns

self

snake()

snake(string  $value, string  $delimiter = '-') : string

Convert a string to snake case.

Parameters

string $value

The value to convert.

string $delimiter

The word delimiter.

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