implements Phalcon\Mvc\Model\ManagerInterface, Phalcon\DI\InjectionAwareInterface, Phalcon\Events\EventsAwareInterface
This components controls the initialization of models, keeping record of relations between the different models of the application. A ModelsManager is injected to a model via a Dependency Injector/Services Container such as Phalcon\DI.
$di = new Phalcon\DI(); $di->set('modelsManager', function() { return new Phalcon\Mvc\Model\Manager(); }); $robot = new Robots($di);
Sets the DependencyInjector container
Returns the DependencyInjector container
Sets a global events manager
Returns the internal event manager
Sets a custom events manager for a specific model
Returns a custom events manager related to a model
Initializes a model in the model manager
Check whether a model is already initialized
Get last initialized model
Loads a model throwing an exception if it doesn’t exist
Sets the mapped source for a model
Returns the mapped source for a model
Sets the mapped schema for a model
Returns the mapped schema for a model
Sets both write and read connection service for a model
Sets write connection service for a model
Sets read connection service for a model
Returns the connection to write data related to a model
Returns the connection to read data related to a model
Returns the connection service name used to read data related to a model
Returns the connection service name used to write data related to a model
Receives events generated in the models and dispatches them to a events-manager if available Notify the behaviors that are listening in the model
Dispatch a event to the listeners and behaviors This method expects that the endpoint listeners/behaviors returns true meaning that a least one is implemented
Binds a behavior to a model
Sets if a model must keep snapshots
Checks if a model is keeping snapshots for the queried records
Sets if a model must use dynamic update instead of the all-field update
Checks if a model is using dynamic update instead of all-field update
Setup a 1-1 relation between two models
Setup a relation reverse many to one between two models
Setup a relation 1-n between two models
Setups a relation n-m between two models
Checks whether a model has a belongsTo relation with another model
Checks whether a model has a hasMany relation with another model
Checks whether a model has a hasOne relation with another model
Checks whether a model has a hasManyToMany relation with another model
Returns a relation by its alias
Helper method to query records based on a relation definition
Returns a reusable object from the internal list
Stores a reusable record in the internal list
Clears the internal reusable list
Gets belongsTo related records from a model
Gets hasMany related records from a model
Gets belongsTo related records from a model
Gets all the belongsTo relations defined in a model
$relations = $modelsManager->getBelongsTo(new Robots());
Gets hasMany relations defined on a model
Gets hasOne relations defined on a model
Gets hasManyToMany relations defined on a model
Gets hasOne relations defined on a model
Query all the relationships defined on a model
Query the first relationship defined between two models
Creates a Phalcon\Mvc\Model\Query without execute it
Creates a Phalcon\Mvc\Model\Query and execute it
Creates a Phalcon\Mvc\Model\Query\Builder
Returns the lastest query created or executed in the models manager
Registers shorter aliases for namespaces in PHQL statements
Returns a real namespace from its alias
Returns all the registered namespace aliases
Destroys the PHQL cache
© 2011–2016 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/2.0.0/api/Phalcon_Mvc_Model_Manager.html