function get($key = null) { $scope = $GLOBALS["CFG_ACTION"]->SCOPE; if ($scope == "_REQUEST" || $scope == "_POST" || $scope == "_GET") { $key = str_replace(".", "_", $key); } return Bean::get('$'.$scope, $key); }
function valueString() { reset($this->meta); $values = array(); while(list(,$meta) = each($this->meta)) { $value = Bean::get($this->value, String::camelize($meta["name"])); $values[] = $this->escape($value, $meta["name"]); } return implode(', ', $values); }
function load($name, $property = null) { Session::start(); if (empty($property)) { return $_SESSION[$name]; } else { $session = Bean::get($_SESSION[$name], $property); return $session; } }
function populate() { $scope = $GLOBALS["CFG_ACTION"]->SCOPE; $scopeVars = Bean::get('$'.$scope); while (list($key, $var) = each($scopeVars)) { if ($scope == "_REQUEST" || $scope == "_POST" || $scope == "_GET") { $key = str_replace("_", ".", $key); } Bean::set($this, $key, $var); } }
function delete($table, $obj, $schema = "DEFAULT") { $driver = $GLOBALS["CFG_DB"]->CON[$schema]->DRIVER; $objId = Bean::get($obj, "__ID__"); if (empty($objId)) { throw new Exception("Cannot delete unpersisted object"); } $delete = new Delete($table, $obj, $schema); $success = DB::query($delete, $schema); if (!$success) { $result = Bean::invoke(String::camelize('_'.$driver.'_driver'), "error", array($schema)); throw new Exception("Cannot delete object. ".$result); } }
function copy($source, &$destination, $includes) { while(list(,$include) = each($includes)) { $value = Bean::get($source, $include); Bean::set($destination, $include, $value); } }