Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
userprofilerecord.php
1<?php
9namespace Bitrix\Main;
10
12
31class UserProfileRecordTable extends Entity\DataManager
32{
33 public static function getTableName()
34 {
35 return 'b_user_profile_record';
36 }
37
38 public static function getMap()
39 {
40 return array(
41 new Entity\IntegerField("ID", array(
42 'primary' => true,
43 'autocomplete' => true,
44 )),
45 new Entity\IntegerField("HISTORY_ID", array(
46 'required' => true,
47 )),
48 new Entity\StringField("FIELD"),
49 new Entity\TextField('DATA', array(
50 'serialized' => true
51 )),
52 new Entity\ReferenceField("HISTORY",
53 '\Bitrix\Main\UserProfileHistoryTable',
54 array('=this.HISTORY_ID' => 'ref.ID'),
55 array('join_type' => 'INNER')
56 ),
57 );
58 }
59
60 public static function deleteByHistoryFilter($where)
61 {
62 if($where == '')
63 {
64 throw new ArgumentException("Deleting by empty filter is not allowed, use truncate (b_user_profile_record).", "where");
65 }
66
67 $entity = static::getEntity();
68 $conn = $entity->getConnection();
69
70 $conn->query("
71 DELETE R FROM b_user_profile_record R
72 WHERE R.HISTORY_ID IN(
73 SELECT ID FROM b_user_profile_history
74 {$where}
75 )"
76 );
77
78 $entity->cleanCache();
79 }
80}