Your IP : 216.73.216.220


Current Path : /var/www/html/app/code/FlipsDigital/TextbookListStudent/Setup/
Upload File :
Current File : /var/www/html/app/code/FlipsDigital/TextbookListStudent/Setup/TextbookListStudentSetup.php

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

namespace FlipsDigital\TextbookListStudent\Setup;

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

/**
 * @codeCoverageIgnore
 */
class TextbookListStudentSetup extends EavSetup
{
    /**
     * Entity type for TextbookListStudent EAV attributes
     */
    const ENTITY_TYPE_CODE = 'flipsdigital_textbookliststudent';

    /**
     * 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_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['mers_stock_source_g_gl_student_student_class'] = [
            'type' => 'varchar',
            'label' => 'MersStock - Source [G_GL_STUDENT].[STUDENT_CLASS]',
            'input' => 'text',
            'required' => true,
            'sort_order' => $sort_order++,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

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

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

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

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

        return $entities;
    }
}