@@ -574,7 +574,7 @@ public function save(ProductInterface $product, $saveOptions = false)
574
574
);
575
575
}
576
576
$ this ->removeProductFromLocalCacheBySku ($ product ->getSku ());
577
- unset( $ this ->instancesById [ $ product ->getId ()] );
577
+ $ this ->removeProductFromLocalCacheById ( $ product ->getId ());
578
578
579
579
return $ this ->get ($ product ->getSku (), false , $ product ->getStoreId ());
580
580
}
@@ -588,7 +588,7 @@ public function delete(ProductInterface $product)
588
588
$ productId = $ product ->getId ();
589
589
try {
590
590
$ this ->removeProductFromLocalCacheBySku ($ product ->getSku ());
591
- unset( $ this ->instancesById [ $ product ->getId ()] );
591
+ $ this ->removeProductFromLocalCacheById ( $ product ->getId ());
592
592
$ this ->resourceModel ->delete ($ product );
593
593
} catch (ValidatorException $ e ) {
594
594
throw new CouldNotSaveException (__ ($ e ->getMessage ()), $ e );
@@ -599,7 +599,7 @@ public function delete(ProductInterface $product)
599
599
);
600
600
}
601
601
$ this ->removeProductFromLocalCacheBySku ($ sku );
602
- unset( $ this ->instancesById [ $ productId] );
602
+ $ this ->removeProductFromLocalCacheById ( $ productId );
603
603
604
604
return true ;
605
605
}
@@ -770,10 +770,10 @@ private function removeProductFromLocalCacheBySku(string $sku): void
770
770
/**
771
771
* Removes product in the local cache by id.
772
772
*
773
- * @param string $id
773
+ * @param string|null $id
774
774
* @return void
775
775
*/
776
- private function removeProductFromLocalCacheById (string $ id ): void
776
+ private function removeProductFromLocalCacheById (? string $ id ): void
777
777
{
778
778
unset($ this ->instancesById [$ id ]);
779
779
}
@@ -815,7 +815,7 @@ private function saveProduct($product): void
815
815
{
816
816
try {
817
817
$ this ->removeProductFromLocalCacheBySku ($ product ->getSku ());
818
- unset( $ this ->instancesById [ $ product ->getId ()] );
818
+ $ this ->removeProductFromLocalCacheById ( $ product ->getId ());
819
819
$ this ->resourceModel ->save ($ product );
820
820
} catch (ConnectionException $ exception ) {
821
821
throw new TemporaryCouldNotSaveException (
0 commit comments