Documentation

目次

前のトピックへ

< Class Phalcon\Mvc\Collection\Exception

次のトピックへ

Abstract class Phalcon\Mvc\Controller >

このページ

Class Phalcon\Mvc\Collection\Manager

implements 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 CollectionManager is injected to a model via a Dependency Injector Container such as Phalcon\DI.

<?php

 $di = new Phalcon\DI();

 $di->set('collectionManager', function(){
      return new Phalcon\Mvc\Collection\Manager();
 });

 $robot = new Robots($di);

Methods

public setDI (Phalcon\DiInterface $dependencyInjector)

Sets the DependencyInjector container

public Phalcon\DiInterface getDI ()

Returns the DependencyInjector container

public setEventsManager (Phalcon\Events\ManagerInterface $eventsManager)

Sets the event manager

public Phalcon\Events\ManagerInterface getEventsManager ()

Returns the internal event manager

public setCustomEventsManager (Phalcon\Mvc\CollectionInterface $model, Phalcon\Events\ManagerInterface $eventsManager)

Sets a custom events manager for a specific model

public Phalcon\Events\ManagerInterface getCustomEventsManager (Phalcon\Mvc\CollectionInterface $model)

Returns a custom events manager related to a model

public initialize (Phalcon\Mvc\CollectionInterface $model)

Initializes a model in the models manager

public bool isInitialized (string $modelName)

Check whether a model is already initialized

public Phalcon\Mvc\CollectionInterface getLastInitialized ()

Get the latest initialized model

public setConnectionService (Phalcon\Mvc\CollectionInterface $model, string $connectionService)

Sets a connection service for a specific model

public useImplicitObjectIds (Phalcon\Mvc\CollectionInterface $model, boolean $useImplicitObjectIds)

Sets if a model must use implicit objects ids

public boolean isUsingImplicitObjectIds (Phalcon\Mvc\CollectionInterface $model)

Checks if a model is using implicit object ids

public Phalcon\Db\AdapterInterface getConnection (Phalcon\Mvc\CollectionInterface $model)

Returns the connection related to a model

public notifyEvent (string $eventName, Phalcon\Mvc\CollectionInterface $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