2namespace Bitrix\Location\Model;
5 Bitrix\Main\ORM\Fields;
6use Bitrix\Main\Application;
7use Bitrix\Main\ORM\Fields\Relations\Reference;
8use Bitrix\Main\ORM\Query\Join;
46 return 'b_location_hierarchy';
59 ->configurePrimary(
true),
62 ->configurePrimary(
true),
65 ->configureRequired(
true),
69 (
new Reference(
'ANCESTOR', LocationTable::class,
70 Join::on(
'this.ANCESTOR_ID',
'ref.ID')))
71 ->configureJoinType(
'inner'),
73 (
new Reference(
'DESCENDANT', LocationTable::class,
74 Join::on(
'this.DESCENDANT_ID',
'ref.ID')))
75 ->configureJoinType(
'inner')
88 foreach (
$data as $row)
90 if((
int)$row[
'ANCESTOR_ID'] <= 0 || (
int)$row[
'DESCENDANT_ID'] <= 0)
95 $values[] = (int)$row[
'ANCESTOR_ID'].
', '.(
int)$row[
'DESCENDANT_ID'].
', '.(int)$row[
'LEVEL'];
100 $values =
'(' . implode(
'), (', $values) .
')';
101 $sql =
"INSERT IGNORE INTO " . static::getTableName() .
" (ANCESTOR_ID, DESCENDANT_ID, LEVEL) VALUES " . $values;
102 Application::getConnection()->queryExecute($sql);
112 $locationId = (int)$locationId;
114 Application::getConnection()->queryExecute(
"
116 FROM ".self::getTableName().
"
117 WHERE ANCESTOR_ID=".$locationId.
"
118 OR DESCENDANT_ID = ".$locationId
static deleteByLocationId(int $locationId)
static insertBatch(array $data)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)