Table Of Contents

Previous topic

< Interface Phalcon\Mvc\Micro\MiddlewareInterface

Next topic

Interface Phalcon\Mvc\Model\BehaviorInterface >

Interface Phalcon\Mvc\ModelInterface

Phalcon\Mvc\ModelInterface initializer

Methods

abstract public Phalcon\Mvc\ModelInterface setTransaction (Phalcon\Mvc\Model\TransactionInterface $transaction)

Sets a transaction related to the Model instance

abstract public string getSource ()

Returns table name mapped in the model

abstract public string getSchema ()

Returns schema name where table mapped is located

abstract public setConnectionService (string $connectionService)

Sets both read/write connection services

abstract public setWriteConnectionService (string $connectionService)

Sets the DependencyInjection connection service used to write data

abstract public setReadConnectionService (string $connectionService)

Sets the DependencyInjection connection service used to read data

abstract public string getReadConnectionService ()

Returns DependencyInjection connection service used to read data

abstract public string getWriteConnectionService ()

Returns DependencyInjection connection service used to write data

abstract public Phalcon\Db\AdapterInterface getReadConnection ()

Gets internal database connection

abstract public Phalcon\Db\AdapterInterface getWriteConnection ()

Gets internal database connection

abstract public Phalcon\Mvc\Model assign (array $data, [array $columnMap])

Assigns values to a model from an array

abstract public static Phalcon\Mvc\Model $result cloneResultMap (Phalcon\Mvc\Model $base, array $data, array $columnMap, [int $dirtyState], [boolean $keepSnapshots])

Assigns values to a model from an array returning a new model

abstract public static Phalcon\Mvc\Model cloneResult (Phalcon\Mvc\Model $base, array $data, [int $dirtyState])

Assigns values to a model from an array returning a new model

abstract public static cloneResultMapHydrate (array $data, array $columnMap, int $hydrationMode)

Returns an hydrated result based on the data and the column map

abstract public static Phalcon\Mvc\Model\ResultsetInterface find ([array $parameters])

Allows to query a set of records that match the specified conditions

abstract public static Phalcon\Mvc\ModelInterface findFirst ([array $parameters])

Allows to query the first record that match the specified conditions

abstract public static Phalcon\Mvc\Model\CriteriaInterface query ([Phalcon\DiInterface $dependencyInjector])

Create a criteria for a especific model

abstract public static int count ([array $parameters])

Allows to count how many records match the specified conditions

abstract public static double sum ([array $parameters])

Allows to calculate a summatory on a column that match the specified conditions

abstract public static mixed maximum ([array $parameters])

Allows to get the maximum value of a column that match the specified conditions

abstract public static mixed minimum ([array $parameters])

Allows to get the minimum value of a column that match the specified conditions

abstract public static double average ([array $parameters])

Allows to calculate the average value on a column matching the specified conditions

abstract public boolean fireEvent (string $eventName)

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

abstract public boolean fireEventCancel (string $eventName)

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

abstract public appendMessage (Phalcon\Mvc\Model\MessageInterface $message)

Appends a customized message on the validation process

abstract public boolean validationHasFailed ()

Check whether validation process has generated any messages

abstract public Phalcon\Mvc\Model\MessageInterface [] getMessages ([unknown $filter])

Returns all the validation messages

abstract public boolean save ([array $data], [array $whiteList])

Inserts or updates a model instance. Returning true on success or false otherwise.

abstract public boolean create ([array $data], [array $whiteList])

Inserts a model instance. If the instance already exists in the persistance it will throw an exception Returning true on success or false otherwise.

abstract public boolean update ([array $data], [array $whiteList])

Updates a model instance. If the instance doesn’t exist in the persistance it will throw an exception Returning true on success or false otherwise.

abstract public boolean delete ()

Deletes a model instance. Returning true on success or false otherwise.

abstract public int getOperationMade ()

Returns the type of the latest operation performed by the ORM Returns one of the OP_* class constants

abstract public refresh ()

Refreshes the model attributes re-querying the record from the database

abstract public mixed readAttribute (string $attribute)

Reads an attribute value by its name

abstract public writeAttribute (string $attribute, mixed $value)

Writes an attribute value by its name

abstract public Phalcon\Mvc\Model\ResultsetInterface getRelated (string $alias, [array $arguments])

Returns related records based on defined relations