\Vegas\Db\DecoratorModelAbstract

Class ModelAbstract

Summary

Methods
Properties
Constants
addMapping()
removeMapping()
hasMapping()
clearMappings()
resolveMapping()
toMappedArray()
readMapped()
generateSlug()
writeAttributes()
beforeCreate()
beforeUpdate()
findById()
getId()
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

findById()

findById( $id) : \Phalcon\Mvc\Model\ResultsetInterface

Finds record by its ID

Parameters

$id

Returns

\Phalcon\Mvc\Model\ResultsetInterface

getId()

getId() : \Phalcon\Mvc\Model\Resultset

Returns ID

Returns

\Phalcon\Mvc\Model\Resultset