protected function fetchAsObject(Statement $stmt)
    {
        $stmt->setFetchMode(\PDO::FETCH_CLASS, $this->model->entity());
        $result = $stmt->fetchAll();

        $ref = new \ReflectionClass($this->model->entity());
        foreach ($result as $entity) {
            $this->restoreObject($entity, $this->casts, $ref);
        }

        return $result;
    }
protected function fetchAsObject(Statement $stmt)
    {
        $stmt->setFetchMode(\PDO::FETCH_CLASS, $this->model->entity());
        $result = $stmt->fetchAll();

        $ref = new \ReflectionClass($this->model->entity());
        foreach ($result as $entity) {
            $this->restoreObject($entity, $this->casts, $ref);
        }

        return $result;
    }
protected function fetchAsObject ( Statement $ stmt ) { $ stmt -> setFetchMode ( \ PDO :: FETCH_CLASS , $ this -> model -> entity ( ) ) ; $ result = $ stmt -> fetchAll ( ) ; $ ref = new \ ReflectionClass ( $ this -> model -> entity ( ) ) ; foreach ( $ result as $ entity ) { $ this -> restoreObject ( $ entity , $ this -> casts , $ ref ) ; } return $ result ; }
Fetches result as entity object

@param Statement $stmt

@return array
Fetches result as entity object