Closed younes0 closed 4 years ago
@younes0 Actually I can't assure you about it. We don't have partner license, so we can't test it on magento EE. If there is no way to dowload magento ee code for development purpose (I don't know any), I fear that I can't help you :(
It definitely doesn't work with EE because of row_id/entity_id changes.
Problem is LizardMedia\ProductAttachment\Model\Product\TypeHandler\Attachment
$this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField()
returns row_id
and it should return entity_id
in our case.
To get the correct id column:
public function __construct(
/* ... */
Magento\Framework\App\ProductMetadataInterface $productMetadata
) {
/* ... */
$this->productMetadata = $productMetadata;
}
$linkField = (
$this->productMetadata->getEdition() !== 'Community'
&& version_compare($this->productMetadata->getVersion(), '2.1.0', '>=')
)
? 'entity_id' // UPDATE: fixed
: $this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField()
}
Inspiration: https://github.com/algolia/algoliasearch-magento-2/compare/1.0.2...1.0.3
Ok @younes0 I can't test it, because I don't have any project on EE right now, so any help would be appriciated. Is it the only problematic place? Is foreign key correct in custom table?
There's no need to change custom table definitions.
The only problematic instruction is:
$this->metadataPool->getMetadata(ProductInterface::class)->getLinkField()
which should return 'entity_id' if it's EE, as mentionned above.
@younes0 I understand. If you have any project running on EE it would be the best if you could create PR or just give me exact changes which works, as it seems you can test it. If not I can commit that, but I will only test if it doesn't break anything on CE
Hey! I'll gladly do the PR, next week I think
Hey! I didn't forget this... I should be less busy next week
@younes0 today I am finally merging changes. Due to your possibilities mentioned in you PR, I have moved your changes into my branch and from it I have completed this task. Some fixes had to be done. Thank you for your contribution. I will close it when you come back with info that all works as intented.
@bartoszkubicki i've just tested master and no issues encountered with Magento Entreprise Edition. thank you.
Hello, Is the module compatible with Magento EE ? We are encountering an error on a Magento EE Cloud instance: product with attached files is the wrong one (you just need to change the product_id in the product_attachments table to fix) and it may be caused by differences between CE & EE: https://magento.stackexchange.com/questions/139081/magento-2-what-is-the-difference-between-the-row-id-and-entity-id-in-the-enti