public function getById($id, $col = null)
    {
        $col = ($col) ?: $this->getPrimaryKey();
        $select = $this->getSelect()->where([$col => $id]);
        $resultSet = $this->fetchResult($select);

        if ($resultSet->count() > 1) {
            $rowSet = [];
            foreach ($resultSet as $row) {
                $rowSet[] = $row;
            }
        } elseif ($resultSet->count() === 1) {
            $rowSet = $resultSet->current();
        } else {
            $rowSet = $this->getModel();
        }

        return $rowSet;
    }
public function getById($id, $col = null)
    {
        $col = ($col) ?: $this->getPrimaryKey();
        $select = $this->getSelect()->where([$col => $id]);
        $resultSet = $this->fetchResult($select);

        if ($resultSet->count() > 1) {
            $rowSet = [];
            foreach ($resultSet as $row) {
                $rowSet[] = $row;
            }
        } elseif ($resultSet->count() === 1) {
            $rowSet = $resultSet->current();
        } else {
            $rowSet = $this->getModel();
        }

        return $rowSet;
    }
public function getById ( $ id , $ col = null ) { $ col = ( $ col ) ? : $ this -> getPrimaryKey ( ) ; $ select = $ this -> getSelect ( ) -> where ( [ $ col => $ id ] ) ; $ resultSet = $ this -> fetchResult ( $ select ) ; if ( $ resultSet -> count ( ) > 1 ) { $ rowSet = [ ] ; foreach ( $ resultSet as $ row ) { $ rowSet [ ] = $ row ; } } elseif ( $ resultSet -> count ( ) === 1 ) { $ rowSet = $ resultSet -> current ( ) ; } else { $ rowSet = $ this -> getModel ( ) ; } return $ rowSet ; }
Gets one or more rows by its id

@param $id
@param null|string $col
@return array|ModelInterface
Gets one or more rows by its id