Your IP : 216.73.216.220


Current Path : /var/www/html/app/code/FlipsDigital/TextbookList/Setup/
Upload File :
Current File : /var/www/html/app/code/FlipsDigital/TextbookList/Setup/TextbookListSetup.php

<?php
/**
 * TextbookListSetup
 *
 * @copyright Copyright © 2021 FlipsDigital. All rights reserved.
 * @author    calvin.so@flipsdigital.com
 */

namespace FlipsDigital\TextbookList\Setup;

use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;
use Magento\Eav\Setup\EavSetup;

/**
 * @codeCoverageIgnore
 */
class TextbookListSetup extends EavSetup
{
    /**
     * Entity type for TextbookList EAV attributes
     */
    const ENTITY_TYPE_CODE = 'flipsdigital_textbooklist';

    /**
     * Retrieve Entity Attributes
     *
     * @return array
     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
     */
    protected function getAttributes()
    {
        $attributes = [];

        $attributes['identifier'] = [
            'type' => 'static',
            'label' => 'identifier',
            'input' => 'text',
            'required' => true,
            'sort_order' => 10,
            'global' => ScopedAttributeInterface::SCOPE_GLOBAL,
            'group' => 'General',
            'validate_rules' => 'a:2:{s:15:"max_text_length";i:100;s:15:"min_text_length";i:1;}'
        ];
        $sort_order = 10;

        $attributes['mers_stock_source_g_gl_id'] = [
            'type' => 'int',
            'label' => 'MersStock - Source [G_GL].[ID]',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

        $attributes['mers_stock_source_g_gl_code'] = [
            'type' => 'varchar',
            'label' => 'MersStock - Source [G_GL].[CODE]',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

        $attributes['mers_stock_source_v_cus_cus'] = [
            'type' => 'varchar',
            'label' => 'MersStock - Source [V_CUS].[CUS]',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

        $attributes['mers_stock_source_g_gl_company'] = [
            'type' => 'varchar',
            'label' => 'MersStock - Source [G_GL].[COMPANY]',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

        $attributes['mers_stock_source_g_gl_input_date'] = [
            'type' => 'datetime',
            'label' => 'MersStock - Source [G_GL].[INPUT_DATE]',
            'input' => 'datetime',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

        $attributes['mers_stock_source_g_gl_edit_date'] = [
            'type' => 'datetime',
            'label' => 'MersStock - Source [G_GL].[EDIT_DATE]',
            'input' => 'datetime',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];
        $attributes['mers_stock_source_g_gl_magento_start_date'] = [
            'type' => 'datetime',
            'label' => 'MersStock - Source [G_GL].[MAGENTO_START_DATE]',
            'input' => 'datetime',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];
        $attributes['mers_stock_source_g_gl_magento_end_date'] = [
            'type' => 'datetime',
            'label' => 'MersStock - Source [G_GL].[MAGENTO_END_DATE]',
            'input' => 'datetime',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];
        $attributes['mers_stock_source_g_gl_group_id'] = [
            'type' => 'int',
            'label' => 'MersStock - Source [G_GL_GROUP].[ID]',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];
        $attributes['mers_stock_source_g_gl_group_group_id'] = [
            'type' => 'int',
            'label' => 'MersStock - Source [G_GL_GROUP].[GROUP_ID]',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];
        $attributes['mers_stock_source_g_gl_plastic_bag_levy'] = [
            'type' => 'int',
            'label' => 'MersStock - Source [G_GL].[PLASTIC_BAG_LEVY]',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];
        $attributes['mers_stock_source_g_gl_allow_not_buy_all'] = [
            'type' => 'int',
            'label' => 'MersStock - Source [G_GL].[ALLOW_NOT_BUY_ALL]',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

        $attributes['education_institution_id'] = [
            'type' => 'int',
            'label' => 'Education Institution ID',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

        $attributes['print_remark'] = [
            'type' => 'text',
            'label' => 'Print Remark',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

        $attributes['class_name'] = [
            'type' => 'varchar',
            'label' => 'Class Name',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

        $attributes['group_name'] = [
            'type' => 'varchar',
            'label' => 'Group Name',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

        $attributes['school_remark'] = [
            'type' => 'text',
            'label' => 'School Remark',
            'input' => 'textarea',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
            'wysiwyg_enabled' => true,
        ];

        $attributes['GroupTableTitle'] = [
            'type' => 'varchar',
            'label' => 'Group Table Title',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

        $attributes['status'] = [
            'type' => 'int',
            'label' => 'Status',
            'input' => 'select',
            'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean',
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];
        return $attributes;
    }

    /**
     * Retrieve default entities: textbooklist
     *
     * @return array
     */
    public function getDefaultEntities()
    {
        $entities = [
            self::ENTITY_TYPE_CODE => [
                'entity_model' => 'FlipsDigital\TextbookList\Model\ResourceModel\TextbookList',
                'attribute_model' => 'FlipsDigital\TextbookList\Model\ResourceModel\Eav\Attribute',
                'table' => self::ENTITY_TYPE_CODE . '_entity',
                'increment_model' => null,
                'additional_attribute_table' => self::ENTITY_TYPE_CODE . '_eav_attribute',
                'entity_attribute_collection' => 'FlipsDigital\TextbookList\Model\ResourceModel\Attribute\Collection',
                'attributes' => $this->getAttributes()
            ]
        ];

        return $entities;
    }
}