1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
contactconnect.php
См. документацию.
1<?php
2namespace Bitrix\Socialservices;
3
4use Bitrix\Main;
5use Bitrix\Main\Entity;
6use Bitrix\Main\Type\DateTime;
7
8
37
38class ContactConnectTable extends Main\Entity\DataManager
39{
40 const TYPE_PORTAL = 'P'; // bitrix24 portal
41 const TYPE_EXTERNAL = 'E'; // external site (box)
42
48 public static function getTableName()
49 {
50 return 'b_socialservices_contact_connect';
51 }
52
58 public static function getMap()
59 {
60 return array(
61 'ID' => array(
62 'data_type' => 'integer',
63 'primary' => true,
64 'autocomplete' => true,
65 ),
66 'TIMESTAMP_X' => array(
67 'data_type' => 'datetime',
68 ),
69 'CONTACT_ID' => array(
70 'data_type' => 'integer',
71 ),
72 'LINK_ID' => array(
73 'data_type' => 'integer',
74 ),
75 'CONTACT_PROFILE_ID' => array(
76 'data_type' => 'integer',
77 'required' => true,
78 ),
79 'CONTACT_PORTAL' => array(
80 'data_type' => 'string',
81 'required' => true,
82 ),
83 'LAST_AUTHORIZE' => array(
84 'data_type' => 'datetime',
85 ),
86 'CONNECT_TYPE' => array(
87 'data_type' => 'enum',
88 'values' => array(static::TYPE_PORTAL, static::TYPE_EXTERNAL),
89 ),
90 'CONTACT' => array(
91 'data_type' => 'Bitrix\Socialservices\ContactTable',
92 'reference' => array('=this.CONTACT_ID' => 'ref.ID'),
93 ),
94 'LINK' => array(
95 'data_type' => 'Bitrix\Socialservices\UserLinkTable',
96 'reference' => array('=this.LINK_ID' => 'ref.ID'),
97 ),
98 );
99 }
100
101 public static function onBeforeUpdate(Entity\Event $event)
102 {
103 $result = new Entity\EventResult();
104 $data = $event->getParameter("fields");
105
106 if(!isset($data['TIMESTAMP_X']))
107 {
108 $data['TIMESTAMP_X'] = new DateTime();
109 $result->modifyFields($data);
110 }
111 }
112
113 public static function deleteByLink($linkId)
114 {
116 return $connection->query("
117DELETE
118FROM ".self::getTableName()."
119WHERE LINK_ID='".intval($linkId)."'
120");
121 }
122
123 public static function deleteByContact($contactId)
124 {
126 return $connection->query("
127DELETE
128FROM ".self::getTableName()."
129WHERE CONTACT_ID='".intval($contactId)."'
130");
131 }
132
133}
$connection
Определения actionsdefinitions.php:38
static getConnection($name="")
Определения application.php:638
Определения event.php:5
static onBeforeUpdate(Entity\Event $event)
Определения contactconnect.php:101
static deleteByContact($contactId)
Определения contactconnect.php:123
static deleteByLink($linkId)
Определения contactconnect.php:113
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
Определения ufield.php:9
$event
Определения prolog_after.php:141