~desarrollokumbia/kumbia/ActiveRecord

« back to all changes in this revision

Viewing changes to active_record2/kumbia_model.php

  • Committer: Emilio Silveira
  • Date: 2010-09-05 02:56:46 UTC
  • Revision ID: emilio.rst@gmail.com-20100905025646-m9dpy5rlveetcsgx
Integrando metadata en kumbia_model.php

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 * @copyright  Copyright (c) 2005-2010 KumbiaPHP Team (http://www.kumbiaphp.com)
25
25
 * @license    http://wiki.kumbiaphp.com/Licencia     New BSD License
26
26
 */
27
 
class KumbiaModel
 
27
abstract class KumbiaModel
28
28
{
29
29
    /**
30
30
     * Instancias de metadata de modelos
31
31
     *
32
32
     * @var array
33
 
     **/
 
33
     */
34
34
    private static $_metadata = array();
35
35
    
36
36
    /**
37
37
     * Obtiene la metatada de un modelo
38
38
     *
39
39
     * @return Metadata
40
 
     **/
41
 
    public static function metadata($model)
 
40
     */
 
41
    public function metadata()
42
42
    {
 
43
                $model = get_class($this);
 
44
                
43
45
        if(!isset(self::$_metadata[$model])) {
44
 
            self::$_metadata[$model] = new Metadata();
 
46
            self::$_metadata[$model] = DbAdapter::factory($this->getConnection())->describe($this->getTable(), $this->getSchema());
45
47
        }
46
 
        
 
48
                
47
49
        return self::$_metadata[$model];
48
50
    }
49
 
}
 
 
b'\\ No newline at end of file'
 
51
}