import hiltes

This commit is contained in:
mmoeller
2023-02-02 13:48:54 +01:00
parent 3493e038e3
commit 7100cc5a89
11 changed files with 418 additions and 364 deletions

View File

@@ -2,6 +2,8 @@
namespace App\Helper;
use App\Entity\Products;
use App\Repository\ProductsRepository;
use Psr\Log\LoggerInterface;
use Vin\ShopwareSdk\Client\AdminAuthenticator;
use Vin\ShopwareSdk\Client\GrantType\ClientCredentialsGrantType;
@@ -64,13 +66,23 @@ class Shopware
}
}
public function setProduct(){
public function setProduct(Products $product){
$context = new Context($_ENV['SHOPWARE_API_URL'], $this->shopwareAuth());
$productRepository = RepositoryFactory::create(ProductDefinition::ENTITY_NAME);
$productRepository->update($product, $context);
}
$productRepository->update();
public function pushStock()
{
$productRepository = new ProductsRepository();
$products = $productRepository->findAll();
foreach ($products as $product) {
$this->setProduct($product);
}
}
}