~desarrollokumbia/kumbia/ActiveRecord

« back to all changes in this revision

Viewing changes to db_pool/metadata.php

  • Committer: Deivinson Tejeda
  • Date: 2010-01-24 20:53:08 UTC
  • Revision ID: deivinsontejeda@gmail.com-20100124205308-hsovf0apo3pbg3s0
Mejorando el chain where, quedan ahora los metodos where() y whereOr y se puede concatenar los where, ademas se crea un método interno para el DbQuery quien ira armando el los where en el orden como se vayan llamando y para dejar mas facil el where y whereOr solo reciben string asi no liamos a los usarios con array, sin embargo seguimos evaluando
Eje...
    public function consulta()
    {
        $this->get()->where('id < :id2')
                    ->where('id > :id')
                    ->bind(array(':id'=>2, ':id2'=>5));
        return $this->find();
    }
la consulta generada del anterios chain es:
SELECT * FROM prueba WHERE  (id < :id2)  AND (id > :id)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
class Metadata
27
27
{
28
28
    /**
29
 
     * Atributos de modelo (metadata)
 
29
     * Atributos de modelo
30
30
     *
31
31
     * @var array
32
32
     **/
33
33
    private $_attributes = array();
34
 
 
35
 
        /**
36
 
         * Lista de atributos
37
 
         * 
38
 
         * @var array 
39
 
         */
40
 
        private $_attributesList = array();
41
34
    
42
35
    /**
43
36
     * Clave primaria
63
56
    {
64
57
        if (! isset($this->_attributes[$attribute])) {
65
58
            $this->_attributes[$attribute] = new Attribute();
66
 
                        $this->_attributesList[] = $attribute;
67
59
        }
68
60
        return $this->_attributes[$attribute];
69
61
    }
70
 
        
71
62
    /**
72
63
     * Obtiene los atributos
73
64
     *
79
70
    }
80
71
    
81
72
    /**
82
 
     * Obtiene la lista de atributos
83
 
     *
84
 
     * @return array
85
 
     */
86
 
    public function getAttributesList()
87
 
    {
88
 
        return $this->_attributesList;
89
 
    }
90
 
        
91
 
    /**
92
73
     * Asigna la clave primaria
93
74
     *
94
75
     * @param string $pk
127
108
    {
128
109
        return $this->_FK;
129
110
    }
130
 
}
 
111
}
 
 
b'\\ No newline at end of file'