Adapter/ShopwareAdapter/ServiceBus/CommandHandler/Category/HandleCategoryCommandHandler.php
public function handle(CommandInterface $command)
    {
        /**
         * @var Category $category
         */
        $category = $command->getPayload();

        $validIdentities = [];
        foreach ($category->getShopIdentifiers() as $shopIdentifier) {
            $shopIdentities = $this->identityService->findBy([
                'objectIdentifier' => (string) $shopIdentifier,
                'objectType' => Shop::TYPE,
                'adapterName' => ShopwareAdapter::NAME,
            ]);

            if (empty($shopIdentities)) {
                continue;
            }

            foreach ($shopIdentities as $shopIdentity) {
                $identity = $this->handleCategory($category, $shopIdentity);

                if (null === $identity) {
                    continue;
                }

                $identifier = $identity->getObjectIdentifier();
                $validIdentities[$identifier] = $identifier;
            }
        }

        $this->handleOrphanedCategories($category, $validIdentities);

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

        $validIdentities = [];
        foreach ($category->getShopIdentifiers() as $shopIdentifier) {
            $shopIdentities = $this->identityService->findBy([
                'objectIdentifier' => (string) $shopIdentifier,
                'objectType' => Shop::TYPE,
                'adapterName' => ShopwareAdapter::NAME,
            ]);

            if (empty($shopIdentities)) {
                continue;
            }

            foreach ($shopIdentities as $shopIdentity) {
                $identity = $this->handleCategory($category, $shopIdentity);

                if (null === $identity) {
                    continue;
                }

                $identifier = $identity->getObjectIdentifier();
                $validIdentities[$identifier] = $identifier;
            }
        }

        $this->handleOrphanedCategories($category, $validIdentities);

        return true;
    }
{@inheritdoc}

@var TransferObjectCommand $command