-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Поддержка множественных свойств инфоблоков
- Loading branch information
1 parent
20ff23b
commit d2a2bd1
Showing
6 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/main/Iblock/Property/DynamicMultiplePropertiesTable.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
/** @noinspection PhpMissingReturnTypeInspection */ | ||
|
||
namespace WebArch\BitrixOrmTools\Iblock\Property; | ||
|
||
use Bitrix\Main\ORM\Data\DataManager; | ||
use Bitrix\Main\ORM\Fields\Field; | ||
use Bitrix\Main\ORM\Fields\IntegerField; | ||
use Bitrix\Main\ORM\Fields\StringField; | ||
use Bitrix\Main\ORM\Fields\TextField; | ||
|
||
abstract class DynamicMultiplePropertiesTable extends DataManager | ||
{ | ||
protected const TABLE_PREFIX = 'b_iblock_element_prop_m'; | ||
|
||
/** | ||
* Возвращает id инфоблока. | ||
* | ||
* @return int | ||
*/ | ||
abstract public static function getIblockId(): int; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public static function getTableName() | ||
{ | ||
return self::TABLE_PREFIX . static::getIblockId(); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
* @return array<string, Field> | ||
*/ | ||
public static function getMap() | ||
{ | ||
return [ | ||
'ID' => (new IntegerField('ID'))->configurePrimary(true) | ||
->configureAutocomplete(true) | ||
->configureRequired(false), | ||
'IBLOCK_ELEMENT_ID' => (new IntegerField('IBLOCK_ELEMENT_ID'))->configureRequired(true), | ||
'IBLOCK_PROPERTY_ID' => (new IntegerField('IBLOCK_PROPERTY_ID'))->configureRequired(true), | ||
'VALUE' => (new TextField('VALUE'))->configureRequired(true), | ||
'VALUE_ENUM' => (new IntegerField('VALUE_ENUM')), | ||
'VALUE_NUM' => (new IntegerField('VALUE_NUM')), | ||
'DESCRIPTION' => (new StringField('DESCRIPTION'))->configureSize(255), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/test/Fixture/DynamicMultiplePropertiesTableFixture.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace WebArch\BitrixOrmTools\Test\Fixture; | ||
|
||
use WebArch\BitrixOrmTools\Iblock\Property\DynamicMultiplePropertiesTable; | ||
|
||
class DynamicMultiplePropertiesTableFixture extends DynamicMultiplePropertiesTable | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public static function getIblockId(): int | ||
{ | ||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace WebArch\BitrixOrmTools\Test\Fixture; | ||
|
||
use WebArch\BitrixOrmTools\Iblock\Property\DynamicSinglePropertiesTable; | ||
|
||
class DynamicSinglePropertiesTableFixture extends DynamicSinglePropertiesTable | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public static function getIblockId(): int | ||
{ | ||
return 0; | ||
} | ||
} | ||
|