Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
booktable.php
1<?php
10
20
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}