/** * @param ProductUpdateEvent $updateEvent * * @return Response */ protected function performAdditionalUpdateAction($updateEvent) { // Associate the file if it's a virtual product // and with only 1 PSE $virtualDocumentId = intval($updateEvent->getVirtualDocumentId()); if ($virtualDocumentId >= 0) { $defaultPSE = ProductSaleElementsQuery::create()->filterByProductId($updateEvent->getProductId())->filterByIsDefault(true)->findOne(); if (null !== $defaultPSE) { if ($virtualDocumentId !== 0) { $assocEvent = new MetaDataCreateOrUpdateEvent('virtual', MetaData::PSE_KEY, $defaultPSE->getId(), $virtualDocumentId); $this->dispatch(TheliaEvents::META_DATA_UPDATE, $assocEvent); } else { $assocEvent = new MetaDataDeleteEvent('virtual', MetaData::PSE_KEY, $defaultPSE->getId()); $this->dispatch(TheliaEvents::META_DATA_DELETE, $assocEvent); } } } return null; }