src/Data/DefaultDataProvider.php
public function getVersions($mixID, $onlyActive = false)
    {
        $queryBuilder = $this->connection->createQueryBuilder();
        $queryBuilder->select(['tstamp', 'version', 'username', 'active']);
        $queryBuilder->from('tl_version');
        $queryBuilder->andWhere($queryBuilder->expr()->eq('tl_version.formTable', ':formTable'));
        $queryBuilder->setParameter(':formTable', $this->source);
        $queryBuilder->andWhere($queryBuilder->expr()->eq('tl_version.pid', ':pid'));
        $queryBuilder->setParameter(':pid', $mixID);

        if ($onlyActive) {
            $queryBuilder->andWhere($queryBuilder->expr()->eq('tl_version.active', ':active'));
            $queryBuilder->setParameter(':active', '1');
        } else {
            $queryBuilder->orderBy('tl_version.version', 'DESC');
        }

        $statement = $queryBuilder->execute();
        if (0 === $statement->rowCount()) {
            return null;
        }

        $versions = $statement->fetch(\PDO::FETCH_ASSOC);

        $collection = $this->getEmptyCollection();

        foreach ($versions as $versionValue) {
            $model = $this->getEmptyModel();
            $model->setId($mixID);

            foreach ($versionValue as $key => $value) {
                if ($key === $this->idProperty) {
                    continue;
                }

                $model->setProperty($key, $value);
            }

            $collection->push($model);
        }

        return $collection;
    }
public function getVersions($mixID, $onlyActive = false)
    {
        $queryBuilder = $this->connection->createQueryBuilder();
        $queryBuilder->select(['tstamp', 'version', 'username', 'active']);
        $queryBuilder->from('tl_version');
        $queryBuilder->andWhere($queryBuilder->expr()->eq('tl_version.formTable', ':formTable'));
        $queryBuilder->setParameter(':formTable', $this->source);
        $queryBuilder->andWhere($queryBuilder->expr()->eq('tl_version.pid', ':pid'));
        $queryBuilder->setParameter(':pid', $mixID);

        if ($onlyActive) {
            $queryBuilder->andWhere($queryBuilder->expr()->eq('tl_version.active', ':active'));
            $queryBuilder->setParameter(':active', '1');
        } else {
            $queryBuilder->orderBy('tl_version.version', 'DESC');
        }

        $statement = $queryBuilder->execute();
        if (0 === $statement->rowCount()) {
            return null;
        }

        $versions = $statement->fetch(\PDO::FETCH_ASSOC);

        $collection = $this->getEmptyCollection();

        foreach ($versions as $versionValue) {
            $model = $this->getEmptyModel();
            $model->setId($mixID);

            foreach ($versionValue as $key => $value) {
                if ($key === $this->idProperty) {
                    continue;
                }

                $model->setProperty($key, $value);
            }

            $collection->push($model);
        }

        return $collection;
    }
public function getVersions ( $ mixID , $ onlyActive = false ) { $ queryBuilder = $ this -> connection -> createQueryBuilder ( ) ; $ queryBuilder -> select ( [ 'tstamp' , 'version' , 'username' , 'active' ] ) ; $ queryBuilder -> from ( 'tl_version' ) ; $ queryBuilder -> andWhere ( $ queryBuilder -> expr ( ) -> eq ( 'tl_version.formTable' , ':formTable' ) ) ; $ queryBuilder -> setParameter ( ':formTable' , $ this -> source ) ; $ queryBuilder -> andWhere ( $ queryBuilder -> expr ( ) -> eq ( 'tl_version.pid' , ':pid' ) ) ; $ queryBuilder -> setParameter ( ':pid' , $ mixID ) ; if ( $ onlyActive ) { $ queryBuilder -> andWhere ( $ queryBuilder -> expr ( ) -> eq ( 'tl_version.active' , ':active' ) ) ; $ queryBuilder -> setParameter ( ':active' , '1' ) ; } else { $ queryBuilder -> orderBy ( 'tl_version.version' , 'DESC' ) ; } $ statement = $ queryBuilder -> execute ( ) ; if ( 0 === $ statement -> rowCount ( ) ) { return null ; } $ versions = $ statement -> fetch ( \ PDO :: FETCH_ASSOC ) ; $ collection = $ this -> getEmptyCollection ( ) ; foreach ( $ versions as $ versionValue ) { $ model = $ this -> getEmptyModel ( ) ; $ model -> setId ( $ mixID ) ; foreach ( $ versionValue as $ key => $ value ) { if ( $ key === $ this -> idProperty ) { continue ; } $ model -> setProperty ( $ key , $ value ) ; } $ collection -> push ( $ model ) ; } return $ collection ; }
Return a list with all versions for the row with the given Id.

@param mixed   $mixID      The ID of the row.
@param boolean $onlyActive If true, only active versions will get returned, if false all version will get
returned.

@return CollectionInterface
Return a list with all versions for the row with the given Id .