src/MetaModel.php
protected function fetchRows($arrIds, $arrAttrOnly = array())
    {
        /** @var QueryBuilder $builder */
        $builder = $this->getConnection()->createQueryBuilder();
        $query   = $builder
            ->select('*')
            ->from($this->getTableName())
            ->where($builder->expr()->in('id', ':values'))
            ->setParameter('values', $arrIds, Connection::PARAM_STR_ARRAY)
            ->orderBy('FIELD(id, :values)')
            ->execute();

        // If we have an attribute restriction, make sure we keep the system columns. See #196.
        if ($arrAttrOnly) {
            $arrAttrOnly = array_merge($this->systemColumns, $arrAttrOnly);
        }

        $result = [];
        while ($row = $query->fetch(\PDO::FETCH_ASSOC)) {
            $data = [];
            foreach ($row as $attribute => $value) {
                if ((!$arrAttrOnly) || (in_array($attribute, $arrAttrOnly, true))) {
                    $data[$attribute] = $value;
                }
            }

            $result[$row['id']] = $data;
        }

        return $result;
    }
protected function fetchRows($arrIds, $arrAttrOnly = array())
    {
        /** @var QueryBuilder $builder */
        $builder = $this->getConnection()->createQueryBuilder();
        $query   = $builder
            ->select('*')
            ->from($this->getTableName())
            ->where($builder->expr()->in('id', ':values'))
            ->setParameter('values', $arrIds, Connection::PARAM_STR_ARRAY)
            ->orderBy('FIELD(id, :values)')
            ->execute();

        // If we have an attribute restriction, make sure we keep the system columns. See #196.
        if ($arrAttrOnly) {
            $arrAttrOnly = array_merge($this->systemColumns, $arrAttrOnly);
        }

        $result = [];
        while ($row = $query->fetch(\PDO::FETCH_ASSOC)) {
            $data = [];
            foreach ($row as $attribute => $value) {
                if ((!$arrAttrOnly) || (in_array($attribute, $arrAttrOnly, true))) {
                    $data[$attribute] = $value;
                }
            }

            $result[$row['id']] = $data;
        }

        return $result;
    }
protected function fetchRows ( $ arrIds , $ arrAttrOnly = array ( ) ) { /** @var QueryBuilder $builder */ $ builder = $ this -> getConnection ( ) -> createQueryBuilder ( ) ; $ query = $ builder -> select ( '*' ) -> from ( $ this -> getTableName ( ) ) -> where ( $ builder -> expr ( ) -> in ( 'id' , ':values' ) ) -> setParameter ( 'values' , $ arrIds , Connection :: PARAM_STR_ARRAY ) -> orderBy ( 'FIELD(id, :values)' ) -> execute ( ) ; // If we have an attribute restriction, make sure we keep the system columns. See #196. if ( $ arrAttrOnly ) { $ arrAttrOnly = array_merge ( $ this -> systemColumns , $ arrAttrOnly ) ; } $ result = [ ] ; while ( $ row = $ query -> fetch ( \ PDO :: FETCH_ASSOC ) ) { $ data = [ ] ; foreach ( $ row as $ attribute => $ value ) { if ( ( ! $ arrAttrOnly ) || ( in_array ( $ attribute , $ arrAttrOnly , true ) ) ) { $ data [ $ attribute ] = $ value ; } } $ result [ $ row [ 'id' ] ] = $ data ; } return $ result ; }
Fetch the "native" database rows with the given ids.

@param string[] $arrIds      The ids of the items to retrieve the order of ids is used for sorting of the return
values.

@param string[] $arrAttrOnly Names of the attributes that shall be contained in the result, defaults to array()
which means all attributes.

@return array an array containing the database rows with each column "deserialized".

@SuppressWarnings(PHPMD.Superglobals)
@SuppressWarnings(PHPMD.CamelCaseVariableName)
Fetch the native database rows with the given ids .