You are here

private function PersistentObject::get in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php \Doctrine\Common\Persistence\PersistentObject::get()

Gets a persistent field value.

Parameters

string $field:

Return value

mixed

Throws

\BadMethodCallException When no persistent field exists by that name.

1 call to PersistentObject::get()
PersistentObject::__call in vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php
Magic methods.

File

vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php, line 147

Class

PersistentObject
PersistentObject base class that implements getter/setter methods for all mapped fields and associations by overriding __call.

Namespace

Doctrine\Common\Persistence

Code

private function get($field) {
  $this
    ->initializeDoctrine();
  if ($this->cm
    ->hasField($field) || $this->cm
    ->hasAssociation($field)) {
    return $this->{$field};
  }
  else {
    throw new \BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm
      ->getName() . "'");
  }
}