public function handle(CommandInterface $command)
    {
        /**
         * @var Stock $stock
         */
        $stock = $command->getPayload();

        $variationIdentity = $this->identityService->findOneBy([
            'objectIdentifier' => $stock->getVariationIdentifier(),
            'objectType' => Variation::TYPE,
            'adapterName' => ShopwareAdapter::NAME,
        ]);

        if (null === $variationIdentity) {
            $this->logger->notice('could not find variation identity - ' . $stock->getVariationIdentifier());

            return false;
        }

        $this->identityService->findOneOrCreate(
            $variationIdentity->getAdapterIdentifier(),
            ShopwareAdapter::NAME,
            Stock::TYPE
        );

        $variationRespository = $this->entityManager->getRepository(Detail::class);

        /**
         * @var null|Detail $variation
         */
        $variation = $variationRespository->find($variationIdentity->getAdapterIdentifier());

        if (null === $variation) {
            $this->logger->notice('could not find variation - ' . $stock->getVariationIdentifier());

            return false;
        }

        $variation->setInStock($stock->getStock());

        $this->entityManager->persist($variation);
        $this->entityManager->flush();
        $this->entityManager->clear();

        return true;
    }
public function handle(CommandInterface $command)
    {
        /**
         * @var Stock $stock
         */
        $stock = $command->getPayload();

        $variationIdentity = $this->identityService->findOneBy([
            'objectIdentifier' => $stock->getVariationIdentifier(),
            'objectType' => Variation::TYPE,
            'adapterName' => ShopwareAdapter::NAME,
        ]);

        if (null === $variationIdentity) {
            $this->logger->notice('could not find variation identity - ' . $stock->getVariationIdentifier());

            return false;
        }

        $this->identityService->findOneOrCreate(
            $variationIdentity->getAdapterIdentifier(),
            ShopwareAdapter::NAME,
            Stock::TYPE
        );

        $variationRespository = $this->entityManager->getRepository(Detail::class);

        /**
         * @var null|Detail $variation
         */
        $variation = $variationRespository->find($variationIdentity->getAdapterIdentifier());

        if (null === $variation) {
            $this->logger->notice('could not find variation - ' . $stock->getVariationIdentifier());

            return false;
        }

        $variation->setInStock($stock->getStock());

        $this->entityManager->persist($variation);
        $this->entityManager->flush();
        $this->entityManager->clear();

        return true;
    }
{@inheritdoc}

@param TransferObjectCommand $command