Skip to content

Commit

Permalink
Merge pull request #252 from schmittjoh/FORM
Browse files Browse the repository at this point in the history
Fix form types support
  • Loading branch information
GuilhemN committed Apr 18, 2016
2 parents 195467e + b9e7a32 commit 27c3fc7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Metadata/Driver/AnnotationDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function loadMetadataForClass(\ReflectionClass $class)
// try to extract it from the class itself
if (null === $alias) {
$instance = unserialize(sprintf('O:%d:"%s":0:{}', strlen($className), $className));
$alias = $instance->getName();
$alias = method_exists($instance, 'getBlockPrefix') ? $instance->getBlockPrefix() : $instance->getName();
}

$metadata->tags['form.type'][] = array(
Expand Down
5 changes: 5 additions & 0 deletions Tests/Metadata/Driver/Fixture/LoginType.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ public function __construct(SecurityContext $context)
}

public function getName()
{
return $this->getBlockPrefix();
}

public function getBlockPrefix()
{
return 'login';
}
Expand Down
5 changes: 5 additions & 0 deletions Tests/Metadata/Driver/Fixture/SignUpType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
class SignUpType extends AbstractType
{
public function getName()
{
return $this->getBlockPrefix();
}

public function getBlockPrefix()
{
return 'sign_up';
}
Expand Down

0 comments on commit 27c3fc7

Please sign in to comment.