public function query($criterium = null, $restriction = null) { $stmt = sprintf('select %s from %s %s %s', implode(', ', $this->entity->getSingulars()), $this->entity->name, strlen(trim("{$criterium}")) == 0 ? '' : " where {$criterium}", $restriction == null ? '' : " {$restriction}"); return $this->toObject(SimpleORM_Connection::query($stmt)); }