title: pdo fetch object?
body: <p>Is there a better way to return object of db result?</p>
  
  <p>I am a aware "<code>return $statement-&gt;fetchall(PDO::FETCH_CLASS, 'modelClassName');</code>" but it only work on fetchall function?</p>
  
  <pre><code>class modelArea extends Model {
  
      public $areaID;
      public $postcode;
  
      public static function find($condition, $parameters) {
          $query = "SELECT * FROM area WHERE " . $condition;
  
          $statement = self::getDb()-&gt;prepare($query);
          if (!$statement-&gt;execute($parameters))
              return false;
  
          $query = $statement-&gt;fetch(PDO::FETCH_ASSOC);
  
          $a = new modelArea();
  
          $a-&gt;areaID = $query['areaID'];
          $a-&gt;postcode = $query['postcode'];
  
          return $a;
      }
  }
  </code></pre>