lib/Persistence/Doctrine/Helper/PositionHelper.php
private function incrementPositions(array $conditions, ?int $startPosition = null, ?int $endPosition = null): void
    {
        $columnName = $conditions['column'];

        $query = $this->connection->createQueryBuilder();

        $query
            ->update($conditions['table'])
            ->set($columnName, $columnName . ' + 1');

        if ($startPosition !== null) {
            $query->andWhere($query->expr()->gte($columnName, ':start_position'));
            $query->setParameter('start_position', $startPosition, Type::INTEGER);
        }

        if ($endPosition !== null) {
            $query->andWhere($query->expr()->lte($columnName, ':end_position'));
            $query->setParameter('end_position', $endPosition, Type::INTEGER);
        }

        $this->applyConditions($query, $conditions['conditions']);

        $query->execute();
    }
private function incrementPositions(array $conditions, ?int $startPosition = null, ?int $endPosition = null): void
    {
        $columnName = $conditions['column'];

        $query = $this->connection->createQueryBuilder();

        $query
            ->update($conditions['table'])
            ->set($columnName, $columnName . ' + 1');

        if ($startPosition !== null) {
            $query->andWhere($query->expr()->gte($columnName, ':start_position'));
            $query->setParameter('start_position', $startPosition, Type::INTEGER);
        }

        if ($endPosition !== null) {
            $query->andWhere($query->expr()->lte($columnName, ':end_position'));
            $query->setParameter('end_position', $endPosition, Type::INTEGER);
        }

        $this->applyConditions($query, $conditions['conditions']);

        $query->execute();
    }
private function incrementPositions ( array $ conditions , ? int $ startPosition = null , ? int $ endPosition = null ) : void { $ columnName = $ conditions [ 'column' ] ; $ query = $ this -> connection -> createQueryBuilder ( ) ; $ query -> update ( $ conditions [ 'table' ] ) -> set ( $ columnName , $ columnName . ' + 1' ) ; if ( $ startPosition !== null ) { $ query -> andWhere ( $ query -> expr ( ) -> gte ( $ columnName , ':start_position' ) ) ; $ query -> setParameter ( 'start_position' , $ startPosition , Type :: INTEGER ) ; } if ( $ endPosition !== null ) { $ query -> andWhere ( $ query -> expr ( ) -> lte ( $ columnName , ':end_position' ) ) ; $ query -> setParameter ( 'end_position' , $ endPosition , Type :: INTEGER ) ; } $ this -> applyConditions ( $ query , $ conditions [ 'conditions' ] ) ; $ query -> execute ( ) ; }
Increments all positions in a table starting from provided position.
Increments all positions in a table starting from provided position .