PHP Класс Mongolid\Manager

With the Mongolid\Manager, you can start using Mongolid with pure PHP by simply calling the addConnection method.
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$cacheComponent Mongolid\Util\CacheComponent Mongolid cache component object.
$connectionPool Mongolid\Connection\Pool Mongolid connection pool being object.
$container Illuminate\Contracts\Container Container being used by Mongolid.

Защищенные свойства (Protected)

Свойство Тип Описание
$schemas array Stores the schemas that have been registered for later use. This may be useful when using Mongolid DataMapper pattern.
$singleton Manager Singleton instance of the manager.

Открытые методы

Метод Описание
addConnection ( Connection $connection ) : boolean Main entry point to openning a connection and start using Mongolid in pure PHP. After adding a connection into the Manager you are ready to persist and query your models.
getConnection ( ) : MongoDB\Client Get the raw MongoDB connection.
getMapper ( string $entityClass ) : DataMapper | null Retrieves a DataMapper for the given $entityClass. This can only be done if the Schema for that entity has been previously registered with registerSchema() method.
registerSchema ( Schema $schema ) : void Allow document Schemas to be registered for later use.
setEventTrigger ( Mongolid\Event\EventTriggerInterface $eventTrigger ) : void Sets the event trigger for Mongolid events.

Защищенные методы

Метод Описание
init ( ) : void Initializes the Mongolid manager.

Описание методов

addConnection() публичный Метод

Main entry point to openning a connection and start using Mongolid in pure PHP. After adding a connection into the Manager you are ready to persist and query your models.
public addConnection ( Connection $connection ) : boolean
$connection Mongolid\Connection\Connection Connection instance to be used in database interactions.
Результат boolean Success

getConnection() публичный Метод

Get the raw MongoDB connection.
public getConnection ( ) : MongoDB\Client
Результат MongoDB\Client

getMapper() публичный Метод

Retrieves a DataMapper for the given $entityClass. This can only be done if the Schema for that entity has been previously registered with registerSchema() method.
public getMapper ( string $entityClass ) : DataMapper | null
$entityClass string Class of the entity that needs to be mapped.
Результат Mongolid\DataMapper\DataMapper | null DataMapper configured for the $entityClass.

init() защищенный Метод

Initializes the Mongolid manager.
protected init ( ) : void
Результат void

registerSchema() публичный Метод

Allow document Schemas to be registered for later use.
public registerSchema ( Schema $schema ) : void
$schema Mongolid\Schema\Schema Schema being registered.
Результат void

setEventTrigger() публичный Метод

Sets the event trigger for Mongolid events.
public setEventTrigger ( Mongolid\Event\EventTriggerInterface $eventTrigger ) : void
$eventTrigger Mongolid\Event\EventTriggerInterface External event trigger.
Результат void

Описание свойств

$cacheComponent публичное свойство

Mongolid cache component object.
public CacheComponent,Mongolid\Util $cacheComponent
Результат Mongolid\Util\CacheComponent

$connectionPool публичное свойство

Mongolid connection pool being object.
public Pool,Mongolid\Connection $connectionPool
Результат Mongolid\Connection\Pool

$container публичное свойство

Container being used by Mongolid.
public Container,Illuminate\Contracts $container
Результат Illuminate\Contracts\Container

$schemas защищенное свойство

Stores the schemas that have been registered for later use. This may be useful when using Mongolid DataMapper pattern.
protected array $schemas
Результат array

$singleton защищенное статическое свойство

Singleton instance of the manager.
protected static Manager,mongolid $singleton
Результат Manager