src/Entity.php
public function &__get($name) {
    if ($name === 'guid') {
      return $this->$name;
    }
    if ($this->isASleepingReference) {
      $this->referenceWake();
    }
    if ($name === 'cdate'
        || $name === 'mdate'
        || $name === 'tags'
      ) {
      return $this->$name;
    }
    // Unserialize.
    if (isset($this->sdata[$name])) {
      $this->data[$name] = unserialize($this->sdata[$name]);
      unset($this->sdata[$name]);
    }
    // Check for an entity first.
    if (isset($this->entityCache[$name])) {
      if ($this->data[$name][0] === 'nymph_entity_reference') {
        if ($this->entityCache[$name] === 0) {
          // The entity hasn't been loaded yet, so load it now.
          $className = $this->data[$name][2];
          if (!class_exists($className)) {
            throw new Exceptions\EntityCorruptedException(
                "Entity reference refers to a class that can't be found, ".
                "$className."
            );
          }
          $this->entityCache[$name] =
              $className::factoryReference($this->data[$name]);
          $this->entityCache[$name]->useSkipAc($this->useSkipAc);
        }
        return $this->entityCache[$name];
      } else {
        throw new Exceptions\EntityCorruptedException(
            "Entity data has become corrupt and cannot be determined."
        );
      }
    }
    // Check if it's set.
    if (!isset($this->data[$name])) {
      // Since we must return by reference, we have to use a constant here. If
      // we return $this->data[$name], an entry will be created in data.
      return $this->NULL_CONST;
    }
    // If it's not an entity, return the regular value.
    try {
      if (is_array($this->data[$name])) {
        // But, if it's an array, check all the values for entity references,
        // and change them.
        array_walk($this->data[$name], [$this, 'referenceToEntity']);
      } elseif (is_object($this->data[$name])
                && !(
                  (
                    is_a($this->data[$name], '\Nymph\Entity')
                    || is_a($this->data[$name], '\SciActive\HookOverride')
                  )
                  && is_callable([$this->data[$name], 'toReference'])
                )) {
        // Only do this for non-entity objects.
        foreach ($this->data[$name] as &$curProperty) {
          $this->referenceToEntity($curProperty, null);
        }
        unset($curProperty);
      }
    } catch (Exceptions\EntityClassNotFoundException $e) {
      throw new Exceptions\EntityCorruptedException($e->getMessage());
    }
    return $this->data[$name];
  }
public function &__get($name) {
    if ($name === 'guid') {
      return $this->$name;
    }
    if ($this->isASleepingReference) {
      $this->referenceWake();
    }
    if ($name === 'cdate'
        || $name === 'mdate'
        || $name === 'tags'
      ) {
      return $this->$name;
    }
    // Unserialize.
    if (isset($this->sdata[$name])) {
      $this->data[$name] = unserialize($this->sdata[$name]);
      unset($this->sdata[$name]);
    }
    // Check for an entity first.
    if (isset($this->entityCache[$name])) {
      if ($this->data[$name][0] === 'nymph_entity_reference') {
        if ($this->entityCache[$name] === 0) {
          // The entity hasn't been loaded yet, so load it now.
          $className = $this->data[$name][2];
          if (!class_exists($className)) {
            throw new Exceptions\EntityCorruptedException(
                "Entity reference refers to a class that can't be found, ".
                "$className."
            );
          }
          $this->entityCache[$name] =
              $className::factoryReference($this->data[$name]);
          $this->entityCache[$name]->useSkipAc($this->useSkipAc);
        }
        return $this->entityCache[$name];
      } else {
        throw new Exceptions\EntityCorruptedException(
            "Entity data has become corrupt and cannot be determined."
        );
      }
    }
    // Check if it's set.
    if (!isset($this->data[$name])) {
      // Since we must return by reference, we have to use a constant here. If
      // we return $this->data[$name], an entry will be created in data.
      return $this->NULL_CONST;
    }
    // If it's not an entity, return the regular value.
    try {
      if (is_array($this->data[$name])) {
        // But, if it's an array, check all the values for entity references,
        // and change them.
        array_walk($this->data[$name], [$this, 'referenceToEntity']);
      } elseif (is_object($this->data[$name])
                && !(
                  (
                    is_a($this->data[$name], '\Nymph\Entity')
                    || is_a($this->data[$name], '\SciActive\HookOverride')
                  )
                  && is_callable([$this->data[$name], 'toReference'])
                )) {
        // Only do this for non-entity objects.
        foreach ($this->data[$name] as &$curProperty) {
          $this->referenceToEntity($curProperty, null);
        }
        unset($curProperty);
      }
    } catch (Exceptions\EntityClassNotFoundException $e) {
      throw new Exceptions\EntityCorruptedException($e->getMessage());
    }
    return $this->data[$name];
  }
public function & __get ( $ name ) { if ( $ name === 'guid' ) { return $ this -> $ name ; } if ( $ this -> isASleepingReference ) { $ this -> referenceWake ( ) ; } if ( $ name === 'cdate' || $ name === 'mdate' || $ name === 'tags' ) { return $ this -> $ name ; } // Unserialize. if ( isset ( $ this -> sdata [ $ name ] ) ) { $ this -> data [ $ name ] = unserialize ( $ this -> sdata [ $ name ] ) ; unset ( $ this -> sdata [ $ name ] ) ; } // Check for an entity first. if ( isset ( $ this -> entityCache [ $ name ] ) ) { if ( $ this -> data [ $ name ] [ 0 ] === 'nymph_entity_reference' ) { if ( $ this -> entityCache [ $ name ] === 0 ) { // The entity hasn't been loaded yet, so load it now. $ className = $ this -> data [ $ name ] [ 2 ] ; if ( ! class_exists ( $ className ) ) { throw new Exceptions \ EntityCorruptedException ( "Entity reference refers to a class that can't be found, " . "$className." ) ; } $ this -> entityCache [ $ name ] = $ className :: factoryReference ( $ this -> data [ $ name ] ) ; $ this -> entityCache [ $ name ] -> useSkipAc ( $ this -> useSkipAc ) ; } return $ this -> entityCache [ $ name ] ; } else { throw new Exceptions \ EntityCorruptedException ( "Entity data has become corrupt and cannot be determined." ) ; } } // Check if it's set. if ( ! isset ( $ this -> data [ $ name ] ) ) { // Since we must return by reference, we have to use a constant here. If // we return $this->data[$name], an entry will be created in data. return $ this -> NULL_CONST ; } // If it's not an entity, return the regular value. try { if ( is_array ( $ this -> data [ $ name ] ) ) { // But, if it's an array, check all the values for entity references, // and change them. array_walk ( $ this -> data [ $ name ] , [ $ this , 'referenceToEntity' ] ) ; } elseif ( is_object ( $ this -> data [ $ name ] ) && ! ( ( is_a ( $ this -> data [ $ name ] , '\Nymph\Entity' ) || is_a ( $ this -> data [ $ name ] , '\SciActive\HookOverride' ) ) && is_callable ( [ $ this -> data [ $ name ] , 'toReference' ] ) ) ) { // Only do this for non-entity objects. foreach ( $ this -> data [ $ name ] as & $ curProperty ) { $ this -> referenceToEntity ( $ curProperty , null ) ; } unset ( $ curProperty ) ; } } catch ( Exceptions \ EntityClassNotFoundException $ e ) { throw new Exceptions \ EntityCorruptedException ( $ e -> getMessage ( ) ) ; } return $ this -> data [ $ name ] ; }
Retrieve a variable.

You do not need to explicitly call this method. It is called by PHP when
you access the variable normally.

@param string $name The name of the variable.
@return mixed The value of the variable or null if it doesn't exist.
Retrieve a variable .