query = "SELECT * FROM {$this->table} m WHERE 1=1"; if (!empty($fila)) { $data['fila'] = $fila; $this->query .= " AND (m.fila = :fila OR m.fila IS null)"; } else { $this->query .= " AND m.fila IS null"; } $this->query .= " AND m.momento = :momento ORDER BY ordem"; return $this->read($this->query, $data)->fetchAll(); } }