function __construct(&$obj, &$datasource, $conditions_separator = "WHERE") { if (!unserializer_active()) { $this->_object = $obj; $this->_ds = $datasource; $this->_where = new ConditionTree(-1, "AND", $conditions_separator); $this->_currentTree = $this->_where; $this->_knownmodels = array($obj); } }
/** * The one and only constructor for all subclasses. * * These must not implement a constructor but the __initialize method. */ function __construct() { if (!hook_already_fired(HOOK_PRE_RENDER)) { register_hook(HOOK_PRE_RENDER, $this, "PreRender"); } else { if (!hook_already_fired(HOOK_POST_EXECUTE)) { register_hook(HOOK_POST_EXECUTE, $this, "PreRender"); } } if (!unserializer_active()) { create_storage_id($this); $args = func_get_args(); if (count($args) != 1 || $args[0] !== 'Make is calling so skip __initialize call') { system_call_user_func_array_byref($this, '__initialize', $args); } } }
/** * Override this method instead of writing a constructor. * * @param string $file Template file for this class. Usually '' (empty string) */ function __initialize($file = "") { $this->file = $file; if (!unserializer_active()) { create_storage_id($this); $this->set('id', $this->_storage_id); } }
/** * Creates a object id * * ScavixWDF will create IDs for <Renderable> objects automatically and ensures uniqueness for * the whole session. This method creates such an id based on the given objects classname. * It will store it to `$obj->_storage_id` and return it. * @param object $obj Object which needs an id * @return string The generated object id */ function CreateId(&$obj) { global $CONFIG; if (unserializer_active()) { log_trace("create_storage_id while unserializing object of type " . get_class_simple($obj)); $obj->_storage_id = "to_be_overwritten_by_unserializer"; return $obj->_storage_id; } $cn = strtolower(get_class_simple($obj)); if (!isset($GLOBALS['object_ids'][$cn])) { $i = 1; while (isset($_SESSION[$CONFIG['session']['prefix'] . "session"][$cn . $i])) { $i++; } $GLOBALS['object_ids'][$cn] = $i; } else { $GLOBALS['object_ids'][$cn]++; } $obj->_storage_id = $cn . $GLOBALS['object_ids'][$cn]; if (session_id()) { $_SESSION['object_id_storage'] = $GLOBALS['object_ids']; } return $obj->_storage_id; }
function __initialize($datasource = null) { if ($datasource && !$datasource instanceof DataSource) { WdfDbException::Raise("Invalid argument. Object of type DataSource expected", $datasource); } $this->_ds = $datasource; if ($this->_ds) { if (!isset($this->_cacheKey) || !$this->_cacheKey) { $this->_cacheKey = $this->_ds->Database() . $this->_className; } if (!unserializer_active()) { $this->__ensureTableSchema(); } } else { log_trace("Missing datasource argument"); } }