Merge remote branch 'brikou/form' into form
This commit is contained in:
commit
4905bfd285
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user