Server IP : 85.193.89.191 / Your IP : 18.118.138.16 Web Server : Apache System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : bitrix ( 600) PHP Version : 8.1.27 Disable Function : NONE MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/bitrix/www/bitrix/modules/main/lib/orm/ |
Upload File : |
<?php /** * Bitrix Framework * @package bitrix * @subpackage main * @copyright 2001-2018 Bitrix */ namespace Bitrix\Main\ORM; use Bitrix\Main\ORM\Data\DataManager; /** * Loads (generates) entity object or collection classes * * @package bitrix * @subpackage main */ class Loader { /** @var DataManager[] Entity registers its object class on init */ protected static $predefinedObjectClass; /** @var DataManager[] Entity registers its collection class on init */ protected static $predefinedCollectionClass; public static function autoLoad($class) { // break recursion if (substr($class, -5) == 'Table') { return; } if (strpos($class, '\\') === false) { // define global namespace explicitly $class = '\\'.$class; } $namespace = substr($class, 0, strrpos($class, '\\') + 1); $className = substr($class, strrpos($class, '\\') + 1); if (substr($className, 0, 3) == 'EO_') { $needFor = 'object'; if ($className == 'EO_NNM_Object') { // entity without name, defined by namespace $entityName = ''; } elseif (substr($className, -11) == '_Collection') { $needFor = 'collection'; $entityName = substr($className, 3, -11); } else { $entityName = substr($className, 3); } $entityName .= 'Table'; $entityClass = $namespace.$entityName; if (class_exists($entityClass) && is_subclass_of($entityClass, DataManager::class)) { ($needFor == 'object') ? Entity::compileObjectClass($entityClass) : Entity::compileCollectionClass($entityClass); } } } public static function registerObjectClass($objectClass, $entityClass) { static::$predefinedObjectClass[strtolower(Entity::normalizeName($objectClass))] = $entityClass; } public static function registerCollectionClass($collectionClass, $entityClass) { static::$predefinedCollectionClass[strtolower(Entity::normalizeName($collectionClass))] = $entityClass; } }