Partial
extends CmsCompoundObject
in package
The CMS partial class.
Tags
Table of Contents
- $attributeNames : array<string|int, mixed>
- $attributes : array<string|int, mixed>
- $components : array<string|int, mixed>
- $customMessages : array<string|int, mixed>
- $exists : bool
- $implement : array<string|int, mixed>
- $rules : array<string|int, mixed>
- $settings : array<string|int, mixed>
- $viewBag : array<string|int, mixed>
- $allowedExtensions : array<string|int, mixed>
- $appends : array<string|int, mixed>
- The accessors to append to the model's array form.
- $booted : array<string|int, mixed>
- The array of booted models.
- $cache : CacheManager
- The cache manager instance.
- $datasource : string
- $defaultExtension : string
- $dirName : string
- $dispatcher : Dispatcher
- The event dispatcher instance.
- $emitterEventCollection : array<string|int, mixed>
- $emitterEventSorted : array<string|int, mixed>
- $emitterSingleEventCollection : array<string|int, mixed>
- $eventsBooted : array<string|int, mixed>
- $extendableCallbacks : array<string|int, mixed>
- $extendableGuardProperties : bool
- $extendableStaticMethods : array<string|int, mixed>
- $extensionData : array<string|int, mixed>
- $fillable : array<string|int, mixed>
- $isCompoundObject : bool
- $loadedFromCache : bool
- $maxNesting : int
- $mutatorCache : array<string|int, mixed>
- The cache of the mutated attributes for each class.
- $objectComponentPropertyMap : array<string|int, mixed>|null
- $observables : array<string|int, mixed>
- User exposed observable events.
- $original : array<string|int, mixed>
- $passthru : array<string|int, mixed>
- The methods that should be returned from the collection of all objects.
- $purgeable : array<string|int, mixed>
- $resolver : ResolverInterface
- The datasource resolver instance.
- $themeCache : Theme
- $validationErrors : MessageBag
- $validator : Validator
- The validator instance.
- $viewBagCache : mixed
- $wrapCode : bool
- __call() : mixed
- __callStatic() : mixed
- __construct() : mixed
- Constructor
- __get() : mixed
- __isset() : bool
- Determine if an attribute exists on the model.
- __set() : mixed
- __toString() : string
- Convert the model to its string representation.
- __unset() : void
- Unset an attribute on the model.
- addDynamicMethod() : mixed
- Programmatically adds a method to the extendable class
- addDynamicProperty() : mixed
- Programmatically adds a property to the extendable class
- addObservableEvents() : void
- Add an observable event name.
- addPurgeable() : $this
- Adds an attribute to the purgeable attributes list
- afterFetch() : void
- Triggered after the object is loaded.
- all() : Collection|array<string|int, static>
- Get all of the models from the datasource.
- asExtension() : mixed
- Short hand for `getClassExtension()` method, except takes the short extension name, example:
- attributesToArray() : array<string|int, mixed>
- Convert the model's attributes to an array.
- beforeSave() : void
- Triggered when the model is saved.
- bindEvent() : self
- Create a new event binding.
- bindEventOnce() : self
- Create a new event binding that fires once only
- bootValidation() : void
- Boot the validation trait for this model.
- cacheMutatedAttributes() : void
- Extract and cache all the mutated attributes of a class.
- clearBootedModels() : void
- Clear the list of booted models so they will be re-booted.
- clearCache() : void
- Clears the object cache.
- clearExtendedClasses() : void
- Clear the list of extended classes so they will be re-extended.
- create() : static
- Save a new model and return the instance.
- created() : void
- Register a created model event with the dispatcher.
- creating() : void
- Register a creating model event with the dispatcher.
- delete() : bool|null
- Delete the model from the database.
- deleted() : void
- Register a deleted model event with the dispatcher.
- deleting() : void
- Register a deleting model event with the dispatcher.
- errors() : MessageBag
- Get validation error message collection for the Model
- extend() : mixed
- extendableCall() : mixed
- Magic method for `__call()`
- extendableCallStatic() : mixed
- Magic method for `__callStatic()`
- extendableConstruct() : mixed
- This method should be called as part of the constructor.
- extendableExtendCallback() : void
- Helper method for `::extend()` static method
- extendableGet() : string
- Magic method for `__get()`
- extendableSet() : string
- Magic method for `__set()`
- extendClassWith() : void
- Dynamically extend a class with a specified behavior
- fetched() : void
- Create a new native event for handling afterFetch().
- fetching() : void
- Create a new native event for handling beforeFetch().
- fill() : $this
- Fill the model with an array of attributes.
- fireEvent() : array<string|int, mixed>
- Fire an event and call the listeners.
- flushEventListeners() : void
- Remove all of the event listeners for the model.
- forceSave() : bool
- Force save the model even if validation fails.
- getAllowedExtensions() : array<string|int, mixed>
- Returns the allowable file extensions supported by this model.
- getAttribute() : mixed
- Get a plain attribute.
- getAttributes() : array<string|int, mixed>
- Get all of the current attributes on the model.
- getBaseFileName() : string
- Returns the file name without the extension.
- getBaseFileNameAttribute() : string
- Returns the file name without the extension.
- getCacheManager() : CacheManager
- Get the cache manager instance.
- getClassExtension() : mixed
- Returns a behavior object from an extendable class, example:
- getClassMethods() : array<string|int, mixed>
- Get a list of class methods, extension equivalent of get_class_methods()
- getCodeClassParent() : string
- Returns name of a PHP class to us a parent for the PHP class created for the object's PHP section.
- getComponent() : ComponentBase
- Returns a component by its name.
- getComponentProperties() : array<string|int, mixed>
- Returns component property names and values.
- getContent() : string
- Returns the file content.
- getDatasource() : Datasource
- Get the datasource for the model.
- getDatasourceName() : string
- Get the current datasource name for the model.
- getDatasourceResolver() : DatasourceResolverInterface
- Get the datasource resolver instance.
- getDirty() : array<string|int, mixed>
- Get the attributes that have been changed since last sync.
- getDynamicProperties() : array<string|int, mixed>
- Returns all dynamic properties and their values
- getEventDispatcher() : Dispatcher
- Get the event dispatcher instance.
- getFileName() : string
- Returns the file name.
- getFileNameParts() : mixed
- Returns the base file name and extension. Applies a default extension, if none found.
- getFilePath() : string
- Returns the full path to the template file corresponding to this object.
- getId() : string
- Helper for {{ page.id }} or {{ layout.id }} twig vars Returns a unique string for this object.
- getIdAttribute() : string
- Helper for {{ page.id }} or {{ layout.id }} twig vars Returns a semi-unique string for this object.
- getMaxNesting() : int
- Returns the maximum directory nesting allowed by this template.
- getModelValidator() : Validator
- Get the validator instance.
- getMutatedAttributes() : array<string|int, mixed>
- Get the mutated attributes for a given instance.
- getObjectTypeDirName() : string
- Returns the directory name corresponding to the object type.
- getObservableEvents() : array<string|int, mixed>
- Get the observable event names.
- getOriginal() : array<string|int, mixed>
- Get the model's original attribute values.
- getSettingsAttribute() : array<string|int, mixed>
- The settings is attribute contains everything that should be saved to the settings area.
- getThemeAttribute() : Theme
- Returns the CMS theme this object belongs to.
- getTwigCacheKey() : string
- Returns the key used by the Twig cache.
- getTwigContent() : string
- Returns the Twig content string.
- getTwigNodeTree() : ModuleNode
- Returns Twig node tree generated from the object's markup.
- getViewBag() : ViewBag
- Returns the configured view bag component.
- getWrapCode() : bool
- Returns true if the code section will be wrapped in PHP tags.
- hasComponent() : mixed
- Checks if the object has a component with the specified name.
- hasGetMutator() : bool
- Determine if a get mutator exists for an attribute.
- hasSetMutator() : bool
- Determine if a set mutator exists for an attribute.
- hydrate() : Collection
- Create a collection of models from plain arrays.
- initCacheItem() : mixed
- Initializes the object properties from the cached data. The extra data set here becomes available as attributes set on the model after fetch.
- inTheme() : $this
- Prepares the theme datasource for the model.
- isAttributeRequired() : bool
- Determines if an attribute is required based on the validation rules.
- isClassExtendedWith() : bool
- Check if extendable class is extended with a behavior object
- isCompoundObject() : bool
- Returns true if this template supports code and settings sections.
- isDirty() : bool
- Determine if the model or given attribute(s) have been modified.
- isFillable() : bool
- Determine if the given attribute may be mass assigned.
- isLoadedFromCache() : bool
- Returns true if the object was loaded from the cache.
- jsonSerialize() : array<string|int, mixed>
- Convert the object into something JSON serializable.
- listInTheme() : Collection
- Returns the list of objects in the specified theme.
- load() : mixed
- Loads the object from a file.
- loadCached() : mixed
- Loads the object from a cache.
- methodExists() : bool
- Checks if a method exists, extension equivalent of method_exists()
- newCollection() : Collection
- Create a new Halcyon Collection instance.
- newFromBuilder() : static
- Create a new model instance that is existing.
- newInstance() : static
- Create a new instance of the given model.
- newQuery() : Builder
- Get a new query builder for the object
- offsetExists() : bool
- Determine if the given attribute exists.
- offsetGet() : mixed
- Get the value for a given offset.
- offsetSet() : void
- Set the value for a given offset.
- offsetUnset() : void
- Unset the value for a given offset.
- on() : Model
- Begin querying the model on a given datasource.
- propertyExists() : bool
- Checks if a property exists, extension equivalent of `property_exists()`
- query() : Builder
- Begin querying the model.
- removeObservableEvents() : void
- Remove an observable event name.
- resolveDatasource() : Datasource
- Resolve a datasource instance.
- runComponents() : void
- Runs components defined in the settings Process halts if a component returns a value
- save() : bool
- Save the model to the datasource.
- saved() : void
- Register a saved model event with the dispatcher.
- saveInternal() : bool
- Save the model to the database. Is used by {@link save()} and {@link forceSave()}.
- saving() : void
- Register a saving model event with the dispatcher.
- setAttribute() : $this
- Set a given attribute on the model.
- setCacheManager() : void
- Set the cache manager instance.
- setDatasource() : $this
- Set the datasource associated with the model.
- setDatasourceResolver() : void
- Set the datasource resolver instance.
- setEventDispatcher() : void
- Set the event dispatcher instance.
- setFileNameAttribute() : mixed
- File name should always contain an extension.
- setLoadedFromCache() : bool
- Returns true if the object was loaded from the cache.
- setModelValidator() : void
- Set the validator instance.
- setObservableEvents() : $this
- Set the observable event names.
- setRawAttributes() : $this
- Set the array of model attributes. No checking is done.
- setSettingsAttribute() : mixed
- Filling the settings should merge it with attributes.
- syncOriginal() : $this
- Sync the original attributes with the current.
- syncOriginalAttribute() : $this
- Sync a single original attribute with its current value.
- toArray() : array<string|int, mixed>
- Convert the model instance to an array.
- toJson() : string
- Convert the model instance to JSON.
- unbindEvent() : self
- Destroys an event binding.
- unsetCacheManager() : void
- Unset the cache manager for models.
- unsetDatasourceResolver() : void
- Unset the datasource resolver for models.
- unsetEventDispatcher() : void
- Unset the event dispatcher for models.
- unsetModelValidator() : void
- Unset the validator for models.
- update() : bool|int
- Update the model in the database.
- updated() : void
- Register an updated model event with the dispatcher.
- updating() : void
- Register an updating model event with the dispatcher.
- validate() : bool
- Validate the model instance
- validated() : void
- Create a new native event for handling afterValidate().
- validating() : void
- Create a new native event for handling beforeValidate().
- boot() : void
- The "booting" method of the model.
- bootDefaultTheme() : void
- Boot all of the bootable traits on the model.
- bootIfNotBooted() : void
- Check if the model needs to be booted and if so, do it.
- bootNicerEvents() : mixed
- Bind some nicer events to this model, in the format of method overrides.
- bootTraits() : void
- Boot all of the bootable traits on the model.
- checkSafeMode() : void
- This method checks if safe mode is enabled by config, and the code attribute is modified and populated. If so an exception is thrown.
- emitterEventSortEvents() : array<string|int, mixed>
- Sort the listeners for a given event by priority.
- extendableIsAccessible() : bool
- Checks if a property is accessible, property equivalent of `is_callable()`
- extensionExtractMethods() : void
- Extracts the available methods from a behavior and adds it to the list of callable methods.
- fillableFromArray() : array<string|int, mixed>
- Get the fillable attributes of a given array.
- fillViewBagArray() : void
- Copies view bag properties to the view bag array.
- finishSave() : void
- Finish processing on a successful save operation.
- fireModelEvent() : mixed
- Fire the given event for the model.
- getArrayableAppends() : array<string|int, mixed>
- Get all of the appendable values that are arrayable.
- getAttributeFromArray() : mixed
- Get an attribute from the $attributes array.
- getValidationAttributes() : array<string|int, mixed>
- Returns the model data used for validation.
- makeValidator() : Validator
- Instantiates the validator used by the validation process, depending if the class is being used inside or outside of Laravel.
- mutateAttribute() : mixed
- Get the value of an attribute using its mutator.
- mutateAttributeForArray() : mixed
- Get the value of an attribute using its mutator for array conversion.
- originalIsNumericallyEquivalent() : bool
- Determine if the new and old values for a given key are numerically equivalent.
- parseComponentSettings() : void
- Parse component sections.
- parseSettings() : void
- Parses the settings array.
- performDeleteOnModel() : void
- Perform the actual delete query on this model instance.
- performInsert() : bool
- Perform a model insert operation.
- performUpdate() : bool
- Perform a model update operation.
- processRuleFieldNames() : array<string|int, mixed>
- Processes field names in a rule array.
- processValidationRules() : mixed
- Process rules
- registerModelEvent() : void
- Register a model event with the dispatcher.
- throwHalcyonSaveException() : mixed
- Converts an exception type thrown by Halcyon to a native CMS exception.
- validateSettings() : void
- If the model is loaded with an invalid INI section, the invalid content will be passed as a special attribute. Look for it, then locate the failure reason.
Properties
$attributeNames
public
array<string|int, mixed>
$attributeNames
= []
The array of custom attribute names.
$attributes
public
array<string|int, mixed>
$attributes
= []
The model's attributes, saved to the settings area.
$components
public
array<string|int, mixed>
$components
= []
Initialized components defined in the template file.
$customMessages
public
array<string|int, mixed>
$customMessages
= []
The array of custom error messages.
$exists
public
bool
$exists
= false
Indicates if the model exists.
$implement
public
array<string|int, mixed>
$implement
Extensions implemented by this class.
$rules
public
array<string|int, mixed>
$rules
= []
The rules to be applied to the data.
$settings
public
array<string|int, mixed>
$settings
= ['components' => []]
INI settings defined in the template file. Not to be confused with the attribute called settings. In this array, components are bumped to their own array inside the 'components' key.
$viewBag
public
array<string|int, mixed>
$viewBag
= []
Contains the view bag properties. This property is used by the page editor internally.
$allowedExtensions
protected
array<string|int, mixed>
$allowedExtensions
= ['htm', 'html', 'css', 'js', 'svg']
Allowable file extensions. TEMPORARY! DO NOT INCLUDE in Build 1.1.x, workaround for unsupported code
$appends
The accessors to append to the model's array form.
protected
array<string|int, mixed>
$appends
= []
$booted
The array of booted models.
protected
static array<string|int, mixed>
$booted
= []
$cache
The cache manager instance.
protected
static CacheManager
$cache
$datasource
protected
string
$datasource
The data source for the model, a directory path.
$defaultExtension
protected
string
$defaultExtension
= 'htm'
Default file extension.
$dirName
protected
string
$dirName
= 'partials'
The container name associated with the model, eg: pages.
$dispatcher
The event dispatcher instance.
protected
static Dispatcher
$dispatcher
$emitterEventCollection
protected
array<string|int, mixed>
$emitterEventCollection
= []
Collection of registered events.
$emitterEventSorted
protected
array<string|int, mixed>
$emitterEventSorted
= []
Sorted collection of events.
$emitterSingleEventCollection
protected
array<string|int, mixed>
$emitterSingleEventCollection
= []
Collection of registered events to be fired once only.
$eventsBooted
protected
static array<string|int, mixed>
$eventsBooted
= []
The array of models booted events.
$extendableCallbacks
protected
static array<string|int, mixed>
$extendableCallbacks
= []
Used to extend the constructor of an extendable class. Eg:
Class::extend(function($obj) { })
$extendableGuardProperties
protected
static bool
$extendableGuardProperties
= true
Indicates if dynamic properties can be created.
$extendableStaticMethods
protected
static array<string|int, mixed>
$extendableStaticMethods
= []
Collection of static methods used by behaviors.
$extensionData
protected
array<string|int, mixed>
$extensionData
= ['extensions' => [], 'methods' => [], 'dynamicMethods' => [], 'dynamicProperties' => []]
Class reflection information, including behaviors.
$fillable
protected
array<string|int, mixed>
$fillable
= []
The attributes that are mass assignable.
$isCompoundObject
protected
bool
$isCompoundObject
= true
Model supports code and settings sections.
$loadedFromCache
protected
bool
$loadedFromCache
= false
Indicated whether the object was loaded from the cache.
$maxNesting
protected
int
$maxNesting
= 2
The maximum allowed path nesting level. The default value is 2, meaning that files can only exist in the root directory, or in a subdirectory. Set to null if any level is allowed.
$mutatorCache
The cache of the mutated attributes for each class.
protected
static array<string|int, mixed>
$mutatorCache
= []
$objectComponentPropertyMap
protected
static array<string|int, mixed>|null
$objectComponentPropertyMap
Cache for component properties.
$observables
User exposed observable events.
protected
array<string|int, mixed>
$observables
= []
$original
protected
array<string|int, mixed>
$original
= []
The model attribute's original state.
$passthru
The methods that should be returned from the collection of all objects.
protected
array<string|int, mixed>
$passthru
= ['lists', 'where', 'sortBy', 'whereComponent', 'withComponent']
$purgeable
protected
array<string|int, mixed>
$purgeable
= []
List of attribute names which are not considered "settings".
$resolver
The datasource resolver instance.
protected
static ResolverInterface
$resolver
$themeCache
protected
Theme
$themeCache
A reference to the CMS theme containing the object.
$validationErrors
protected
MessageBag
$validationErrors
The message bag instance containing validation error messages
$validator
The validator instance.
protected
static Validator
$validator
$viewBagCache
protected
mixed
$viewBagCache
= false
Cache store for the getViewBag method.
$wrapCode
protected
bool
$wrapCode
= true
Wrap code section in PHP tags.
Methods
__call()
public
__call(mixed $name, mixed $params) : mixed
Parameters
- $name : mixed
- $params : mixed
Return values
mixed —__callStatic()
public
static __callStatic(mixed $name, mixed $params) : mixed
Parameters
- $name : mixed
- $params : mixed
Return values
mixed —__construct()
Constructor
public
__construct() : mixed
Return values
mixed —__get()
public
__get(mixed $name) : mixed
Parameters
- $name : mixed
Return values
mixed —__isset()
Determine if an attribute exists on the model.
public
__isset(string $key) : bool
Parameters
- $key : string
Return values
bool —__set()
public
__set(mixed $name, mixed $value) : mixed
Parameters
- $name : mixed
- $value : mixed
Return values
mixed —__toString()
Convert the model to its string representation.
public
__toString() : string
Return values
string —__unset()
Unset an attribute on the model.
public
__unset(string $key) : void
Parameters
- $key : string
Return values
void —addDynamicMethod()
Programmatically adds a method to the extendable class
public
addDynamicMethod(string $dynamicName, callable $method[, string $extension = null ]) : mixed
Parameters
- $dynamicName : string
- $method : callable
- $extension : string = null
Return values
mixed —addDynamicProperty()
Programmatically adds a property to the extendable class
public
addDynamicProperty(string $dynamicName[, string $value = null ]) : mixed
Parameters
- $dynamicName : string
- $value : string = null
Return values
mixed —addObservableEvents()
Add an observable event name.
public
addObservableEvents(array<string|int, mixed>|mixed $observables) : void
Parameters
- $observables : array<string|int, mixed>|mixed
Return values
void —addPurgeable()
Adds an attribute to the purgeable attributes list
public
addPurgeable([array<string|int, mixed>|string|null $attributes = null ]) : $this
Parameters
- $attributes : array<string|int, mixed>|string|null = null
Return values
$this —afterFetch()
Triggered after the object is loaded.
public
afterFetch() : void
Return values
void —all()
Get all of the models from the datasource.
public
static all() : Collection|array<string|int, static>
Return values
Collection|array<string|int, static> —asExtension()
Short hand for `getClassExtension()` method, except takes the short extension name, example:
public
asExtension(string $shortName) : mixed
$this->asExtension('FormController')
Parameters
- $shortName : string
Return values
mixed —attributesToArray()
Convert the model's attributes to an array.
public
attributesToArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —beforeSave()
Triggered when the model is saved.
public
beforeSave() : void
Return values
void —bindEvent()
Create a new event binding.
public
bindEvent(mixed $event, mixed $callback, mixed $priority) : self
Parameters
- $event : mixed
- $callback : mixed
- $priority : mixed
Return values
self —bindEventOnce()
Create a new event binding that fires once only
public
bindEventOnce(mixed $event, mixed $callback) : self
Parameters
- $event : mixed
- $callback : mixed
Return values
self —bootValidation()
Boot the validation trait for this model.
public
static bootValidation() : void
Return values
void —cacheMutatedAttributes()
Extract and cache all the mutated attributes of a class.
public
static cacheMutatedAttributes(string $class) : void
Parameters
- $class : string
Return values
void —clearBootedModels()
Clear the list of booted models so they will be re-booted.
public
static clearBootedModels() : void
Return values
void —clearCache()
Clears the object cache.
public
static clearCache(Theme $theme) : void
Parameters
- $theme : Theme
-
Specifies a parent theme.
Return values
void —clearExtendedClasses()
Clear the list of extended classes so they will be re-extended.
public
static clearExtendedClasses() : void
Return values
void —create()
Save a new model and return the instance.
public
static create([array<string|int, mixed> $attributes = [] ]) : static
Parameters
- $attributes : array<string|int, mixed> = []
Return values
static —created()
Register a created model event with the dispatcher.
public
static created(Closure|string $callback, int $priority) : void
Parameters
- $callback : Closure|string
- $priority : int
Return values
void —creating()
Register a creating model event with the dispatcher.
public
static creating(Closure|string $callback, int $priority) : void
Parameters
- $callback : Closure|string
- $priority : int
Return values
void —delete()
Delete the model from the database.
public
delete() : bool|null
Tags
Return values
bool|null —deleted()
Register a deleted model event with the dispatcher.
public
static deleted(Closure|string $callback, int $priority) : void
Parameters
- $callback : Closure|string
- $priority : int
Return values
void —deleting()
Register a deleting model event with the dispatcher.
public
static deleting(Closure|string $callback, int $priority) : void
Parameters
- $callback : Closure|string
- $priority : int
Return values
void —errors()
Get validation error message collection for the Model
public
errors() : MessageBag
Return values
MessageBag —extend()
public
static extend(callable $callback) : mixed
Parameters
- $callback : callable
Return values
mixed —extendableCall()
Magic method for `__call()`
public
extendableCall(string $name[, array<string|int, mixed> $params = null ]) : mixed
Parameters
- $name : string
- $params : array<string|int, mixed> = null
Return values
mixed —extendableCallStatic()
Magic method for `__callStatic()`
public
static extendableCallStatic(string $name[, array<string|int, mixed> $params = null ]) : mixed
Parameters
- $name : string
- $params : array<string|int, mixed> = null
Return values
mixed —extendableConstruct()
This method should be called as part of the constructor.
public
extendableConstruct() : mixed
Return values
mixed —extendableExtendCallback()
Helper method for `::extend()` static method
public
static extendableExtendCallback(callable $callback) : void
Parameters
- $callback : callable
Return values
void —extendableGet()
Magic method for `__get()`
public
extendableGet(string $name) : string
Parameters
- $name : string
Return values
string —extendableSet()
Magic method for `__set()`
public
extendableSet(string $name, string $value) : string
Parameters
- $name : string
- $value : string
Return values
string —extendClassWith()
Dynamically extend a class with a specified behavior
public
extendClassWith(string $extensionName) : void
Parameters
- $extensionName : string
Return values
void —fetched()
Create a new native event for handling afterFetch().
public
static fetched(Closure|string $callback) : void
Parameters
- $callback : Closure|string
Return values
void —fetching()
Create a new native event for handling beforeFetch().
public
static fetching(Closure|string $callback) : void
Parameters
- $callback : Closure|string
Return values
void —fill()
Fill the model with an array of attributes.
public
fill(array<string|int, mixed> $attributes) : $this
Parameters
- $attributes : array<string|int, mixed>
Return values
$this —fireEvent()
Fire an event and call the listeners.
public
fireEvent(string $event[, array<string|int, mixed> $params = [] ][, bool $halt = false ]) : array<string|int, mixed>
Parameters
- $event : string
-
Event name
- $params : array<string|int, mixed> = []
-
Event parameters
- $halt : bool = false
-
Halt after first non-null result
Return values
array<string|int, mixed> —Collection of event results / Or single result (if halted)
flushEventListeners()
Remove all of the event listeners for the model.
public
static flushEventListeners() : void
Return values
void —forceSave()
Force save the model even if validation fails.
public
forceSave([mixed $options = null ]) : bool
Parameters
- $options : mixed = null
Return values
bool —getAllowedExtensions()
Returns the allowable file extensions supported by this model.
public
getAllowedExtensions() : array<string|int, mixed>
Return values
array<string|int, mixed> —getAttribute()
Get a plain attribute.
public
getAttribute(string $key) : mixed
Parameters
- $key : string
Return values
mixed —getAttributes()
Get all of the current attributes on the model.
public
getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —getBaseFileName()
Returns the file name without the extension.
public
getBaseFileName() : string
Return values
string —getBaseFileNameAttribute()
Returns the file name without the extension.
public
getBaseFileNameAttribute() : string
Return values
string —getCacheManager()
Get the cache manager instance.
public
static getCacheManager() : CacheManager
Return values
CacheManager —getClassExtension()
Returns a behavior object from an extendable class, example:
public
getClassExtension(string $name) : mixed
$this->getClassExtension('Backend.Behaviors.FormController')
Parameters
- $name : string
-
Fully qualified behavior name
Return values
mixed —getClassMethods()
Get a list of class methods, extension equivalent of get_class_methods()
public
getClassMethods() : array<string|int, mixed>
Return values
array<string|int, mixed> —getCodeClassParent()
Returns name of a PHP class to us a parent for the PHP class created for the object's PHP section.
public
getCodeClassParent() : string
Return values
string —Returns the class name.
getComponent()
Returns a component by its name.
public
getComponent(string $componentName) : ComponentBase
This method is used only in the back-end and for internal system needs when the standard way to access components is not an option.
Parameters
- $componentName : string
-
Specifies the component name.
Return values
ComponentBase —Returns the component instance or null.
getComponentProperties()
Returns component property names and values.
public
getComponentProperties(string $componentName) : array<string|int, mixed>
This method implements caching and can be used in the run-time on the front-end.
Parameters
- $componentName : string
-
Specifies the component name.
Return values
array<string|int, mixed> —Returns an associative array with property names in the keys and property values in the values.
getContent()
Returns the file content.
public
getContent() : string
Return values
string —getDatasource()
Get the datasource for the model.
public
getDatasource() : Datasource
Return values
Datasource —getDatasourceName()
Get the current datasource name for the model.
public
getDatasourceName() : string
Return values
string —getDatasourceResolver()
Get the datasource resolver instance.
public
static getDatasourceResolver() : DatasourceResolverInterface
Return values
DatasourceResolverInterface —getDirty()
Get the attributes that have been changed since last sync.
public
getDirty() : array<string|int, mixed>
Return values
array<string|int, mixed> —getDynamicProperties()
Returns all dynamic properties and their values
public
getDynamicProperties() : array<string|int, mixed>
Return values
array<string|int, mixed> —['property' => 'value']
getEventDispatcher()
Get the event dispatcher instance.
public
static getEventDispatcher() : Dispatcher
Return values
Dispatcher —getFileName()
Returns the file name.
public
getFileName() : string
Return values
string —getFileNameParts()
Returns the base file name and extension. Applies a default extension, if none found.
public
getFileNameParts([mixed $fileName = null ]) : mixed
Parameters
- $fileName : mixed = null
Return values
mixed —getFilePath()
Returns the full path to the template file corresponding to this object.
public
getFilePath([string $fileName = null ]) : string
Parameters
- $fileName : string = null
Return values
string —getId()
Helper for {{ page.id }} or {{ layout.id }} twig vars Returns a unique string for this object.
public
getId() : string
Return values
string —getIdAttribute()
Helper for {{ page.id }} or {{ layout.id }} twig vars Returns a semi-unique string for this object.
public
getIdAttribute() : string
Return values
string —getMaxNesting()
Returns the maximum directory nesting allowed by this template.
public
getMaxNesting() : int
Return values
int —getModelValidator()
Get the validator instance.
public
static getModelValidator() : Validator
Return values
Validator —getMutatedAttributes()
Get the mutated attributes for a given instance.
public
getMutatedAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —getObjectTypeDirName()
Returns the directory name corresponding to the object type.
public
getObjectTypeDirName() : string
For pages the directory name is "pages", for layouts - "layouts", etc.
Return values
string —getObservableEvents()
Get the observable event names.
public
getObservableEvents() : array<string|int, mixed>
Return values
array<string|int, mixed> —getOriginal()
Get the model's original attribute values.
public
getOriginal([string|null $key = null ][, mixed $default = null ]) : array<string|int, mixed>
Parameters
- $key : string|null = null
- $default : mixed = null
Return values
array<string|int, mixed> —getSettingsAttribute()
The settings is attribute contains everything that should be saved to the settings area.
public
getSettingsAttribute() : array<string|int, mixed>
Return values
array<string|int, mixed> —getThemeAttribute()
Returns the CMS theme this object belongs to.
public
getThemeAttribute() : Theme
Return values
Theme —getTwigCacheKey()
Returns the key used by the Twig cache.
public
getTwigCacheKey() : string
Return values
string —getTwigContent()
Returns the Twig content string.
public
getTwigContent() : string
Return values
string —getTwigNodeTree()
Returns Twig node tree generated from the object's markup.
public
getTwigNodeTree([mixed $markup = false ]) : ModuleNode
This method is used by the system internally and shouldn't participate in the front-end request processing.
Parameters
- $markup : mixed = false
-
Specifies the markup content. Use FALSE to load the content from the markup section.
Tags
Return values
ModuleNode —A node tree
getViewBag()
Returns the configured view bag component.
public
getViewBag() : ViewBag
This method is used only in the back-end and for internal system needs when the standard way to access components is not an option.
Return values
ViewBag —Returns the view bag component instance.
getWrapCode()
Returns true if the code section will be wrapped in PHP tags.
public
getWrapCode() : bool
Return values
bool —hasComponent()
Checks if the object has a component with the specified name.
public
hasComponent(string $componentName) : mixed
Parameters
- $componentName : string
-
Specifies the component name.
Return values
mixed —Return false or the full component name used on the page (it could include the alias).
hasGetMutator()
Determine if a get mutator exists for an attribute.
public
hasGetMutator(string $key) : bool
Parameters
- $key : string
Return values
bool —hasSetMutator()
Determine if a set mutator exists for an attribute.
public
hasSetMutator(string $key) : bool
Parameters
- $key : string
Return values
bool —hydrate()
Create a collection of models from plain arrays.
public
static hydrate(array<string|int, mixed> $items[, string|null $datasource = null ]) : Collection
Parameters
- $items : array<string|int, mixed>
- $datasource : string|null = null
Return values
Collection —initCacheItem()
Initializes the object properties from the cached data. The extra data set here becomes available as attributes set on the model after fetch.
public
static initCacheItem(mixed &$item) : mixed
Parameters
- $item : mixed
Return values
mixed —inTheme()
Prepares the theme datasource for the model.
public
static inTheme(Theme $theme) : $this
Parameters
- $theme : Theme
-
Specifies a parent theme.
Return values
$this —isAttributeRequired()
Determines if an attribute is required based on the validation rules.
public
isAttributeRequired(string $attribute) : bool
Parameters
- $attribute : string
Return values
bool —isClassExtendedWith()
Check if extendable class is extended with a behavior object
public
isClassExtendedWith(string $name) : bool
Parameters
- $name : string
-
Fully qualified behavior name
Return values
bool —isCompoundObject()
Returns true if this template supports code and settings sections.
public
isCompoundObject() : bool
Return values
bool —isDirty()
Determine if the model or given attribute(s) have been modified.
public
isDirty([array<string|int, mixed>|string|null $attributes = null ]) : bool
Parameters
- $attributes : array<string|int, mixed>|string|null = null
Return values
bool —isFillable()
Determine if the given attribute may be mass assigned.
public
isFillable(string $key) : bool
Parameters
- $key : string
Return values
bool —isLoadedFromCache()
Returns true if the object was loaded from the cache.
public
isLoadedFromCache() : bool
Return values
bool —jsonSerialize()
Convert the object into something JSON serializable.
public
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —listInTheme()
Returns the list of objects in the specified theme.
public
static listInTheme(Theme $theme[, bool $skipCache = false ]) : Collection
This method is used internally by the system.
Parameters
- $theme : Theme
-
Specifies a parent theme.
- $skipCache : bool = false
-
Indicates if objects should be reloaded from the disk bypassing the cache.
Return values
Collection —Returns a collection of CMS objects.
load()
Loads the object from a file.
public
static load(mixed $theme, string $fileName) : mixed
This method is used in the CMS back-end. It doesn't use any caching.
Parameters
- $theme : mixed
-
Specifies the theme the object belongs to.
- $fileName : string
-
Specifies the file name, with the extension. The file name can contain only alphanumeric symbols, dashes and dots.
Return values
mixed —Returns a CMS object instance or null if the object wasn't found.
loadCached()
Loads the object from a cache.
public
static loadCached(Theme $theme, string $fileName) : mixed
This method is used by the CMS in the runtime. If the cache is not found, it is created.
Parameters
- $theme : Theme
-
Specifies the theme the object belongs to.
- $fileName : string
-
Specifies the file name, with the extension.
Return values
mixed —Returns a CMS object instance or null if the object wasn't found.
methodExists()
Checks if a method exists, extension equivalent of method_exists()
public
methodExists(string $name) : bool
Parameters
- $name : string
Return values
bool —newCollection()
Create a new Halcyon Collection instance.
public
newCollection([array<string|int, mixed> $models = [] ]) : Collection
Parameters
- $models : array<string|int, mixed> = []
Return values
Collection —newFromBuilder()
Create a new model instance that is existing.
public
newFromBuilder([array<string|int, mixed> $attributes = [] ][, string|null $datasource = null ]) : static
Parameters
- $attributes : array<string|int, mixed> = []
- $datasource : string|null = null
Return values
static —newInstance()
Create a new instance of the given model.
public
newInstance([array<string|int, mixed> $attributes = [] ][, bool $exists = false ]) : static
Parameters
- $attributes : array<string|int, mixed> = []
- $exists : bool = false
Return values
static —newQuery()
Get a new query builder for the object
public
newQuery() : Builder
Return values
Builder —offsetExists()
Determine if the given attribute exists.
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
bool —offsetGet()
Get the value for a given offset.
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
Return values
mixed —offsetSet()
Set the value for a given offset.
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
Return values
void —offsetUnset()
Unset the value for a given offset.
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
Return values
void —on()
Begin querying the model on a given datasource.
public
static on([string|null $datasource = null ]) : Model
Parameters
- $datasource : string|null = null
Return values
Model —propertyExists()
Checks if a property exists, extension equivalent of `property_exists()`
public
propertyExists(string $name) : bool
Parameters
- $name : string
Return values
bool —query()
Begin querying the model.
public
static query() : Builder
Return values
Builder —removeObservableEvents()
Remove an observable event name.
public
removeObservableEvents(array<string|int, mixed>|mixed $observables) : void
Parameters
- $observables : array<string|int, mixed>|mixed
Return values
void —resolveDatasource()
Resolve a datasource instance.
public
static resolveDatasource([string|null $datasource = null ]) : Datasource
Parameters
- $datasource : string|null = null
Return values
Datasource —runComponents()
Runs components defined in the settings Process halts if a component returns a value
public
runComponents() : void
Return values
void —save()
Save the model to the datasource.
public
save([array<string|int, mixed> $options = null ]) : bool
Parameters
- $options : array<string|int, mixed> = null
Return values
bool —saved()
Register a saved model event with the dispatcher.
public
static saved(Closure|string $callback, int $priority) : void
Parameters
- $callback : Closure|string
- $priority : int
Return values
void —saveInternal()
Save the model to the database. Is used by {@link save()} and {@link forceSave()}.
public
saveInternal([array<string|int, mixed> $options = [] ]) : bool
Parameters
- $options : array<string|int, mixed> = []
Return values
bool —saving()
Register a saving model event with the dispatcher.
public
static saving(Closure|string $callback, int $priority) : void
Parameters
- $callback : Closure|string
- $priority : int
Return values
void —setAttribute()
Set a given attribute on the model.
public
setAttribute(string $key, mixed $value) : $this
Parameters
- $key : string
- $value : mixed
Return values
$this —setCacheManager()
Set the cache manager instance.
public
static setCacheManager(CacheManager $cache) : void
Parameters
- $cache : CacheManager
Return values
void —setDatasource()
Set the datasource associated with the model.
public
setDatasource(string $name) : $this
Parameters
- $name : string
Return values
$this —setDatasourceResolver()
Set the datasource resolver instance.
public
static setDatasourceResolver(ResolverInterface $resolver) : void
Parameters
- $resolver : ResolverInterface
Return values
void —setEventDispatcher()
Set the event dispatcher instance.
public
static setEventDispatcher(Dispatcher $dispatcher) : void
Parameters
- $dispatcher : Dispatcher
Return values
void —setFileNameAttribute()
File name should always contain an extension.
public
setFileNameAttribute(mixed $value) : mixed
Parameters
- $value : mixed
Return values
mixed —setLoadedFromCache()
Returns true if the object was loaded from the cache.
public
setLoadedFromCache(mixed $value) : bool
Parameters
- $value : mixed
Return values
bool —setModelValidator()
Set the validator instance.
public
static setModelValidator(mixed $validator) : void
Parameters
- $validator : mixed
Return values
void —setObservableEvents()
Set the observable event names.
public
setObservableEvents(array<string|int, mixed> $observables) : $this
Parameters
- $observables : array<string|int, mixed>
Return values
$this —setRawAttributes()
Set the array of model attributes. No checking is done.
public
setRawAttributes(array<string|int, mixed> $attributes[, bool $sync = false ]) : $this
Parameters
- $attributes : array<string|int, mixed>
- $sync : bool = false
Return values
$this —setSettingsAttribute()
Filling the settings should merge it with attributes.
public
setSettingsAttribute(mixed $value) : mixed
Parameters
- $value : mixed
Return values
mixed —syncOriginal()
Sync the original attributes with the current.
public
syncOriginal() : $this
Return values
$this —syncOriginalAttribute()
Sync a single original attribute with its current value.
public
syncOriginalAttribute(string $attribute) : $this
Parameters
- $attribute : string
Return values
$this —toArray()
Convert the model instance to an array.
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —toJson()
Convert the model instance to JSON.
public
toJson(int $options) : string
Parameters
- $options : int
Return values
string —unbindEvent()
Destroys an event binding.
public
unbindEvent([string $event = null ]) : self
Parameters
- $event : string = null
-
Event to destroy
Return values
self —unsetCacheManager()
Unset the cache manager for models.
public
static unsetCacheManager() : void
Return values
void —unsetDatasourceResolver()
Unset the datasource resolver for models.
public
static unsetDatasourceResolver() : void
Return values
void —unsetEventDispatcher()
Unset the event dispatcher for models.
public
static unsetEventDispatcher() : void
Return values
void —unsetModelValidator()
Unset the validator for models.
public
static unsetModelValidator() : void
Return values
void —update()
Update the model in the database.
public
update([array<string|int, mixed> $attributes = [] ]) : bool|int
Parameters
- $attributes : array<string|int, mixed> = []
Return values
bool|int —updated()
Register an updated model event with the dispatcher.
public
static updated(Closure|string $callback, int $priority) : void
Parameters
- $callback : Closure|string
- $priority : int
Return values
void —updating()
Register an updating model event with the dispatcher.
public
static updating(Closure|string $callback, int $priority) : void
Parameters
- $callback : Closure|string
- $priority : int
Return values
void —validate()
Validate the model instance
public
validate([mixed $rules = null ][, mixed $customMessages = null ][, mixed $attributeNames = null ]) : bool
Parameters
- $rules : mixed = null
- $customMessages : mixed = null
- $attributeNames : mixed = null
Return values
bool —validated()
Create a new native event for handling afterValidate().
public
static validated(Closure|string $callback) : void
Parameters
- $callback : Closure|string
Return values
void —validating()
Create a new native event for handling beforeValidate().
public
static validating(Closure|string $callback) : void
Parameters
- $callback : Closure|string
Return values
void —boot()
The "booting" method of the model.
protected
static boot() : void
Return values
void —bootDefaultTheme()
Boot all of the bootable traits on the model.
protected
static bootDefaultTheme() : void
Return values
void —bootIfNotBooted()
Check if the model needs to be booted and if so, do it.
protected
bootIfNotBooted() : void
Return values
void —bootNicerEvents()
Bind some nicer events to this model, in the format of method overrides.
protected
bootNicerEvents() : mixed
Return values
mixed —bootTraits()
Boot all of the bootable traits on the model.
protected
static bootTraits() : void
Return values
void —checkSafeMode()
This method checks if safe mode is enabled by config, and the code attribute is modified and populated. If so an exception is thrown.
protected
checkSafeMode() : void
Return values
void —emitterEventSortEvents()
Sort the listeners for a given event by priority.
protected
emitterEventSortEvents(string $eventName) : array<string|int, mixed>
Parameters
- $eventName : string
Return values
array<string|int, mixed> —extendableIsAccessible()
Checks if a property is accessible, property equivalent of `is_callable()`
protected
extendableIsAccessible(mixed $class, string $propertyName) : bool
Parameters
- $class : mixed
- $propertyName : string
Return values
bool —extensionExtractMethods()
Extracts the available methods from a behavior and adds it to the list of callable methods.
protected
extensionExtractMethods(string $extensionName, object $extensionObject) : void
Parameters
- $extensionName : string
- $extensionObject : object
Return values
void —fillableFromArray()
Get the fillable attributes of a given array.
protected
fillableFromArray(array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed>
Return values
array<string|int, mixed> —fillViewBagArray()
Copies view bag properties to the view bag array.
protected
fillViewBagArray() : void
This is required for the back-end editors.
Return values
void —finishSave()
Finish processing on a successful save operation.
protected
finishSave(array<string|int, mixed> $options) : void
Parameters
- $options : array<string|int, mixed>
Return values
void —fireModelEvent()
Fire the given event for the model.
protected
fireModelEvent(string $event[, bool $halt = true ]) : mixed
Parameters
- $event : string
- $halt : bool = true
Return values
mixed —getArrayableAppends()
Get all of the appendable values that are arrayable.
protected
getArrayableAppends() : array<string|int, mixed>
Return values
array<string|int, mixed> —getAttributeFromArray()
Get an attribute from the $attributes array.
protected
getAttributeFromArray(string $key) : mixed
Parameters
- $key : string
Return values
mixed —getValidationAttributes()
Returns the model data used for validation.
protected
getValidationAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —makeValidator()
Instantiates the validator used by the validation process, depending if the class is being used inside or outside of Laravel.
protected
static makeValidator(mixed $data, mixed $rules, mixed $customMessages, mixed $attributeNames) : Validator
Parameters
- $data : mixed
- $rules : mixed
- $customMessages : mixed
- $attributeNames : mixed
Return values
Validator —mutateAttribute()
Get the value of an attribute using its mutator.
protected
mutateAttribute(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
Return values
mixed —mutateAttributeForArray()
Get the value of an attribute using its mutator for array conversion.
protected
mutateAttributeForArray(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
Return values
mixed —originalIsNumericallyEquivalent()
Determine if the new and old values for a given key are numerically equivalent.
protected
originalIsNumericallyEquivalent(string $key) : bool
Parameters
- $key : string
Return values
bool —parseComponentSettings()
Parse component sections.
protected
parseComponentSettings() : void
Replace the multiple component sections with a single "components" element in the $settings property.
Return values
void —parseSettings()
Parses the settings array.
protected
parseSettings() : void
Child classes can override this method in order to update the content of the $settings property after the object is loaded from a file.
Return values
void —performDeleteOnModel()
Perform the actual delete query on this model instance.
protected
performDeleteOnModel() : void
Return values
void —performInsert()
Perform a model insert operation.
protected
performInsert(Builder $query[, array<string|int, mixed> $options = [] ]) : bool
Parameters
- $query : Builder
- $options : array<string|int, mixed> = []
Return values
bool —performUpdate()
Perform a model update operation.
protected
performUpdate(Builder $query[, array<string|int, mixed> $options = [] ]) : bool
Parameters
- $query : Builder
- $options : array<string|int, mixed> = []
Return values
bool —processRuleFieldNames()
Processes field names in a rule array.
protected
processRuleFieldNames(array<string|int, mixed> $rules) : array<string|int, mixed>
Converts any field names using array notation (ie. field[child]) into dot notation (ie. field.child)
Parameters
- $rules : array<string|int, mixed>
-
Rules array
Return values
array<string|int, mixed> —processValidationRules()
Process rules
protected
processValidationRules(mixed $rules) : mixed
Parameters
- $rules : mixed
Return values
mixed —registerModelEvent()
Register a model event with the dispatcher.
protected
static registerModelEvent(string $event, Closure|string $callback, int $priority) : void
Parameters
- $event : string
- $callback : Closure|string
- $priority : int
Return values
void —throwHalcyonSaveException()
Converts an exception type thrown by Halcyon to a native CMS exception.
protected
throwHalcyonSaveException(Exception $ex) : mixed
Parameters
- $ex : Exception
Return values
mixed —validateSettings()
If the model is loaded with an invalid INI section, the invalid content will be passed as a special attribute. Look for it, then locate the failure reason.
protected
validateSettings() : void