What are the Slack Archives?
It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Hello everybody, we currently facing an issue when deleting an image from an abstract product image
Hello everybody,
we currently facing an issue when deleting an image from an abstract product image set.
When we delete a single image, there is a message on the publish queue which looks like the following
{ "listenerClassName": "Spryker\\Zed\\ProductImageStorage\\Communication\\Plugin\\Event\\Listener\\ProductAbstractImageStorageUnpublishListener", "transferClassName": "Generated\\Shared\\Transfer\\EventEntityTransfer", "transferData": { "id": 12573, "event": "Entity.spy_product_image.delete", "name": "spy_product_image", "foreign_keys": [], "modified_columns": [], "original_values": [], "additional_values": [] }, "eventName": "Entity.spy_product_image.delete" }
Looking at the corresponding listener that should proceed the message, we find the following logic
public function handleBulk(array $eventEntityTransfers, $eventName) { $this->preventTransaction(); $productImageIds = $this->getFactory()->getEventBehaviorFacade()->getEventTransferIds($eventEntityTransfers); $productAbstractIds = $this->getQueryContainer()->queryProductAbstractIdsByProductImageIds($productImageIds)->find()->getData(); $this->getFacade()->unpublishProductAbstractImages($productAbstractIds); }
We are wondering if this can really work for the delete event as implemented in the EventSubscriber
protected function addProductAbstractImageDeleteStorageListener(EventCollectionInterface $eventCollection) { $eventCollection->addListenerQueued(ProductImageEvents::ENTITY_SPY_PRODUCT_IMAGE_DELETE, new ProductAbstractImageStorageUnpublishListener(), 0, null, $this->getConfig()->getProductImageAbstractEventQueueName()); }
The problem: In case of delete, the retrieval of the product abstract ids will not work since it was already deleted from the database at this point. The method will return no result and therefore no delete for storage will follow. For unpublish (the entity still exists) it will work. But for delete at least in our opinion it will not work or do we miss something?
Best regards
Comments
-
One thing we also do not understand:
When a single image from a image set gets deleted, according to$eventCollection->addListenerQueued(ProductImageEvents::ENTITY_SPY_PRODUCT_IMAGE_DELETE, new ProductAbstractImageStorageUnpublishListener(), 0, null, $this->getConfig()->getProductImageAbstractEventQueueName());
the logic of the
ProductAbstractImageStorageUnpublishListener
$this->getFacade()->unpublishProductAbstractImages($productAbstractIds);
is executed and with this, EVERY image of the related abstract product will be unpublished too.
Is this really correct?0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 74 Spryker News
- 912 Developer Corner
- 772 Spryker Development
- 87 Spryker Dev Environment
- 361 Spryker Releases
- 3 Oryx frontend framework
- 34 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 25 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 69 Spryker Safari Questions
- 50 Random