jruzafa
8/7/2014 - 2:17 PM

setup.php

<?php

/* @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();