I have the following InstallData.php in my Setup directory in my module. The script does not seem to execute at all. I have tried throwing an Exception at the beginning, dumping and dying, etc. Nothing seems to stop the script or output and information while running setup:upgrade.
NB: I have removed the module's row from the setup_module table before each run. I've also tried with EavSetupFactory - no luck there either.
Any thoughts would be appreciated.
<?php
namespace Tridum\Thumbnail\Setup;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Catalog\Model\Category;
use Magento\Catalog\Setup\CategorySetupFactory;
use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;
/**
* @codeCoverageIgnore
*/
class InstallData implements InstallDataInterface
{
/**
* @var EavSetupFactory
*/
private $categorySetupFactory;
/**
*
* @param CategorySetupFactory $categorySetupFactory
*/
public function __construct(CategorySetupFactory $categorySetupFactory)
{
$this->categorySetupFactory = $categorySetupFactory;
}
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
/** @var EavSetup $eavSetup */
$eavSetup = $this->categorySetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
Category::ENTITY,
'thumbnail',
[
'type' => 'varchar',
'label' => 'Category Thumbnail',
'input' => 'image',
'backend' => 'Magento\Catalog\Model\Category\Attribute\Backend\Image',
'required' => false,
'sort_order' => 9,
'global' => ScopedAttributeInterface::SCOPE_STORE,
'group' => 'General Information',
'default' => null,
]
);
$setup->endSetup();
}
}