/** * @param $tablename The name of the table that owns this record. * @param $values An associative array of values to populate the record. */ function Dataface_Record($tablename, $values = null) { $app =& Dataface_Application::getInstance(); $this->_id = Dataface_Record::_nextId(); $this->_tablename = $tablename; $this->_table =& Dataface_Table::loadTable($tablename); $this->_delegate =& $this->_table->getDelegate(); $this->lang = $app->_conf['lang']; if ($values !== null) { $this->setValues($values); $this->setSnapshot(); } }
/** * @param $tablename The name of the table that owns this record. * @param $values An associative array of values to populate the record. */ function Dataface_Record($tablename, $values = null) { $app =& Dataface_Application::getInstance(); $this->_id = Dataface_Record::_nextId(); $this->_tablename = $tablename; $this->_table =& Dataface_Table::loadTable($tablename); $this->_delegate =& $this->_table->getDelegate(); $this->lang = $app->_conf['lang']; if ($values !== null) { if (is_a($values, 'StdClass')) { $values = get_object_vars($values); } if (is_array($values)) { foreach ($values as $k => $v) { $this->setValue($k, $v); } $this->setSnapshot(); } //$this->setValues($values); } }