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/rospirotorg.ru/bitrix/modules/skyweb24.popuppro/lib/entity/ |
Upload File : |
<?php namespace Skyweb24\Popuppro\Entity; use Bitrix\Main\Localization\Loc, Bitrix\Main\ORM\Data\DataManager, Bitrix\Main\ORM\Fields\BooleanField, Bitrix\Main\ORM\Fields\DatetimeField, Bitrix\Main\ORM\Fields\IntegerField, Bitrix\Main\ORM\Fields\StringField, Bitrix\Main\ORM\Fields\TextField, Bitrix\Main\ORM\Fields\Validators\LengthValidator, Bitrix\Main\Type\DateTime; Loc::loadMessages(__FILE__); /** * Class AbtestTable * * Fields: * <ul> * <li> id int mandatory * <li> popup_id_a int mandatory * <li> popup_id_b int mandatory * <li> chance int optional default 100 * <li> work_time int optional default 86400 * <li> name string(255) mandatory * <li> active bool ('N', 'Y') optional default 'Y' * <li> date_update datetime optional default current datetime * <li> date_start datetime optional default '0000-00-00 00:00:00' * <li> params text optional * </ul> * * @package Bitrix\Popuppro **/ class AbtestTable extends DataManager { /** * Returns DB table name for entity. * * @return string */ public static function getTableName() { return 'skyweb24_popuppro_abtest'; } /** * Returns entity map definition. * * @return array */ public static function getMap() { return [ new IntegerField( 'id', [ 'primary' => true, 'autocomplete' => true, 'title' => Loc::getMessage('ABTEST_ENTITY_ID_FIELD') ] ), new IntegerField( 'popup_id_a', [ 'required' => true, 'title' => Loc::getMessage('ABTEST_ENTITY_POPUP_ID_A_FIELD') ] ), new IntegerField( 'popup_id_b', [ 'required' => true, 'title' => Loc::getMessage('ABTEST_ENTITY_POPUP_ID_B_FIELD') ] ), new IntegerField( 'chance', [ 'default' => 100, 'title' => Loc::getMessage('ABTEST_ENTITY_CHANCE_FIELD') ] ), new IntegerField( 'work_time', [ 'default' => 86400, 'title' => Loc::getMessage('ABTEST_ENTITY_WORK_TIME_FIELD') ] ), new StringField( 'name', [ 'required' => true, 'validation' => [__CLASS__, 'validateName'], 'title' => Loc::getMessage('ABTEST_ENTITY_NAME_FIELD') ] ), new BooleanField( 'active', [ 'values' => array('N', 'Y'), 'default' => 'N', 'title' => Loc::getMessage('ABTEST_ENTITY_ACTIVE_FIELD') ] ), new DatetimeField( 'date_update', [ 'default' => function() { return new DateTime(); }, 'title' => Loc::getMessage('ABTEST_ENTITY_DATE_UPDATE_FIELD') ] ), new DatetimeField( 'date_start', [ 'default' => '0000-00-00 00:00:00', 'title' => Loc::getMessage('ABTEST_ENTITY_DATE_START_FIELD') ] ), new TextField( 'params', [ 'title' => Loc::getMessage('ABTEST_ENTITY_PARAMS_FIELD'), 'save_data_modification' => function () { return array( function ($value) { return serialize($value); } ); }, 'fetch_data_modification' => function () { return array( function ($value) { return unserialize($value); } ); } ] ), new \Bitrix\Main\Entity\ReferenceField( 'popup_a', '\Skyweb24\Popuppro\Entity\PopupproTable', ['=this.popup_id_a' => 'ref.id'], ['join_type' => 'LEFT'] ), new \Bitrix\Main\Entity\ReferenceField( 'popup_b', '\Skyweb24\Popuppro\Entity\PopupproTable', ['=this.popup_id_b' => 'ref.id'], ['join_type' => 'LEFT'] ), ]; } /** * Returns validators for name field. * * @return array */ public static function validateName() { return [ new LengthValidator(null, 255), ]; } }