Documentation

Class Phalcon\Mvc\Model\MetaData\Memory

extends abstract class Phalcon\Mvc\Model\MetaData

implements Phalcon\Mvc\Model\MetaDataInterface, Phalcon\Di\InjectionAwareInterface, Phalcon\Events\EventsAwareInterface

Source on GitHub

Stores model meta-data in memory. Data will be erased when the request finishes

Constants

integer MODELS_ATTRIBUTES

integer MODELS_PRIMARY_KEY

integer MODELS_NON_PRIMARY_KEY

integer MODELS_NOT_NULL

integer MODELS_DATA_TYPES

integer MODELS_DATA_TYPES_NUMERIC

integer MODELS_DATE_AT

integer MODELS_DATE_IN

integer MODELS_IDENTITY_COLUMN

integer MODELS_DATA_TYPES_BIND

integer MODELS_AUTOMATIC_DEFAULT_INSERT

integer MODELS_AUTOMATIC_DEFAULT_UPDATE

integer MODELS_DATA_DEFAULT_VALUE

integer MODELS_DATA_SZIE

integer MODELS_DATA_SCALE

integer MODELS_DATA_BYTE

integer MODELS_COLUMN_MAP

integer MODELS_REVERSE_COLUMN_MAP

Methods

public __construct ([array $options])

Phalcon\Mvc\Model\MetaData\Memory constructor

public array read (string $key)

Reads the meta-data from temporal memory

public write (string $key, unknown $data)

Writes the meta-data to temporal memory

protected _initialize () inherited from Phalcon\Mvc\Model\MetaData

Initialize the metadata for certain table

public setStrategy (Phalcon\Mvc\Model\MetaData\Strategy\Introspection $strategy) inherited from Phalcon\Mvc\Model\MetaData

Set the meta-data extraction strategy

public Phalcon\Mvc\Model\MetaData\Strategy\Introspection getStrategy () inherited from Phalcon\Mvc\Model\MetaData

Return the strategy to obtain the meta-data

public array readMetaData (Phalcon\Mvc\ModelInterface $model) inherited from Phalcon\Mvc\Model\MetaData

Reads the complete meta-data for certain model

<?php

print_r($metaData->readMetaData(new Robots()));

public array readMetaDataIndex (Phalcon\Mvc\ModelInterface $model, int $index) inherited from Phalcon\Mvc\Model\MetaData

Reads meta-data for certain model

<?php

print_r($metaData->readMetaDataIndex(new Robots(), 0);

public writeMetaDataIndex (Phalcon\Mvc\ModelInterface $model, int $index, mixed $data, unknown $replace) inherited from Phalcon\Mvc\Model\MetaData

Writes meta-data for certain model using a MODEL_* constant

<?php

print_r($metaData->writeColumnMapIndex(new Robots(), MetaData::MODELS_REVERSE_COLUMN_MAP, array('leName' => 'name')));

public array readColumnMap (Phalcon\Mvc\ModelInterface $model) inherited from Phalcon\Mvc\Model\MetaData

Reads the ordered/reversed column map for certain model

<?php

print_r($metaData->readColumnMap(new Robots()));

public readColumnMapIndex (Phalcon\Mvc\ModelInterface $model, int $index) inherited from Phalcon\Mvc\Model\MetaData

Reads column-map information for certain model using a MODEL_* constant

<?php

print_r($metaData->readColumnMapIndex(new Robots(), MetaData::MODELS_REVERSE_COLUMN_MAP));

public array getAttributes (Phalcon\Mvc\ModelInterface $model) inherited from Phalcon\Mvc\Model\MetaData

Returns table attributes names (fields)

<?php

print_r($metaData->getAttributes(new Robots()));

public array getPrimaryKeyAttributes (Phalcon\Mvc\ModelInterface $model) inherited from Phalcon\Mvc\Model\MetaData

Returns an array of fields which are part of the primary key

<?php

print_r($metaData->getPrimaryKeyAttributes(new Robots()));

public array getNonPrimaryKeyAttributes (Phalcon\Mvc\ModelInterface $model) inherited from Phalcon\Mvc\Model\MetaData

Returns an arrau of fields which are not part of the primary key

<?php

print_r($metaData->getNonPrimaryKeyAttributes(new Robots()));

public array getNotNullAttributes (Phalcon\Mvc\ModelInterface $model) inherited from Phalcon\Mvc\Model\MetaData

Returns an array of not null attributes

<?php

print_r($metaData->getNotNullAttributes(new Robots()));

public boolean isNotNull (Phalcon\Mvc\ModelInterface $model, string $attribute) inherited from Phalcon\Mvc\Model\MetaData

Checks if the attribute is not null

<?php

var_dump($metaData->isNotNull(new Robots(), 'type');

public array getDataTypes (Phalcon\Mvc\ModelInterface $model) inherited from Phalcon\Mvc\Model\MetaData

Returns attributes and their data types

<?php

print_r($metaData->getDataTypes(new Robots()));

public int getDataType (Phalcon\Mvc\ModelInterface $model, string $attribute) inherited from Phalcon\Mvc\Model\MetaData

Returns attribute data type

<?php

print_r($metaData->getDataType(new Robots(), 'type'));

public array getDataSizes (Phalcon\Mvc\ModelInterface $model) inherited from Phalcon\Mvc\Model\MetaData

Returns attributes and their data sizes

<?php

print_r($metaData->getDataSizes(new Robots()));

public int getDataSize (Phalcon\Mvc\ModelInterface $model, string $attribute) inherited from Phalcon\Mvc\Model\MetaData

Returns attribute data size

<?php

print_r($metaData->getDataSize(new Robots(), 'type'));

public int getDataBytes (Phalcon\Mvc\ModelInterface $model) inherited from Phalcon\Mvc\Model\MetaData

Returns attributes and their data bytes

<?php

print_r($metaData->getDataBytes(new Robots()));

public int getDataByte (Phalcon\Mvc\ModelInterface $model, string $attribute) inherited from Phalcon\Mvc\Model\MetaData

Returns attribute data byte

<?php

print_r($metaData->getDataByte(new Robots(), 'type'));

public array getDataScales (Phalcon\Mvc\ModelInterface $model) inherited from Phalcon\Mvc\Model\MetaData

Returns attributes and their data scales

<?php

print_r($metaData->getDataScales(new Robots()));

public int getDataScale (Phalcon\Mvc\ModelInterface $model, string $attribute) inherited from Phalcon\Mvc\Model\MetaData

Returns attribute data scale

<?php

print_r($metaData->getDataScale(new Robots(), 'type'));

public array getDataTypesNumeric (Phalcon\Mvc\ModelInterface $model) inherited from Phalcon\Mvc\Model\MetaData

Returns attributes which types are numerical

<?php

print_r($metaData->getDataTypesNumeric(new Robots()));

public int isNumeric (Phalcon\Mvc\ModelInterface $model, string $attribute) inherited from Phalcon\Mvc\Model\MetaData

Checks if the attribute is numerical

<?php

var_dump($metaData->isNumeric(new Robots(), 'id'));

public string getIdentityField (Phalcon\Mvc\ModelInterface $model) inherited from Phalcon\Mvc\Model\MetaData

Returns the name of identity field (if one is present)

<?php

print_r($metaData->getIdentityField(new Robots()));

public array getBindTypes (Phalcon\Mvc\ModelInterface $model) inherited from Phalcon\Mvc\Model\MetaData

Returns attributes and their bind data types

<?php

print_r($metaData->getBindTypes(new Robots()));

public array getDefaultValues (Phalcon\Mvc\ModelInterface $model) inherited from Phalcon\Mvc\Model\MetaData

Returns attributes and their default values

<?php

print_r($metaData->getDefaultValues(new Robots()));

public array getAutomaticCreateAttributes (Phalcon\Mvc\ModelInterface $model) inherited from Phalcon\Mvc\Model\MetaData

Returns attributes that must be ignored from the INSERT SQL generation

<?php

print_r($metaData->getAutomaticCreateAttributes(new Robots()));

public array getAutomaticUpdateAttributes (Phalcon\Mvc\ModelInterface $model) inherited from Phalcon\Mvc\Model\MetaData

Returns attributes that must be ignored from the UPDATE SQL generation

<?php

print_r($metaData->getAutomaticUpdateAttributes(new Robots()));

public setAutomaticCreateAttributes (Phalcon\Mvc\ModelInterface $model, array $attributes, unknown $replace) inherited from Phalcon\Mvc\Model\MetaData

Set the attributes that must be ignored from the INSERT SQL generation

<?php

$metaData->setAutomaticCreateAttributes(new Robots(), array('created_at' => true));

public setAutomaticUpdateAttributes (Phalcon\Mvc\ModelInterface $model, array $attributes, unknown $replace) inherited from Phalcon\Mvc\Model\MetaData

Set the attributes that must be ignored from the UPDATE SQL generation

<?php

$metaData->setAutomaticUpdateAttributes(new Robots(), array('modified_at' => true));

public array getColumnMap (Phalcon\Mvc\ModelInterface $model) inherited from Phalcon\Mvc\Model\MetaData

Returns the column map if any

<?php

print_r($metaData->getColumnMap(new Robots()));

public array getReverseColumnMap (Phalcon\Mvc\ModelInterface $model) inherited from Phalcon\Mvc\Model\MetaData

Returns the reverse column map if any

<?php

print_r($metaData->getReverseColumnMap(new Robots()));

public boolean hasAttribute (Phalcon\Mvc\ModelInterface $model, string $attribute) inherited from Phalcon\Mvc\Model\MetaData

Check if a model has certain attribute

<?php

var_dump($metaData->hasAttribute(new Robots(), 'name'));

public string getAttribute (Phalcon\Mvc\ModelInterface $model, unknown $attribute) inherited from Phalcon\Mvc\Model\MetaData

Gets a model certain attribute

<?php

var_dump($metaData->getAttribute(new Robots(), 'name'));

public boolean hasRealAttribute (Phalcon\Mvc\ModelInterface $model, string $column) inherited from Phalcon\Mvc\Model\MetaData

Check if a model has real attribute name

<?php

var_dump($metaData->hasRealAttribute(new Robots(), 'name'));

public string getRealAttribute (Phalcon\Mvc\ModelInterface $model, string $column) inherited from Phalcon\Mvc\Model\MetaData

Gets a real attribute name

<?php

var_dump($metaData->getRealAttribute(new Robots(), 'name'));

public boolean isEmpty () inherited from Phalcon\Mvc\Model\MetaData

Checks if the internal meta-data container is empty

<?php

var_dump($metaData->isEmpty());

public reset () inherited from Phalcon\Mvc\Model\MetaData

Resets internal meta-data in order to regenerate it

<?php

$metaData->reset();

public setDI (Phalcon\DiInterface $dependencyInjector) inherited from Phalcon\Di\Injectable

Sets the dependency injector

public Phalcon\DiInterface getDI ([unknown $error], [unknown $notUseDefault]) inherited from Phalcon\Di\Injectable

Returns the internal dependency injector

public setEventsManager (Phalcon\Events\ManagerInterface $eventsManager) inherited from Phalcon\Di\Injectable

Sets the event manager

public Phalcon\Events\ManagerInterface getEventsManager () inherited from Phalcon\Di\Injectable

Returns the internal event manager

public boolean fireEvent (string $eventName, [unknown $data], [unknown $cancelable]) inherited from Phalcon\Di\Injectable

Fires an event, implicitly calls behaviors and listeners in the events manager are notified

public boolean fireEventCancel (string $eventName, [unknown $data], [unknown $cancelable]) inherited from Phalcon\Di\Injectable

Fires an event, implicitly calls behaviors and listeners in the events manager are notified This method stops if one of the callbacks/listeners returns boolean false

public mixed fireEventData (string $eventName, [mixed $data]) inherited from Phalcon\Di\Injectable

Fires an event, return data

public boolean hasService (string $name) inherited from Phalcon\Di\Injectable

Check whether the DI contains a service by a name

public Phalcon\Di\ServiceInterface setService (unknown $name) inherited from Phalcon\Di\Injectable

Sets a service from the DI

public object|null getService (unknown $name) inherited from Phalcon\Di\Injectable

Obtains a service from the DI

public mixed getResolveService (string $name, [unknown $args], [unknown $noerror], [unknown $noshared]) inherited from Phalcon\Di\Injectable

Resolves the service based on its configuration

public attachEvent (string $eventType, Closure $callback) inherited from Phalcon\Di\Injectable

Attach a listener to the events

public __get (unknown $property) inherited from Phalcon\Di\Injectable

Magic method __get

public __sleep () inherited from Phalcon\Di\Injectable

...

public __debugInfo () inherited from Phalcon\Di\Injectable

...