%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 3.15.25.131 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/main/lib/ |
Upload File : |
<?php namespace Bitrix\Main; use Bitrix\Main; /** * Class UserIndexSelectorTable * * Fields: * <ul> * <li> USER_ID int mandatory * <li> SEARCH_SELECTOR_CONTENT string optional * </ul> * * @package Bitrix\Main * * DO NOT WRITE ANYTHING BELOW THIS * * <<< ORMENTITYANNOTATION * @method static EO_UserIndexSelector_Query query() * @method static EO_UserIndexSelector_Result getByPrimary($primary, array $parameters = array()) * @method static EO_UserIndexSelector_Result getById($id) * @method static EO_UserIndexSelector_Result getList(array $parameters = array()) * @method static EO_UserIndexSelector_Entity getEntity() * @method static \Bitrix\Main\EO_UserIndexSelector createObject($setDefaultValues = true) * @method static \Bitrix\Main\EO_UserIndexSelector_Collection createCollection() * @method static \Bitrix\Main\EO_UserIndexSelector wakeUpObject($row) * @method static \Bitrix\Main\EO_UserIndexSelector_Collection wakeUpCollection($rows) */ class UserIndexSelectorTable extends Main\Entity\DataManager { /** * Returns DB table name for entity. * * @return string */ public static function getTableName() { return 'b_user_index_selector'; } /** * Returns entity map definition. * * @return array */ public static function getMap() { return array( 'USER_ID' => array( 'data_type' => 'integer', 'primary' => true, ), 'SEARCH_SELECTOR_CONTENT' => array( 'data_type' => 'text', ), ); } protected static function getMergeFields() { return array('USER_ID'); } public static function merge(array $data) { global $DB; $result = new Entity\AddResult(); $helper = Application::getConnection()->getSqlHelper(); $insertData = $data; $updateData = $data; $mergeFields = static::getMergeFields(); foreach ($mergeFields as $field) { unset($updateData[$field]); } if (isset($updateData['SEARCH_SELECTOR_CONTENT'])) { $value = $DB->forSql($updateData['SEARCH_SELECTOR_CONTENT']); $encryptedValue = sha1($updateData['SEARCH_SELECTOR_CONTENT']); $updateData['SEARCH_SELECTOR_CONTENT'] = new \Bitrix\Main\DB\SqlExpression("IF(SHA1(SEARCH_SELECTOR_CONTENT) = '{$encryptedValue}', SEARCH_SELECTOR_CONTENT, '{$value}')"); } $merge = $helper->prepareMerge( static::getTableName(), static::getMergeFields(), $insertData, $updateData ); if ($merge[0] != "") { Application::getConnection()->query($merge[0]); $id = Application::getConnection()->getInsertedId(); $result->setId($id); $result->setData($data); } else { $result->addError(new Error('Error constructing query')); } return $result; } }