Browse Source

Merge pull request #536 from adam-vessey/7.x-INT-372

Recursive things are exclusively magical.
pull/538/head
Daniel Lamb 10 years ago
parent
commit
1dcee46574
  1. 46
      includes/tuque_wrapper.inc

46
includes/tuque_wrapper.inc

@ -166,16 +166,21 @@ class IslandoraFedoraObject extends FedoraObject {
public function __set($name, $value) { public function __set($name, $value) {
parent::__set($name, $value); parent::__set($name, $value);
// XXX: Due to the structure of the code, we cannot use property_exists() // Recursion only matters for magic properties... "Plain" properties cannot
// (because many of the properties are declared in the class, and the magic // call other code in order to start recursing, and in fact we would get
// triggers due them being NULLed), nor can we use isset() (because it is // stuck looping with a "plain" property.
// implemented as another magic function...). if ($this->propertyIsMagical($name)) {
$vars = get_object_vars($this); // XXX: Due to the structure of the code, we cannot use property_exists()
while (isset($vars[$name])) { // (because many of the properties are declared in the class, and the
$new_value = $this->$name; // magic triggers due them being NULLed), nor can we use isset() (because
unset($this->$name); // it is implemented as another magic function...).
parent::__set($name, $new_value);
$vars = get_object_vars($this); $vars = get_object_vars($this);
while (isset($vars[$name])) {
$new_value = $this->$name;
unset($this->$name);
parent::__set($name, $new_value);
$vars = get_object_vars($this);
}
} }
} }
@ -430,16 +435,21 @@ class IslandoraFedoraDatastream extends FedoraDatastream {
public function __set($name, $value) { public function __set($name, $value) {
parent::__set($name, $value); parent::__set($name, $value);
// XXX: Due to the structure of the code, we cannot use property_exists() // Recursion only matters for magic properties... "Plain" properties cannot
// (because many of the properties are declared in the class, and the magic // call other code in order to start recursing, and in fact we would get
// triggers due them being NULLed), nor can we use isset() (because it is // stuck looping with a "plain" property.
// implemented as another magic function...). if ($this->propertyIsMagical($name)) {
$vars = get_object_vars($this); // XXX: Due to the structure of the code, we cannot use property_exists()
while (isset($vars[$name])) { // (because many of the properties are declared in the class, and the
$new_value = $this->$name; // magic triggers due them being NULLed), nor can we use isset() (because
unset($this->$name); // it is implemented as another magic function...).
parent::__set($name, $new_value);
$vars = get_object_vars($this); $vars = get_object_vars($this);
while (isset($vars[$name])) {
$new_value = $this->$name;
unset($this->$name);
parent::__set($name, $new_value);
$vars = get_object_vars($this);
}
} }
} }

Loading…
Cancel
Save