Last active
June 20, 2019 20:44
-
-
Save molotovbliss/9c896a025682f3aa2d0d45fc3fa81289 to your computer and use it in GitHub Desktop.
EAV custom entities example Magenot 1 installer script.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// EAV custom entities example Magenot 1 installer script. | |
/* @var $installer Mage_Eav_Model_Entity_Setup */ | |
$installer = Mage::getModel('eav/entity_setup', 'default_setup'); | |
$installer->startSetup(); | |
// Example createEntityTables() call | |
$installer->createEntityTables('example_supplier'); | |
// Example installEntities() call | |
$installer->installEntities(array( | |
'supplier' => array( | |
'table' => 'example_supplier', | |
'entity_model' => 'example/supplier', | |
'attributes' => array( | |
'name' => array( | |
'label' => 'Name', | |
'type' => 'varchar', | |
'required' => 1 | |
), | |
'location_code' => array( | |
'label' => 'Location Code', | |
'type' => 'int', | |
'required' => 1 | |
), | |
'valid_from' => array( | |
'label' => 'Valid From', | |
'type' => 'datetime', | |
'required' => 0 | |
) | |
) | |
) | |
)); | |
// Example addAttribute() call | |
$installer->addAttribute('supplier', 'priority', array( | |
'label' => 'Priority', | |
'type' => 'int', | |
'required' => 1, | |
'default' => '10' | |
)); | |
$installer->endSetup(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment