Documentation

Registry

Description and example

Class for factory instance storage. Singleton.

Instance collection is performed via the event onGetUserFieldTypeFactory.

Example of adding own factory

Fully operational diagram is available in the RPA module.


Bitrix\Main\EventManager::getInstance()->addEventHandler('main', 'onGetUserFieldTypeFactory', static function(){
    return [
        new MyFactory(),
    ];
});

Methods

Method Description Available from version
public static function getInstance(): Registry Returns an instance
public function registerFactory(TypeFactory $factory) Registers new factory
public function registerTypeByEntity(Entity $entity, array $type): void Adds information to internal storage on the type $type by compiled entity $entity of item data manager.
public function getTypeByEntity(Entity $entity): ?array Returns information on the type of compiled entity $entity of entity data manager
public function getFactoryByCode(string $code): ?TypeFactory Returns factory instance by its string ID $code
public function getFactoryByTypeDataClass($typeDataClass): ?TypeFactory Returns factory instance by data manager class for types
public function getUserFieldEntityIdByItemEntity(Entity $entity): ?string Returns user fields string ID for compiled entity $entity


© «Bitrix24», 2001-2024
Up