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. 22
      includes/tuque_wrapper.inc

22
includes/tuque_wrapper.inc

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

Loading…
Cancel
Save