| Current Path : /var/www/html/app/code/FlipsDigital/EducationInstitution/Setup/ |
| Current File : /var/www/html/app/code/FlipsDigital/EducationInstitution/Setup/EducationInstitutionSetup.php |
<?php
/**
* EducationInstitutionSetup
*
* @copyright Copyright © 2021 FlipsDigital. All rights reserved.
* @author calvin.so@flipsdigital.com
*/
namespace FlipsDigital\EducationInstitution\Setup;
use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;
use Magento\Eav\Setup\EavSetup;
/**
* @codeCoverageIgnore
*/
class EducationInstitutionSetup extends EavSetup
{
/**
* Entity type for EducationInstitution EAV attributes
*/
const ENTITY_TYPE_CODE = 'flipsdigital_educationinstitution';
/**
* 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_v_cus_id'] = [
'type' => 'int',
'label' => 'MersStock - Source [V_CUS].[ID]',
'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_v_cus_cdate'] = [
'type' => 'datetime',
'label' => 'MersStock - Source [V_CUS].[CDATE]',
'input' => 'datetime',
'required' => true,
'sort_order' => $sort_order++,
'global' => ScopedAttributeInterface::SCOPE_STORE,
'group' => 'General',
];
$attributes['group_id'] = [
'type' => 'varchar',
'label' => 'Group Id',
'input' => 'text',
'required' => true,
'sort_order' => $sort_order++,
'global' => ScopedAttributeInterface::SCOPE_STORE,
'group' => 'General',
];
$attributes['name'] = [
'type' => 'varchar',
'label' => 'Name',
'input' => 'text',
'required' => true,
'sort_order' => $sort_order++,
'global' => ScopedAttributeInterface::SCOPE_STORE,
'group' => 'General',
];
$attributes['chinese_name'] = [
'type' => 'varchar',
'label' => 'Chinese Name',
'input' => 'text',
'required' => true,
'sort_order' => $sort_order++,
'global' => ScopedAttributeInterface::SCOPE_STORE,
'group' => 'General',
];
$attributes['category_id'] = [
'type' => 'int',
'label' => 'Product - Category Id',
'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['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: educationinstitution
*
* @return array
*/
public function getDefaultEntities()
{
$entities = [
self::ENTITY_TYPE_CODE => [
'entity_model' => 'FlipsDigital\EducationInstitution\Model\ResourceModel\EducationInstitution',
'attribute_model' => 'FlipsDigital\EducationInstitution\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\EducationInstitution\Model\ResourceModel\Attribute\Collection',
'attributes' => $this->getAttributes()
]
];
return $entities;
}
}