public function PersistentObject::__call

Magic method that implements

Parameters

string $method:

array $args:

Return value

mixed

Throws

\BadMethodCallException

File

drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php, line 230

Class

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

Namespace

Doctrine\Common\Persistence

Code

public function __call($method, $args) {
  $command = substr($method, 0, 3);
  $field = lcfirst(substr($method, 3));
  if ($command == "set") {
    $this
      ->set($field, $args);
  }
  else {
    if ($command == "get") {
      return $this
        ->get($field);
    }
    else {
      if ($command == "add") {
        $this
          ->add($field, $args);
      }
      else {
        throw new \BadMethodCallException("There is no method " . $method . " on " . $this->cm
          ->getName());
      }
    }
  }
}