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/lpost.delivery/lib/entity/ |
Upload File : |
<?php namespace Lpost\Delivery\Entity; use Bitrix\Main\Localization\Loc, Bitrix\Main\ORM\Data\DataManager, Bitrix\Main\ORM\Fields\IntegerField, Bitrix\Main\ORM\Fields\StringField, Bitrix\Main\ORM\Fields\TextField, Bitrix\Main\ORM\Fields\Validators\LengthValidator; Loc::loadMessages(__FILE__); /** * Class ReceivePointsTable * * Fields: * <ul> * <li> id int mandatory * <li> id_sklad int mandatory * <li> id_region int mandatory * <li> city_name string(100) mandatory * <li> address string(255) mandatory * <li> params text mandatory * </ul> * * @package Bitrix\Delivery **/ class ReceivePointsTable extends DataManager { /** * Returns DB table name for entity. * * @return string */ public static function getTableName() { return 'lpost_delivery_receive_points'; } /** * Returns entity map definition. * * @return array */ public static function getMap() { return [ new IntegerField( 'id', [ 'primary' => true, 'autocomplete' => true, 'title' => Loc::getMessage('RECEIVE_POINTS_ENTITY_ID_FIELD') ] ), new IntegerField( 'id_sklad', [ 'required' => true, 'title' => Loc::getMessage('RECEIVE_POINTS_ENTITY_ID_SKLAD_FIELD') ] ), new IntegerField( 'id_region', [ 'required' => true, 'title' => Loc::getMessage('RECEIVE_POINTS_ENTITY_ID_REGION_FIELD') ] ), new StringField( 'city_name', [ 'required' => true, 'validation' => [__CLASS__, 'validateCityName'], 'title' => Loc::getMessage('RECEIVE_POINTS_ENTITY_CITY_NAME_FIELD') ] ), new StringField( 'address', [ 'required' => true, 'validation' => [__CLASS__, 'validateAddress'], 'title' => Loc::getMessage('RECEIVE_POINTS_ENTITY_ADDRESS_FIELD') ] ), new TextField( 'params', [ 'required' => true, 'title' => Loc::getMessage('RECEIVE_POINTS_ENTITY_PARAMS_FIELD') ] ), ]; } /** * Returns validators for city_name field. * * @return array */ public static function validateCityName() { return [ new LengthValidator(null, 100), ]; } /** * Returns validators for address field. * * @return array */ public static function validateAddress() { return [ new LengthValidator(null, 255), ]; } public static function deleteAll() { global $DB; return $DB->Query("TRUNCATE TABLE " . self::getTableName(), true); } }