I'm trying to understand how magento2 is creating attributes in initial installation and using this I'm trying to create my own attribute.
For example I'd like to create duplicate of thumbnail attribute.
I followed the instruction in this article: https://www.atwix.com/magento/adding-attribute-programatically-magento2/
But I'm getting an error (I got error with report which refer to class below)
<type name="Magento\Framework\Module\Updater\SetupFactory">
As I have no Magento\Framework\Module\ Updater folder. What am I doing wrong?
Then I tried to look how magento does it resolve.
I have opened Catalog/Setup folder and found file, which is creating attributes just like I need (Setup/CategorySetup). For example:
'thumbnail' => [
'type' => 'varchar',
'label' => 'Thumbnail',
'input' => 'media_image',
'frontend' => 'Magento\Catalog\Model\Product\Attribute\Frontend\Image',
'required' => false,
'sort_order' => 3,
'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE,
'used_in_product_listing' => true,
'group' => 'Images',
],
this is a part of
public function getDefaultEntities()
But I can't find where does this method calls(1 question), as it runs only once when magento installs and it's impossible to put breakpoint
2. Which file executes by default? Is it InstallData/Schema? Should I write anything in config to say magento execute installation script (as it done in magento 1 in core_setup directive)
p.s. Any article on this topic will be appreciated.
@Wojtek Naruniec i tried with code what you mentioned above , but it is now working also i don't find the Magento\Catalog\Setup\CategorySetupFactory.php file in the 1.0.0 beta version
by *user3404885 *