Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
workgrouppin.php
1<?php
9
13
30class WorkgroupPinTable extends Entity\DataManager
31{
32 public static function getTableName(): string
33 {
34 return 'b_sonet_group_pin';
35 }
36
37 public static function getMap(): array
38 {
39 return [
40 'ID' => [
41 'data_type' => 'integer',
42 'primary' => true,
43 'autocomplete' => true,
44 ],
45 'USER_ID' => [
46 'data_type' => 'integer',
47 ],
48 'USER' => [
49 'data_type' => '\Bitrix\Main\User',
50 'reference' => [ '=this.USER_ID' => 'ref.ID' ],
51 ],
52 'GROUP_ID' => [
53 'data_type' => 'integer',
54 ],
55 'GROUP' => [
56 'data_type' => '\Bitrix\Socialnetwork\Workgroup',
57 'reference' => [ '=this.GROUP_ID' => 'ref.ID' ],
58 ],
59 'CONTEXT' => [
60 'data_type' => 'string',
61 ],
62 ];
63 }
64
65 public static function getSelectExpression(): string
66 {
67 $tableName = static::getTableName();
68
69 return "
70 CASE WHEN
71 EXISTS(
72 SELECT 'x'
73 FROM {$tableName}
74 WHERE
75 GROUP_ID = %s
76 AND USER_ID = %s
77 AND CONTEXT = %s
78 )
79 THEN 'Y'
80 ELSE 'N'
81 END
82 ";
83 }
84
85 public static function getObjectClass(): string
86 {
87 return Pin::class;
88 }
89
90 public static function getCollectionClass(): string
91 {
92 return PinCollection::class;
93 }
94}