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.
use Phalcon\Di; use Phalcon\Mvc\Model\Manager as ModelsManager; $di = new Di(); $di->set( "modelsManager", function() { return new ModelsManager(); } ); $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
Check whether a model property is declared as public.
$isPublic = $manager->isVisibleModelProperty( new Robots(), "name" );
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 read data related to a model
Returns the connection to write data related to a model
Returns the connection to read or write data related to a model depending on the connection services.
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
Returns the connection service name used to read or write data related to a model depending on the connection services
Receives events generated in the models and dispatches them to an events-manager if available Notify the behaviors that are listening in the model
Dispatch an event to the listeners and behaviors This method expects that the endpoint listeners/behaviors returns true meaning that a least one was 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
Merge two arrays of find parameters
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 last 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 current PHQL cache
© 2011–2017 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/latest/api/Phalcon_Mvc_Model_Manager.html