import hiltes
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user