Your IP : 18.118.152.63


Current Path : /home/bitrix/ext_www/klimatlend.ua/local/lib/Epages/
Upload File :
Current File : /home/bitrix/ext_www/klimatlend.ua/local/lib/Epages/DiscountCouponsTable.php

<?php
/**
 * User: Rodion Abdurakhimov
 * Date: 24/6/16
 * Time: 11:36
 */

namespace Epages;

use Bitrix\Main;

class DiscountCouponsTable extends Main\Entity\DataManager
{
    /**
     * Returns DB table name for entity.
     *
     * @return string
     */
    public static function getTableName()
    {
        return 'ep_discount_coupons';
    }

    /**
     * Returns entity map definition.
     *
     * @return array
     */
    public static function getMap()
    {
        return [
            'id' => [
                'data_type' => 'integer',
                'primary' => true,
                'autocomplete' => true,
                'title' => 'id',
            ],
            'coupon' => [
                'data_type' => 'string',
                'required' => true,
                'validation' => [__CLASS__, 'validateCoupon'],
                'title' => 'coupon',
            ],
            'used' => [
                'data_type' => 'string',
                'required' => true,
                'validation' => [__CLASS__, 'validateUsed'],
                'title' => 'used',
            ],
        ];
    }
    /**
     * Returns validators for coupon field.
     *
     * @return array
     */
    public static function validateCoupon()
    {
        return [
            new Main\Entity\Validator\Length(null, 100),
        ];
    }
    /**
     * Returns validators for used field.
     *
     * @return array
     */
    public static function validateUsed()
    {
        return [
            new Main\Entity\Validator\Length(null, 1),
        ];
    }
}