Merge remote branch 'brikou/form' into form

This commit is contained in:
Bernhard Schussek 2011-04-17 18:01:17 +02:00
commit 4905bfd285
2 changed files with 7 additions and 7 deletions

View File

@ -46,11 +46,7 @@ class FormFactory implements FormFactoryInterface
// TESTME
if (null === $name) {
$typeAsString = is_object($type) ? get_class($type) : $type;
if (preg_match('/\w+$/', $typeAsString, $matches)) {
$name = $matches[0];
}
$name = is_object($type) ? $type->getName() : $type;
}
while (null !== $type) {

View File

@ -47,6 +47,10 @@ abstract class AbstractType implements FormTypeInterface
public function getName()
{
return get_class($this);
if (preg_match('/\\\\([a-z]+)(?:Form|Type)$/im', get_class($this), $matches)) {
$name = strtolower($matches[1]);
}
return $name;
}
}
}