Exemplo n.º 1
0
 /**
  * @param bool|true $safe
  * @return $this
  */
 public function returnObjects($safe = true)
 {
     $cls = $this->metadata->getModelClass();
     $dbColsAsKeys = array_flip($this->metadata->getDbColNames());
     $this->rowDataMapper = function ($row) use($cls, $dbColsAsKeys, $safe) {
         if ($safe) {
             return new $cls(array_intersect_key($row, $dbColsAsKeys), false);
         } else {
             return new $cls($row, false);
         }
     };
     return $this;
 }