PHP midgard_collector method set
Sets new key value , subeky's name and its value.
bool __set(string 'key_value', string 'subkey_name', mixed subkey_value);__
midgard_collector method set takes three parameter:
- __key_value__ , value for collector's key
- __subkey_name__, property name for subkey
- __subkey_value__, subkey's value
Returns TRUE is key_value, subkey_name and subkey_value has been succesfully set in collector's arrays , otherwise returns FALSE.
Cases to return FALSE:
- subkey_name property is not registered for the classname for which collector object has been initialized
- subkey_value has invalid type.
More details about fails can be found in midgard-core docs.
If key_value already exists in collector's array then its old value and subkey's array is destroyed ( if exists ) and new one is set. Otherwise new key's value and its subkey's array is added to collection.
This method is used internally by execute method, so set method can be invoked before execute one is, or after it has been invoked. If database values have higher priority then set method should be called before execute one ( it will overwrite exisitng keys ). If database value has lower prority then set method should be called after execute one.
Example
<?php
$_fs_element_value = file_get_contents($filename);
$mc = new midgard_collector("midgard_element", "style", $id);
$mc->set_key_property("name");
$mc->add_value_property("value");
$mc->set("code-init", "value", "<?php exit; ?>");
$mc->set("show-article", "value", $_fs_element_value);
$mc->execute();
?>
