\Vegas\Db\DecoratorCollectionAbstract

Class CollectionAbstract

Summary

Methods
Properties
Constants
addMapping()
removeMapping()
hasMapping()
clearMappings()
resolveMapping()
toMappedArray()
readMapped()
generateSlug()
writeAttributes()
beforeCreate()
beforeUpdate()
No public properties found
No constants found
No protected methods found
$mappings
N/A
No private methods found
No private properties found
N/A

Properties

$mappings

$mappings : array

Defines field mappings in format

array(

 'field_1' => 'mapper_1',
 'field_2' => array('mapper_1', 'mapper_2')

)

Type

array

Methods

addMapping()

addMapping( $attributeName,  $mappings) : $this

Adds mapping for indicated attribute

Parameters

$attributeName
$mappings

Returns

$this

removeMapping()

removeMapping( $attributeName) : $this

Removes mapping from indicated attribute

Parameters

$attributeName

Returns

$this

hasMapping()

hasMapping( $attributeName) : boolean

Determines if attribute has defined mapping

Parameters

$attributeName

Returns

boolean

clearMappings()

clearMappings() : $this

Clear mappings

Returns

$this

resolveMapping()

resolveMapping( $attributeName,  $value) : mixed

Filter value of indicated attribute by applying defined mappings

Parameters

$attributeName
$value

Returns

mixed

toMappedArray()

toMappedArray() : array

Returns array of attributes with mapped values

Returns

array

readMapped()

readMapped( $name) : mixed

Returns mapped value of attribute

Parameters

$name

Returns

mixed

generateSlug()

generateSlug( $string) : mixed

Creates a slug to be used for pretty URLs

Parameters

$string

Returns

mixed

writeAttributes()

writeAttributes( $attributes)

Simple method that sets attributes from specified array

Parameters

$attributes

beforeCreate()

beforeCreate()

Event fired when record is being created

beforeUpdate()

beforeUpdate()

Event fired when record is being updated