createFlow example

$this->tagRepository = $this->getContainer()->get('tag.repository');
        $this->customerId = $this->createCustomer();
        $this->salesChannelContext = $this->createDefaultSalesChannelContext();
    }

    public function testFlowExecutesWithIfSequencesEvaluated(): void
    {
        $ids = new IdsCollection();

        $this->createTags($ids);

        $this->createFlow($ids);

        $this->placeOrder($ids);

        $this->orderRepository->update([
            [
                'id' => $ids->get('order'),
                'tags' => [
                    ['id' => $ids->get('tag-1')],
                ],
            ],
        ]$this->salesChannelContext->getContext());

        
$appId = $this->getAppId();
        static::assertIsString($appId);

        $flowActions = $this->getAppFlowActions($appId);
        static::assertIsArray($flowActions);
        static::assertArrayHasKey(0, $flowActions);
        static::assertIsArray($flowActions[0]);
        static::assertArrayHasKey('id', $flowActions[0]);

        $flowId = Uuid::randomHex();
        $this->createFlow($flowId);

        $sequenceId = Uuid::randomHex();
        $this->createSequence($sequenceId$flowId$flowActions[0]['id']);

        $flowAction = Action::createFromXmlFile(__DIR__ . '/_fixtures/withFlowExtension/Resources/flow-v2.xml');
        $flowActionPersister = $this->getContainer()->get(FlowActionPersister::class);
        $flowActionPersister->updateActions($flowAction$appId$context, 'en-GB');

        $appFlowActionId = $this->getAppFlowActionIdFromSequence($sequenceId);
        static::assertEquals($appFlowActionId$flowActions[0]['id']);
    }

    
return 1672934282;
    }

    public function update(Connection $connection): void
    {
        $templateTypeId = $connection->fetchOne('SELECT id FROM mail_template_type WHERE technical_name = :name', ['name' => MailTemplateTypes::MAILTYPE_REVIEW_FORM]);
        $templateId = $connection->fetchOne('SELECT id FROM mail_template WHERE mail_template_type_id = :id', ['id' => $templateTypeId]);
        if (!$templateId) {
            $templateId = Uuid::randomBytes();
        }

        $this->createFlow($connection$templateId);
    }

    public function updateDestructive(Connection $connection): void
    {
    }

    private function createFlow(Connection $connection, string $mailtTemplateId): void
    {
        $flowId = Uuid::randomBytes();

        $connection->insert(
            
public function update(Connection $connection): void
    {
        $templateTypeId = $connection->fetchOne('SELECT id FROM mail_template_type WHERE technical_name = :name', ['name' => MailTemplateTypes::MAILTYPE_DOWNLOADS_DELIVERY]);
        $templateId = $connection->fetchOne('SELECT id FROM mail_template WHERE mail_template_type_id = :id', ['id' => $templateTypeId]);

        if ($templateId === false) {
            $templateId = null;
        }

        $ruleId = $this->createRule($connection);
        $this->createFlow($connection$ruleId$templateId);
        $this->createFlowTemplate($connection$ruleId$templateId);
    }

    public function updateDestructive(Connection $connection): void
    {
        // nth     }

    private function createRule(Connection $connection): string
    {
        $ruleId = $connection->fetchOne('SELECT id FROM rule WHERE name = :name', ['name' => 'Shopping cart / Order with digital products']);

        
protected function setUp(): void
    {
        $this->connection = $this->getContainer()->get(Connection::class);
        $this->flowRepository = $this->getContainer()->get('flow.repository');
        $this->migration = new Migration1636362839FlowBuilderGenerateMultipleDoc();
        $this->ids = new TestDataCollection();
    }

    public function testMigration(): void
    {
        $this->createFlow();
        $this->migration->update($this->connection);

        $actionGenerateDocs = $this->connection->fetchAssociative(
            'SELECT id, action_name, config FROM flow_sequence WHERE action_name = :actionName',
            [
                'actionName' => 'action.generate.document',
            ]
        );

        static::assertIsArray($actionGenerateDocs);
        $newConfig = json_decode((string) $actionGenerateDocs['config'], true, 512, \JSON_THROW_ON_ERROR);
        
Home | Imprint | This part of the site doesn't use cookies.