/** * Retrieves all entities from the database * @return array */ public function all() { $query = $this->table->getAllSQL(); $result = $this->runQuery($query); $entities = array(); while ($obj = $result->fetch_object()) { $entities[] = $entity = $this->cast($obj); } return $entities; }