2
require_once CORE_PATH . 'libs/ActiveRecord/db_pool/column.php';
3
class Rows implements ArrayAccess
3
* KumbiaPHP web & app Framework
7
* This source file is subject to the new BSD license that is bundled
8
* with this package in the file LICENSE.txt.
9
* It is also available through the world-wide-web at this URL:
10
* http://wiki.kumbiaphp.com/Licencia
11
* If you did not receive a copy of the license and are unable to
12
* obtain it through the world-wide-web, please send an email
13
* to license@kumbiaphp.com so we can send you a copy immediately.
19
* @copyright Copyright (c) 2005-2010 Kumbia Team (http://www.kumbiaphp.com)
20
* @license http://wiki.kumbiaphp.com/Licencia New BSD License
24
require_once CORE_PATH . 'libs/ActiveRecord/db_pool/attribute.php';
5
private $_columns = array();
33
private $_attributes = array();
9
40
private $_PK = NULL;
13
47
private $_FK = NULL;
17
private $_relations = array();
18
public function column ($col = NULL)
20
if (! isset($this->_columns[$col])) {
21
$this->_columns[$col] = new Column();
23
return $this->_columns[$col];
26
* Obtiene las Columnas
28
public function getColumns()
30
return $this->_columns;
33
* setea una relacion (asociaciones)
35
public function setRelation($column=NULL, $relation=NULL)
37
$this->_relations[$column] = $relation;
40
* Obtiene las Relaciones de la columna
42
public function getRelations($column=NULL)
44
if($column && array_key_exists($column, $this->_relations)){
45
return $this->_relations[$column];
47
return $this->_relations;
50
* Obtiene la metadata de un atributo
52
* @param string $attribute nombre de atributo
55
public function attribute ($attribute = NULL)
57
if (! isset($this->_attributes[$attribute])) {
58
$this->_attributes[$attribute] = new Attribute();
60
return $this->_attributes[$attribute];
63
* Obtiene los atributos
67
public function getAttributes()
69
return $this->_attributes;
73
* Asigna la clave primaria
49
77
public function setPK($pk=NULL)
83
* Obtiene la clave primaria
53
87
public function getPK()
93
* Asigna las claves foraneas
57
97
public function setFK($fk=NULL)
103
* Obtiene las claves foraneas
105
* @return array | NULL
61
107
public function getFK()
63
109
return $this->_FK;
66
//Implementacion de ArrayAccess
67
public function offsetExists ($offset)
69
return isset($this->_columns[$offset]);
71
public function offsetSet ($offset, $value)
73
//self::$_columns[$offset] = $value;
75
public function offsetGet ($offset)
77
//return self::$_columns[$offset];
79
public function offsetUnset ($offset)
81
unset($this->_columns[$offset]);
b'\\ No newline at end of file'