Exemplo n.º 1
0
 /**
  * @return Model[]
  */
 function findAll($orderDesc = false)
 {
     $models = [];
     $post = null;
     if ($orderDesc) {
         $post = 'order by :id desc';
     }
     $rawData = $this->connection->selectAll(['*'], [$this->table], $post);
     foreach ($rawData as $row) {
         $model = $this->hydrateData($row, $this->class, $this->connection, $this->app);
         $models[] = $model;
         if (in_array($model, $this->entities, true)) {
             $this->entities[array_search($model, $this->entities)] = $model;
         } else {
             $this->entities[] = $model;
         }
     }
     return $models;
 }