Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/yandex.market/lib/export/run/storage/ |
Upload File : |
<?php namespace Yandex\Market\Export\Run\Storage; use Bitrix\Main; use Yandex\Market; class GiftTable extends Market\Reference\Storage\Table { public static function getTableName() { return 'yamarket_export_run_gift'; } public static function createIndexes(Main\DB\Connection $connection) { $tableName = static::getTableName(); $connection->createIndex($tableName, 'IX_' . $tableName . '_1', [ 'STATUS', 'HASH' ]); $connection->createIndex($tableName, 'IX_' . $tableName . '_2', [ 'TIMESTAMP_X' ]); $connection->createIndex($tableName, 'IX_' . $tableName . '_3', [ 'PRIMARY' ]); } public static function getMap() { return [ new Main\Entity\IntegerField('SETUP_ID', [ 'required' => true, 'primary' => true ]), new Main\Entity\IntegerField('ELEMENT_ID', [ 'required' => true, 'primary' => true ]), new Main\Entity\StringField('HASH', [ 'size' => 33, // md5 'validation' => [__CLASS__, 'validateHash'], ]), new Main\Entity\StringField('PRIMARY', [ 'size' => 80, 'validation' => [__CLASS__, 'getValidationForPrimary'], ]), new Main\Entity\StringField('STATUS', [ 'size' => 1, 'validation' => [__CLASS__, 'validateStatus'], ]), new Market\Reference\Storage\Field\CanonicalDateTime('TIMESTAMP_X', [ 'required' => true ]) ]; } public static function migrate(Main\DB\Connection $connection) { $sqlHelper = $connection->getSqlHelper(); $tableName = static::getTableName(); $tableFields = $connection->getTableFields($tableName); Market\Migration\StorageFacade::addNewFields($connection, static::getEntity()); Market\Migration\StorageFacade::updateFieldsLength($connection, static::getEntity(), [ 'PRIMARY', ]); if (!isset($tableFields['PRIMARY'])) { // fill primary for success exported elements $connection->queryExecute(sprintf( 'UPDATE %s SET %s=%s WHERE %s=%s', $sqlHelper->quote($tableName), $sqlHelper->quote('PRIMARY'), $sqlHelper->quote('ELEMENT_ID'), $sqlHelper->quote('STATUS'), $sqlHelper->forSql(Market\Export\Run\Steps\Base::STORAGE_STATUS_SUCCESS) )); // primary index $connection->createIndex($tableName, 'IX_' . $tableName . '_3', [ 'PRIMARY' ]); } } public static function getValidationForPrimary() { return [ new Main\Entity\Validator\Length(null, 80) ]; } public static function validateHash() { return [ new Main\Entity\Validator\Length(null, 33) ]; } public static function validateStatus() { return [ new Main\Entity\Validator\Length(null, 1) ]; } }