Your IP : 216.73.216.220


Current Path : /var/www/html/app/code/FlipsDigital/CustomerTextbookList/Setup/
Upload File :
Current File : /var/www/html/app/code/FlipsDigital/CustomerTextbookList/Setup/CustomerTextbookListSetup.php

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

namespace FlipsDigital\CustomerTextbookList\Setup;

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

/**
 * @codeCoverageIgnore
 */
class CustomerTextbookListSetup extends EavSetup
{
    /**
     * Entity type for CustomerTextbookList EAV attributes
     */
    const ENTITY_TYPE_CODE = 'flipsdigital_customertextbooklist';

    /**
     * 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['customer_id'] = [
            'type' => 'int',
            'label' => 'Customer ID',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

        $attributes['reference_id'] = [
            'type' => 'int',
            'label' => 'Reference ID',
            '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['booklist_id'] = [
            'type' => 'int',
            'label' => 'Booklist ID',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

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

        $attributes['student_lastname'] = [
            'type' => 'varchar',
            'label' => 'Student\'s Last Name',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

        $attributes['student_firstname'] = [
            'type' => 'varchar',
            'label' => 'Student\'s First Name',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

        $attributes['chi_name'] = [
            'type' => 'varchar',
            'label' => 'Student\'s Chinese Name',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

        $attributes['eng_name'] = [
            'type' => 'varchar',
            'label' => 'Student\'s English Name',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

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

        $attributes['student_no'] = [
            'type' => 'varchar',
            'label' => 'Student No.',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

        $attributes['order_id'] = [
            'type' => 'int',
            'label' => 'Order Id',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

        $attributes['mers_stock_sync_g_magento_order_id'] = [
            'type' => 'varchar',
            'label' => 'MersStock - Sync [G_MAGENTO_ORDER].[ID]',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];
        $attributes['mers_stock_sync_g_magento_order_time'] = [
            'type' => 'datetime',
            'label' => 'MersStock - Sync [G_MAGENTO_ORDER]',
            'input' => 'datetime',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

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

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

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

        $attributes['mers_stock_source_g_gl_student_gl_classname'] = [
            'type' => 'varchar',
            'label' => 'MersStock - Source [G_GL_STUDENT].[GL_CLASSNAME]',
            '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: customertextbooklist
     *
     * @return array
     */
    public function getDefaultEntities()
    {
        $entities = [
            self::ENTITY_TYPE_CODE => [
                'entity_model' => 'FlipsDigital\CustomerTextbookList\Model\ResourceModel\CustomerTextbookList',
                'attribute_model' => 'FlipsDigital\CustomerTextbookList\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\CustomerTextbookList\Model\ResourceModel\Attribute\Collection',
                'attributes' => $this->getAttributes()
            ]
        ];

        return $entities;
    }
}