Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
spacecompositiontable.php
1
<?php
2
namespace
Bitrix\Socialnetwork\Internals\Space\Composition
;
3
4
use
Bitrix\Main\ArgumentException
;
5
use
Bitrix\Main\ObjectPropertyException
;
6
use
Bitrix\Main\ORM\Data\DataManager
;
7
use
Bitrix\Main\ORM\Data\Result
;
8
use
Bitrix\Main\ORM\Fields\ArrayField
;
9
use
Bitrix\Main\ORM\Fields\IntegerField
;
10
use
Bitrix\Main\SystemException
;
11
39
class
SpaceCompositionTable
extends
DataManager
40
{
44
public
static
function
getTableName
(): string
45
{
46
return
'b_sonet_space_composition'
;
47
}
48
52
public
static
function
getMap
(): array
53
{
54
return
[
55
(
new
IntegerField
(
'ID'
))
56
->configurePrimary()
57
->configureAutocomplete(),
58
(
new
IntegerField
(
'USER_ID'
))
59
->configureRequired(),
60
(
new
IntegerField
(
'SPACE_ID'
))
61
->configureRequired(),
62
(
new
ArrayField
(
'SETTINGS'
))
63
->configureRequired()
64
->configureSerializationJson(),
65
];
66
}
67
68
public
static
function
getObjectClass
(): string
69
{
70
return
SpaceCompositionObject::class;
71
}
72
73
public
static
function
getCollectionClass
(): string
74
{
75
return
SpaceCompositionCollection::class;
76
}
77
83
public
static
function
isDataFilled
(
int
$userId,
int
$spaceId): bool
84
{
85
$composition = static::getByIds($userId, $spaceId);
86
87
return
!is_null($composition);
88
}
89
90
public
static
function
fill
(
int
$userId,
int
$spaceId, array $settings):
Result
91
{
92
$composition = (
new
SpaceCompositionObject
())
93
->setUserId($userId)
94
->setSpaceId($spaceId)
95
->setSettings($settings);
96
97
return
$composition->save();
98
}
99
105
public
static
function
getByIds
(
int
$userId,
int
$spaceId = 0): ?
SpaceCompositionObject
106
{
107
$query = static::query();
108
$query
109
->setSelect([
'*'
])
110
->where(
'USER_ID'
, $userId)
111
->where(
'SPACE_ID'
, $spaceId)
112
->setLimit(1);
113
114
return
$query->exec()->fetchObject();
115
}
116
}
Bitrix\Main\ArgumentException
Definition
exception.php:34
Bitrix\Main\ORM\Data\DataManager
Definition
datamanager.php:33
Bitrix\Main\ORM\Data\Result
Definition
result.php:16
Bitrix\Main\ORM\Fields\ArrayField
Definition
arrayfield.php:19
Bitrix\Main\ORM\Fields\IntegerField
Definition
integerfield.php:20
Bitrix\Main\ObjectPropertyException
Definition
exception.php:181
Bitrix\Main\SystemException
Definition
exception.php:8
Bitrix\Socialnetwork\Internals\Space\Composition\SpaceCompositionObject
Definition
spacecompositionobject.php:6
Bitrix\Socialnetwork\Internals\Space\Composition\SpaceCompositionTable
Definition
spacecompositiontable.php:40
Bitrix\Socialnetwork\Internals\Space\Composition\SpaceCompositionTable\getByIds
static getByIds(int $userId, int $spaceId=0)
Definition
spacecompositiontable.php:105
Bitrix\Socialnetwork\Internals\Space\Composition\SpaceCompositionTable\fill
static fill(int $userId, int $spaceId, array $settings)
Definition
spacecompositiontable.php:90
Bitrix\Socialnetwork\Internals\Space\Composition\SpaceCompositionTable\getMap
static getMap()
Definition
spacecompositiontable.php:52
Bitrix\Socialnetwork\Internals\Space\Composition\SpaceCompositionTable\isDataFilled
static isDataFilled(int $userId, int $spaceId)
Definition
spacecompositiontable.php:83
Bitrix\Socialnetwork\Internals\Space\Composition\SpaceCompositionTable\getObjectClass
static getObjectClass()
Definition
spacecompositiontable.php:68
Bitrix\Socialnetwork\Internals\Space\Composition\SpaceCompositionTable\getTableName
static getTableName()
Definition
spacecompositiontable.php:44
Bitrix\Socialnetwork\Internals\Space\Composition\SpaceCompositionTable\getCollectionClass
static getCollectionClass()
Definition
spacecompositiontable.php:73
Bitrix\Socialnetwork\Internals\Space\Composition
Definition
spacecompositioncollection.php:3
modules
socialnetwork
lib
internals
space
composition
spacecompositiontable.php
Создано системой
1.10.0