本文整理汇总了PHP中bindHashToObject函数的典型用法代码示例。如果您正苦于以下问题:PHP bindHashToObject函数的具体用法?PHP bindHashToObject怎么用?PHP bindHashToObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bindHashToObject函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bind
function bind($hash)
{
if (!is_array($hash)) {
return get_class($this) . "::bind failed";
} else {
bindHashToObject($hash, $this);
return NULL;
}
}
示例2: bind
/**
* Binds a named array/hash to this object
*
* can be overloaded/supplemented by the child class
* @param array $hash named array
* @return null|string null is operation was satisfactory, otherwise returns an error
*/
function bind($hash)
{
if (!is_array($hash)) {
$this->_error = get_class($this) . "::bind failed.";
return false;
} else {
bindHashToObject($hash, $this);
return true;
}
}
示例3: db_loadObject
/**
* This global function loads the first row of a query into an object
*
* If an object is passed to this function, the returned row is bound to the existing elements of <var>object</var>.
* If <var>object</var> has a value of null, then all of the returned query fields returned in the object.
* @param string The SQL query
* @param object The address of variable
*/
function db_loadObject($sql, &$object, $bindAll = false, $strip = true)
{
if ($object != null) {
$hash = array();
if (!db_loadHash($sql, $hash)) {
return false;
}
bindHashToObject($hash, $object, null, $strip, $bindAll);
return true;
} else {
$cur = db_exec($sql);
$cur or exit(db_error());
if ($object = db_fetch_object($cur)) {
db_free_result($cur);
return true;
} else {
$object = null;
return false;
}
}
}
示例4: bind
/**
* Binds a named array/hash to this object
*
* can be overloaded/supplemented by the child class
* @param array $hash named array
* @return null|string null is operation was satisfactory, otherwise returns an error
*/
function bind($hash)
{
if (!is_array($hash)) {
$this->_error = get_class($this) . "::bind failed.";
return false;
} else {
/*
* We need to filter out any object values from the array/hash so the bindHashToObject()
* doesn't die. We also avoid issues such as passing objects to non-object functions
* and copying object references instead of cloning objects. Object cloning (if needed)
* should be handled seperatly anyway.
*/
foreach ($hash as $k => $v) {
if (!is_object($hash[$k])) {
$filtered_hash[$k] = $v;
}
}
bindHashToObject($filtered_hash, $this);
return true;
}
}
示例5: bind
function bind($hash)
{
if (!is_array($hash)) {
return "Billing Code::bind failed";
} else {
bindHashToObject($hash, $this);
return NULL;
}
}
示例6: getObjectFromElement
/**
* Build an object from a DOM element
*
* @param DOMElement $element The DOM element
*
* @return CMbObject
*/
function getObjectFromElement(DOMElement $element)
{
$class = $element->getAttribute("class");
$object = new $class();
$values = self::getValuesFromElement($element);
foreach ($values as $_field => $_value) {
if ($_value && $object->_specs[$_field] instanceof CRefSpec && $_field !== $object->_spec->key) {
$this->importObjectByGuid($_value);
if (isset($this->map[$_value])) {
$values[$_field] = self::getIdFromGuid($this->map[$_value]);
}
}
}
bindHashToObject($values, $object);
return $object;
}
示例7: bind
/**
* Bind an object with an array
*
* @param array $hash associative array of values to match with
* @param bool $strip true to strip slashes
*
* @return bool
*/
function bind($hash, $strip = true)
{
bindHashToObject($strip ? stripslashes_deep($hash) : $hash, $this);
return true;
}
示例8: loadObject
/**
* Loads the first row of a query into an object
*
* If an object is passed to this function, the returned row is bound to the existing elements of $object.
* If $object has a value of null, then all of the returned query fields returned in the object.
*
* @param string $query The SQL query
* @param object &$object The address of variable
*
* @return bool
*/
function loadObject($query, &$object)
{
if ($object != null) {
if (null == ($hash = $this->loadHash($query))) {
return false;
}
bindHashToObject($hash, $object);
return true;
} else {
if (!($result = $this->exec($query))) {
return false;
}
$this->chronoFetch->start();
$object = $this->fetchObject($result);
$this->chronoFetch->stop();
$this->freeResult($result);
if ($object) {
return true;
} else {
$object = null;
return false;
}
}
}
示例9: CSejour
$consult->_rques_consult = CValue::get("_rques_consult", CValue::session("_rques_consult"));
$consult->_examen_consult = CValue::get("_examen_consult", CValue::session("_examen_consult"));
$sejour = new CSejour();
bindHashToObject($_GET + $_SESSION["dPpatients"], $sejour);
$sejour->loadRefsFwd();
$sejour->_rques_sejour = CValue::get("_rques_sejour", CValue::session("_rques_sejour"));
$interv = new COperation();
bindHashToObject($_GET + $_SESSION["dPpatients"], $interv);
$interv->loadRefsFwd();
$interv->_libelle_interv = CValue::get("_libelle_interv", CValue::session("_libelle_interv"));
$interv->_rques_interv = CValue::get("_rques_interv", CValue::session("_rques_interv"));
$antecedent = new CAntecedent();
bindHashToObject($_GET + $_SESSION["dPpatients"], $antecedent);
$antecedent->loadRefsFwd();
$traitement = new CTraitement();
bindHashToObject($_GET + $_SESSION["dPpatients"], $traitement);
$traitement->loadRefsFwd();
$prescription = new CPrescription();
$prescription->type = CValue::getOrSession("type_prescription");
$line_med = new CPrescriptionLineMedicament();
$line_med->code_ucd = CValue::getOrSession("code_ucd");
$line_med->code_cis = CValue::getOrSession("code_cis");
$line_med->_ucd_view = CValue::getOrSession("produit");
$libelle_produit = CValue::getOrSession("libelle_produit");
$classes_atc = CValue::getOrSession("classes_atc");
$keywords_atc = CValue::getOrSession("keywords_atc");
$composant = CValue::getOrSession("composant");
$keywords_composant = CValue::getOrSession("keywords_composant");
$indication = CValue::getOrSession("indication");
$type_indication = CValue::getOrSession("type_indication");
$keywords_indication = CValue::getOrSession("keywords_indication");
示例10: importObject
function importObject(DOMElement $element)
{
$id = $element->getAttribute("id");
if (isset($this->imported[$id])) {
return;
}
$this->name_suffix = " (import du " . CMbDT::dateTime() . ")";
$map_to = isset($this->map[$id]) ? $this->map[$id] : null;
switch ($element->getAttribute("class")) {
// --------------------
case "CExClass":
$values = self::getValuesFromElement($element);
$ex_class = new CExClass();
$ex_class->name = $this->options["ex_class_name"];
$ex_class->group_id = CGroups::loadCurrent()->_id;
$ex_class->pixel_positionning = $values["pixel_positionning"];
$ex_class->native_views = $values["native_views"];
$ex_class->_dont_create_default_group = true;
if ($msg = $ex_class->store()) {
throw new Exception($msg);
}
CAppUI::stepAjax("Formulaire '%s' créé", UI_MSG_OK, $ex_class->name);
$map_to = $ex_class->_guid;
break;
// --------------------
// --------------------
case "CExList":
if ($map_to == "__create__") {
/** @var CExList $_ex_list */
$_ex_list = $this->getObjectFromElement($element);
if ($msg = $_ex_list->store()) {
$_ex_list->name .= $this->name_suffix;
}
if ($msg = $_ex_list->store()) {
CAppUI::stepAjax($msg, UI_MSG_WARNING);
break;
}
CAppUI::stepAjax("Liste '%s' créée", UI_MSG_OK, $_ex_list);
$_elements = $this->getElementsByFwdRef("CExListItem", "list_id", $id);
foreach ($_elements as $_element) {
$_list_item = new CExListItem();
bindHashToObject(self::getValuesFromElement($_element), $_list_item);
$_list_item->list_id = $_ex_list->_id;
if ($msg = $_list_item->store()) {
CAppUI::stepAjax($msg, UI_MSG_WARNING);
break;
}
CAppUI::stepAjax("Elément de liste '%s' créé", UI_MSG_OK, $_list_item);
$_item_id = $_element->getAttribute("id");
$this->map[$_item_id] = $_list_item->_guid;
$this->imported[$_item_id] = true;
}
$map_to = $_ex_list->_guid;
} else {
/** @var CExList $ex_list */
$ex_list = CStoredObject::loadFromGuid($map_to);
$list_items = $ex_list->loadRefItems();
foreach ($list_items as $_item) {
$this->map[$_item->_guid] = $_item->_guid;
}
}
break;
// --------------------
// --------------------
case "CExConcept":
if ($map_to == "__create__") {
/** @var CExConcept $_ex_concept */
$_ex_concept = $this->getObjectFromElement($element);
if ($_ex_concept->ex_list_id) {
$_ex_concept->updatePropFromList();
}
$_ex_concept->prop = $_ex_concept->updateFieldProp($_ex_concept->prop);
if ($msg = $_ex_concept->store()) {
$_ex_concept->name .= $this->name_suffix;
}
if ($msg = $_ex_concept->store()) {
CAppUI::stepAjax($msg, UI_MSG_WARNING);
break;
}
CAppUI::stepAjax("Concept '%s' créé", UI_MSG_OK, $_ex_concept);
$map_to = $_ex_concept->_guid;
}
break;
case "CExClassField":
/** @var CExClassField $_ex_field */
$_ex_field = $this->getObjectFromElement($element);
if ($this->options["ignore_disabled_fields"] && $_ex_field->disabled) {
break;
}
$_ex_field->_make_unique_name = false;
// Met à jour default|XXX des champs enum pour garder la bonne référence
// @FIXME Ne fonctionne pas à cause du fait qu'il y a un concept_id ....
$_spec_obj = $_ex_field->getSpecObject();
if ($_spec_obj instanceof CEnumSpec && $_spec_obj->default) {
$_new_default = $this->getIdFromGuid($this->map["CExListItem-{$_spec_obj->default}"]);
$_ex_field->prop = preg_replace('/ default\\|\\d+/', " default|{$_new_default}", $_ex_field->prop);
}
if ($msg = $_ex_field->store()) {
CAppUI::stepAjax($msg, UI_MSG_WARNING);
break;
//.........这里部分代码省略.........