public function updateDeliveryExecutionState($identifier, $fromState, $toState)
    {
        try {
            if ($fromState === $toState) {
                // do nothing, when the state didn't change
                return true;
            }

            $query = $this->getQueryBuilder()
                ->update(self::TABLE_NAME)
                ->set(self::COLUMN_STATUS, ":status")
                ->where(self::COLUMN_ID . " = :id")
                ->setParameter("status", $toState)
                ->setParameter("id", $identifier)
            ;

            if ($toState === DeliveryExecutionInterface::STATE_FINISHED) {
                $query
                    ->set(self::COLUMN_FINISHED_AT, ":finishedAt")
                    ->setParameter("finishedAt", $this->getCurrentDateTime())
                ;
            }

            return $query->execute() === 1;
        } catch (\Exception $e) {
            return false;
        }

    }
public function updateDeliveryExecutionState($identifier, $fromState, $toState)
    {
        try {
            if ($fromState === $toState) {
                // do nothing, when the state didn't change
                return true;
            }

            $query = $this->getQueryBuilder()
                ->update(self::TABLE_NAME)
                ->set(self::COLUMN_STATUS, ":status")
                ->where(self::COLUMN_ID . " = :id")
                ->setParameter("status", $toState)
                ->setParameter("id", $identifier)
            ;

            if ($toState === DeliveryExecutionInterface::STATE_FINISHED) {
                $query
                    ->set(self::COLUMN_FINISHED_AT, ":finishedAt")
                    ->setParameter("finishedAt", $this->getCurrentDateTime())
                ;
            }

            return $query->execute() === 1;
        } catch (\Exception $e) {
            return false;
        }

    }
public function updateDeliveryExecutionState ( $ identifier , $ fromState , $ toState ) { try { if ( $ fromState === $ toState ) { // do nothing, when the state didn't change return true ; } $ query = $ this -> getQueryBuilder ( ) -> update ( self :: TABLE_NAME ) -> set ( self :: COLUMN_STATUS , ":status" ) -> where ( self :: COLUMN_ID . " = :id" ) -> setParameter ( "status" , $ toState ) -> setParameter ( "id" , $ identifier ) ; if ( $ toState === DeliveryExecutionInterface :: STATE_FINISHED ) { $ query -> set ( self :: COLUMN_FINISHED_AT , ":finishedAt" ) -> setParameter ( "finishedAt" , $ this -> getCurrentDateTime ( ) ) ; } return $ query -> execute ( ) === 1 ; } catch ( \ Exception $ e ) { return false ; } }
Updates the state of the given deliveryexecution

@param string $identifier                         the ID of the delivery execution
@param core_kernel_classes_Resource $fromState    the original state
@param string $toState                            the desired state
@return bool                                      true if the update went well, false otherwise
Updates the state of the given deliveryexecution