1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
loader.php
См. документацию.
1<?php
8
9namespace Bitrix\Main\ORM;
10
11use Bitrix\Main\ORM\Data\DataManager;
12
19class Loader
20{
22 protected static $predefinedObjectClass;
23
26
27 public static function autoLoad($class)
28 {
29 // break recursion
30 if (str_ends_with($class, 'Table'))
31 {
32 return;
33 }
34
35 if (!str_contains($class, '\\'))
36 {
37 // define global namespace explicitly
38 $class = '\\'.$class;
39 }
40
41 $namespace = substr($class, 0, strrpos($class, '\\') + 1);
42 $className = substr($class, strrpos($class, '\\') + 1);
43
44 if (str_starts_with($className, 'EO_'))
45 {
46 $needFor = 'object';
47
48 if ($className == 'EO_NNM_Object')
49 {
50 // entity without name, defined by namespace
51 $entityName = '';
52 }
53 elseif (substr($className, -11) == '_Collection')
54 {
55 $needFor = 'collection';
56 $entityName = substr($className, 3, -11);
57 }
58 else
59 {
60 $entityName = substr($className, 3);
61 }
62
63 $entityName .= 'Table';
64 $entityClass = $namespace.$entityName;
65
66 if (class_exists($entityClass) && is_subclass_of($entityClass, DataManager::class))
67 {
68 ($needFor == 'object')
69 ? Entity::compileObjectClass($entityClass)
70 : Entity::compileCollectionClass($entityClass);
71 }
72 }
73 }
74
75 public static function registerObjectClass($objectClass, $entityClass)
76 {
77 static::$predefinedObjectClass[strtolower(Entity::normalizeName($objectClass))] = $entityClass;
78 }
79
80 public static function registerCollectionClass($collectionClass, $entityClass)
81 {
82 static::$predefinedCollectionClass[strtolower(Entity::normalizeName($collectionClass))] = $entityClass;
83 }
84}
Определения loader.php:13
static compileObjectClass($dataClass)
Определения entity.php:1158
static normalizeName($entityName)
Определения entity.php:877
static compileCollectionClass($dataClass)
Определения entity.php:1196
static $predefinedCollectionClass
Определения loader.php:25
static registerObjectClass($objectClass, $entityClass)
Определения loader.php:75
static $predefinedObjectClass
Определения loader.php:22
static registerCollectionClass($collectionClass, $entityClass)
Определения loader.php:80
static autoLoad($class)
Определения loader.php:27
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393