tzyganu / UMC1.9

New Ultimate Module Creator for Magento 1.7 +
MIT License
242 stars 88 forks source link

Naming Custom Entity as Product #135

Open pocallaghan opened 7 years ago

pocallaghan commented 7 years ago

If you create a custom extension that has an entity myext/product and try and give it a relationship to catalog/product, the extension attempts to use the same id field for the relationship. Attempting to create the same column name twice in the migration just results in a single column, so myext_product_product consists of only rel_id, product_id and position, with product_id having a foreign key to both myext_product and catalog_product_entity.

Fixing the generated code requires manually modifying the migration script to update the second column name and FK and manually updating the blocks and models that interact with the relationship.

Presumably you'd hit similar issues with category.

Raising this purely so it's documented incase anyone else hits it, rather than in expectation of a fix. I'd imagine most people don't need a custom entity called Product and I'm assuming at this point, any free time you have will be focused on the M2 version.

tzyganu commented 7 years ago

@pocallaghan Thanks for the heads up. I will add product and category and other entity names that are present in the core, to the restriction list.