symfony/symfony — pull request #5309 by Bogdanp (2012-08-21 16:24:19+00:00)
Title: Add magic getter method support to Entities

When using Symfony Forms, it permits the implementation of magic getter methods in those Entities by using the `__call` magic method.

It basically allows one to do the following in an Entity:

public function __call($method, $arguments) {
if (preg_match('/^(get|is|has)([A-Z].*)$/', $method, $matches)) {
return $this->{lcfirst($matches[2])};
}
throw new \Exception(sprintf(
'Method does not exist for class "%s".', get_class($this)
));
}