Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
booktable.php
1
<?php
9
namespace
Bitrix\Main\Test\Typography
;
10
11
use
Bitrix\Main\ORM\Data\DataManager
;
12
use
Bitrix\Main\ORM\Fields\ArrayField
;
13
use
Bitrix\Main\ORM\Fields\BooleanField
;
14
use
Bitrix\Main\ORM\Fields\Relations\ManyToMany
;
15
use
Bitrix\Main\ORM\Fields\IntegerField
;
16
use
Bitrix\Main\ORM\Fields\Relations\OneToMany
;
17
use
Bitrix\Main\ORM\Query\Join
;
18
use
Bitrix\Main\ORM\Fields\Relations\Reference
;
19
use
Bitrix\Main\ORM\Fields\StringField
;
20
39
class
BookTable
extends
DataManager
40
{
41
public
static
function
getObjectClass
()
42
{
43
return
Book::class;
44
}
45
46
public
static
function
getCollectionClass
()
47
{
48
return
Books::class;
49
}
50
51
public
static
function
getUfId
()
52
{
53
return
'BOOK'
;
54
}
55
56
public
static
function
getTableName
()
57
{
58
return
'(
59
(SELECT 1 AS ID, "Title 1" AS TITLE, 253 AS PUBLISHER_ID, "978-3-16-148410-0" AS ISBN, "Y" AS IS_ARCHIVED,
60
"[\\"quote1\\",\\"quote2\\"]" AS QUOTES
61
)
62
UNION
63
(SELECT 2 AS ID, "Title 2" AS TITLE, 253 AS PUBLISHER_ID, "456-1-05-586920-1" AS ISBN, "N" AS IS_ARCHIVED,
64
"[\\"quote3\\",\\"quote4\\"]" AS QUOTES
65
)
66
)'
;
67
}
68
69
public
static
function
getMap
()
70
{
71
return
[
72
(
new
IntegerField
(
'ID'
))
73
->configurePrimary()
74
->configureAutocomplete(),
75
76
(
new
StringField
(
'TITLE'
)),
77
78
(
new
IntegerField
(
'PUBLISHER_ID'
)),
79
80
(
new
Reference
(
81
'PUBLISHER'
,
82
PublisherTable::class,
83
Join::on(
'this.PUBLISHER_ID'
,
'ref.ID'
)
84
))
85
->configureJoinType(
'inner'
),
86
87
(
new
StringField
(
'ISBN'
))
88
->configureUnique(),
89
90
(
new
BooleanField
(
'IS_ARCHIVED'
))
91
->configureValues(
'N'
,
'Y'
),
92
93
(
new
ArrayField
(
'QUOTES'
)),
94
95
(
new
ManyToMany
(
'AUTHORS'
, AuthorTable::class))
96
->configureMediatorTableName(
'(
97
(SELECT 1 AS BOOK_ID, 18 AS AUTHOR_ID)
98
UNION
99
(SELECT 2 AS BOOK_ID, 17 AS AUTHOR_ID)
100
UNION
101
(SELECT 2 AS BOOK_ID, 18 AS AUTHOR_ID)
102
)'
),
103
104
(
new
OneToMany
(
'STORE_ITEMS'
, StoreBookTable::class,
'BOOK'
))
105
];
106
}
107
}
Bitrix\Main\ORM\Data\DataManager
Definition
datamanager.php:33
Bitrix\Main\ORM\Fields\ArrayField
Definition
arrayfield.php:19
Bitrix\Main\ORM\Fields\BooleanField
Definition
booleanfield.php:20
Bitrix\Main\ORM\Fields\IntegerField
Definition
integerfield.php:20
Bitrix\Main\ORM\Fields\Relations\ManyToMany
Definition
manytomany.php:26
Bitrix\Main\ORM\Fields\Relations\OneToMany
Definition
onetomany.php:23
Bitrix\Main\ORM\Fields\Relations\Reference
Definition
reference.php:26
Bitrix\Main\ORM\Fields\StringField
Definition
stringfield.php:20
Bitrix\Main\ORM\Query\Join
Definition
join.php:19
Bitrix\Main\Test\Typography\BookTable
Definition
booktable.php:40
Bitrix\Main\Test\Typography\BookTable\getMap
static getMap()
Definition
booktable.php:69
Bitrix\Main\Test\Typography\BookTable\getUfId
static getUfId()
Definition
booktable.php:51
Bitrix\Main\Test\Typography\BookTable\getObjectClass
static getObjectClass()
Definition
booktable.php:41
Bitrix\Main\Test\Typography\BookTable\getTableName
static getTableName()
Definition
booktable.php:56
Bitrix\Main\Test\Typography\BookTable\getCollectionClass
static getCollectionClass()
Definition
booktable.php:46
Bitrix\Main\Test\Typography
Definition
authortable.php:9
modules
main
lib
test
typography
booktable.php
Создано системой
1.10.0