Skip to content

Commit

Permalink
[shopsys] increase speed of Product creation (#2903)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasLudvik authored Oct 26, 2023
1 parent 6f0d424 commit 8de6b92
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Model/Product/GoogleProductDomainFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public function saveGoogleProductDomainsForProductId($productId, array $googlePr
foreach ($googleProductDomainsData as $googleProductDomainData) {
$this->saveGoogleProductDomain($productId, $googleProductDomainData);
}

$this->em->flush();
}

/**
Expand Down Expand Up @@ -72,7 +74,7 @@ protected function removeOldGoogleProductDomains(
* @param int $productId
* @param \Shopsys\ProductFeed\GoogleBundle\Model\Product\GoogleProductDomainData $googleProductDomainData
*/
public function saveGoogleProductDomain($productId, GoogleProductDomainData $googleProductDomainData)
protected function saveGoogleProductDomain($productId, GoogleProductDomainData $googleProductDomainData)
{
$product = $this->productRepository->getById($productId);
$googleProductDomainData->product = $product;
Expand All @@ -88,8 +90,6 @@ public function saveGoogleProductDomain($productId, GoogleProductDomainData $goo
$newGoogleProductDomain = new GoogleProductDomain($googleProductDomainData);
$this->em->persist($newGoogleProductDomain);
}

$this->em->flush();
}

/**
Expand Down

0 comments on commit 8de6b92

Please sign in to comment.