1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
storedocumentspecifictable.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Catalog\Document\Type;
4
5
use Bitrix\Catalog\StoreDocumentTable;
6
use Bitrix\Main\Error;
7
use Bitrix\Main\Localization\Loc;
8
use Bitrix\Main\NotImplementedException;
9
use Bitrix\Main\ORM\Data\DeleteResult;
10
use Bitrix\Main\ORM\Data\UpdateResult;
11
12
/*
13
* This class' children are meant to be used to work with a specific document type.
14
* Each document type has its own user fields set, so they need to have their own separate ORM classes.
15
* If you need to select all documents/a set of documents regardless of their type,
16
* use \Bitrix\Catalog\StoreDocumentTable; however, do note that it doesn't support user fields.
17
*/
18
abstract
class
StoreDocumentSpecificTable
extends
StoreDocumentTable
19
{
20
abstract
public
static
function
getType
(): string;
21
22
public
static
function
getUfId
()
23
{
24
return
'CAT_STORE_DOCUMENT_'
. static::getType();
25
}
26
27
public
static
function
setDefaultScope
(
$query
)
28
{
29
$query
->where(
'DOC_TYPE'
, static::getType());
30
}
31
32
public
static
function
add
(
array
$data
)
33
{
34
$data
[
'DOC_TYPE'
] = static::getType();
35
return
parent::add(
$data
);
36
}
37
38
public
static
function
update
($primary,
array
$data
)
39
{
40
$result
=
new
UpdateResult
();
41
42
$documentType =
self::getByPrimary
($primary, [
'select'
=> [
'DOC_TYPE'
]])->fetch();
43
if
(!$documentType)
44
{
45
$result
->addError(
new
Error
(Loc::getMessage(
'STORE_DOCUMENT_SPECIFIC_TABLE_DOC_NOT_FOUND_ERROR'
)));
46
47
return
$result
;
48
}
49
50
if
($documentType[
'DOC_TYPE'
] !== static::getType())
51
{
52
$result
->addError(
new
Error
(Loc::getMessage(
'STORE_DOCUMENT_SPECIFIC_TABLE_WRONG_DOC_TYPE_ERROR'
)));
53
54
return
$result
;
55
}
56
57
if
(isset(
$data
[
'DOC_TYPE'
]))
58
{
59
unset(
$data
[
'DOC_TYPE'
]);
60
}
61
62
return
parent::update($primary,
$data
);
63
}
64
65
public
static
function
delete
($primary)
66
{
67
$result
=
new
DeleteResult
();
68
69
$documentType =
self::getByPrimary
($primary, [
'select'
=> [
'DOC_TYPE'
]])->fetch();
70
if
(!$documentType)
71
{
72
$result
->addError(
new
Error
(Loc::getMessage(
'STORE_DOCUMENT_SPECIFIC_TABLE_DOC_NOT_FOUND_ERROR'
)));
73
74
return
$result
;
75
}
76
77
if
($documentType[
'DOC_TYPE'
] !== static::getType())
78
{
79
$result
->addError(
new
Error
(Loc::getMessage(
'STORE_DOCUMENT_SPECIFIC_TABLE_WRONG_DOC_TYPE_ERROR'
)));
80
81
return
$result
;
82
}
83
84
return
parent::delete($primary);
85
}
86
}
Bitrix\Catalog\Document\Type\StoreDocumentSpecificTable
Определения
storedocumentspecifictable.php:19
Bitrix\Catalog\Document\Type\StoreDocumentSpecificTable\setDefaultScope
static setDefaultScope($query)
Определения
storedocumentspecifictable.php:27
Bitrix\Catalog\Document\Type\StoreDocumentSpecificTable\getUfId
static getUfId()
Определения
storedocumentspecifictable.php:22
Bitrix\Catalog\Document\Type\StoreDocumentSpecificTable\getType
static getType()
Bitrix\Catalog\Document\Type\StoreDocumentSpecificTable\add
static add(array $data)
Определения
storedocumentspecifictable.php:32
Bitrix\Catalog\Document\Type\StoreDocumentSpecificTable\update
static update($primary, array $data)
Определения
storedocumentspecifictable.php:38
Bitrix\Catalog\StoreDocumentTable
Определения
storedocumenttable.php:64
Bitrix\Main\Error
Определения
error.php:15
Bitrix\Main\ORM\Data\DataManager\getByPrimary
static getByPrimary($primary, array $parameters=array())
Определения
datamanager.php:330
Bitrix\Main\ORM\Data\DeleteResult
Определения
deleteresult.php:12
Bitrix\Main\ORM\Data\UpdateResult
Определения
updateresult.php:14
$data
$data['IS_AVAILABLE']
Определения
.description.php:13
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
$query
$query
Определения
get_search.php:11
bitrix
modules
catalog
lib
document
type
storedocumentspecifictable.php
Создано системой
1.14.0