_model = &$model; $this->_table = &$table; if ($this->_data === NULL) { $this->_saved = FALSE; } else { $this->_data = $data; $this->_saved = TRUE; } } function &get($key) { $ret = NULL; if (isset($this->_cache[$key])) { $ret = &$this->_cache[$key]; } elseif ($this->_table->isRelation($key)) { $rel = &$this->_table->getRelation($key); $query = &$rel->createQuery($this->getId()); $finder = &$this->_model->getFinder($this->_table->getName()); if ($rel->isPlural()) { $ret = &$finder->findAllByQuery($query); } else { $ret = &$finder->findByQuery($query); } $this->_cache[$key] = &$ret; } elseif (method_exists($this, "get$key") && !method_exists(__CLASS__, "get$key")) { eval ("\$ret = &\$this->get$key();"); $this->_cache[$key] = &$ret; } elseif (isset($this->_dirty[$key])) { $ret = $this->_dirty[$key]; } elseif (isset($this->_data[$key])) { $ret = $this->_data[$key]; } return $ret; } function getId() { return $this->_data[$this->_table->getPrimaryKey()]; } function cacheAble() { return FALSE; } function cacheObject($file) { require_once K4_BASE_DIR .'/cache.php'; $cache = &new RecordCache; $cache->setFile($file); $cache->setObject($this); $cache->create(); } } ?>