Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
InsertSelectTrait.php
1
<?php
2
3
namespace
Bitrix\Im\V2\Common
;
4
5
use
Bitrix\Main\Application
;
6
use
Bitrix\Main\ORM\Query\Query
;
7
8
trait InsertSelectTrait
9
{
10
public
static
function
insertSelect(Query $query, array $fields,
bool
$isIgnore =
true
): void
11
{
12
$connection =
Application::getConnection
();
13
$helper = $connection->getSqlHelper();
14
$tableName = $helper->quote(static::getTableName());
15
$fields = implode(
', '
, array_map([$helper,
'quote'
], $fields));
16
17
if
($isIgnore)
18
{
19
$sql = $helper->getInsertIgnore(
20
$tableName,
21
" ({$fields}) "
,
22
$query->getQuery()
23
);
24
}
25
else
26
{
27
$sql =
"INSERT INTO {$tableName} ({$fields}) \n {$query->getQuery()} "
;
28
}
29
30
$connection->queryExecute($sql);
31
}
32
}
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\getConnection
static getConnection($name="")
Definition
application.php:611
Bitrix\Main\ORM\Query\Query
Definition
query.php:118
Bitrix\Im\V2\Common
Definition
ActiveRecordImplementation.php:3
modules
im
lib
V2
Common
InsertSelectTrait.php
Создано системой
1.10.0