fetchStateId example


        // implement update destructive     }

    private function addOrderTransactionStates(Connection $connection): void
    {
        $stateMachineId = (string) $connection->fetchOne(
            'SELECT `id` FROM `state_machine` WHERE `technical_name` = :technical_name LIMIT 1',
            ['technical_name' => OrderTransactionStates::STATE_MACHINE]
        );

        $stateOpenId = $this->fetchStateId(OrderTransactionStates::STATE_OPEN, $stateMachineId$connection);

        $stateRemindedId = $this->fetchStateId(OrderTransactionStates::STATE_REMINDED, $stateMachineId$connection);

        $statePaidPartiallyId = $this->fetchStateId('paid_partially', $stateMachineId$connection);

        $statePaidId = $this->fetchStateId('paid', $stateMachineId$connection);

        $stateRefundedPartiallyId = $this->fetchStateId(
            OrderTransactionStates::STATE_PARTIALLY_REFUNDED,
            $stateMachineId,
            $connection
        );

        // implement update destructive     }

    private function addOrderTransactionStates(Connection $connection): void
    {
        $stateMachineId = (string) $connection->fetchOne(
            'SELECT `id` FROM `state_machine` WHERE `technical_name` = :technical_name LIMIT 1',
            ['technical_name' => OrderTransactionStates::STATE_MACHINE]
        );

        $stateOpenId = $this->fetchStateId(OrderTransactionStates::STATE_OPEN, $stateMachineId$connection);

        $statePaidPartiallyId = $this->fetchStateId('paid_partially', $stateMachineId$connection);

        $statePaidId = $this->fetchStateId('paid', $stateMachineId$connection);

        // from "open" to paid         $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'paid', 'from_state_id' => $stateOpenId, 'to_state_id' => $statePaidId, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT)]);

        $connection->insert('state_machine_transition', ['id' => Uuid::randomBytes(), 'state_machine_id' => $stateMachineId, 'action_name' => 'paid_partially', 'from_state_id' => $stateOpenId, 'to_state_id' => $statePaidPartiallyId, 'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT)]);
    }

    
Home | Imprint | This part of the site doesn't use cookies.