Ben bu bir sürü rastlamak ve daha iyi bir yolu olup olmadığını hep merak edilmiştir.
(Örnek sadece bir OO sorgu oluşturucu varsayıyorum) Bu düşünün
class Dogs extends Pets {
    public function getAll() {
        return $this->parseRows($this->db->get('dogs'));
    }
    public function getBig() {
        return $this->parseRows($this->db->get('dogs')->where('size', '>', 10));
    }
    public function getSmelly() {
        return $this->parseRows($this->db->get('dogs')->where('smell', '=', 'bad'));
    }
    private function parseRows($rows) {
        foreach($rows as &$row) {
            $row['id'] = (int) $row['id'];
            $row['categoryName'] = Categories::getById($row['categoryId']);
        }
        return $rows;
    }
}
Temelde, veritabanı sorgularını bir çok kullanmak gerekir, ama hepsi onlara şeyleri atamak için bir post-processing geçmesi gerekir. Ben yukarıdaki gibi bir desen kullanarak edilmiştir.
Bu yapmak için en pratik yolu nedir?
