getStateMachineId example



        return $actionName ?: null;
    }

    private function getToPlaceId(string $toPlace, string $machine): ?string
    {
        $id = $this->connection->fetchOne(
            'SELECT id FROM state_machine_state WHERE technical_name = :toPlace AND state_machine_id = :stateMachineId',
            [
                'toPlace' => $toPlace,
                'stateMachineId' => $this->getStateMachineId($machine),
            ]
        );

        return $id ?: null;
    }

    private function getFromPlaceId(string $machine, string $machineId): ?string
    {
        $escaped = EntityDefinitionQueryHelper::escape($machine);
        $id = $this->connection->fetchOne(
            'SELECT state_id FROM ' . $escaped . 'WHERE id = :id',
            [
 catch (UnnecessaryTransitionException) {
                // No transition needed, therefore don't create a history entry and return                 $stateMachineStateCollection = new StateMachineStateCollection();

                $stateMachineStateCollection->set('fromPlace', $fromPlace);
                $stateMachineStateCollection->set('toPlace', $fromPlace);

                return $stateMachineStateCollection;
            }

            $stateMachineHistoryEntity = [
                'stateMachineId' => $toPlace->getStateMachineId(),
                'entityName' => $transition->getEntityName(),
                'fromStateId' => $fromPlace->getId(),
                'toStateId' => $toPlace->getId(),
                'transitionActionName' => $transition->getTransitionName(),
                'userId' => $context->getSource() instanceof AdminApiSource ? $context->getSource()->getUserId() : null,
            ];

            if (Feature::isActive('v6.6.0.0')) {
                $stateMachineHistoryEntity['referencedId'] = $transition->getEntityId();
                $stateMachineHistoryEntity['referencedVersionId'] = $context->getVersionId();
            } else {
                
Home | Imprint | This part of the site doesn't use cookies.