merged branch francoispluchino/form-fix-deprecated-method (PR #6455)

This PR was merged into the master branch.

Commits
-------

16a196a [Form] Fix deprecated call method

Discussion
----------

[Form] Fix deprecated call method

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: -
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: -

---------------------------------------------------------------------------

by stof at 2012-12-21T13:21:50Z

This is wrong as the typehint of the constructor is still typehinting the old interface, and so this method is not available.

But the typehint should be changed to use the new interface anyway

---------------------------------------------------------------------------

by francoispluchino at 2012-12-26T09:11:49Z

@fabpot It's OK for you?
(The failure of the Travis test is caused  by the DateTime Form test only in PHP 5.3.3)

---------------------------------------------------------------------------

by bschussek at 2012-12-28T15:00:51Z

Can you please squash the commits?

---------------------------------------------------------------------------

by francoispluchino at 2012-12-28T15:57:47Z

@bschussek OK, it's done.
This commit is contained in:
Fabien Potencier 2012-12-28 23:56:58 +01:00
commit 87591482a9

View File

@ -15,14 +15,14 @@ use Symfony\Component\Form\FormTypeGuesserInterface;
use Symfony\Component\Form\Guess\Guess;
use Symfony\Component\Form\Guess\TypeGuess;
use Symfony\Component\Form\Guess\ValueGuess;
use Symfony\Component\Validator\Mapping\ClassMetadataFactoryInterface;
use Symfony\Component\Validator\MetadataFactoryInterface;
use Symfony\Component\Validator\Constraint;
class ValidatorTypeGuesser implements FormTypeGuesserInterface
{
private $metadataFactory;
public function __construct(ClassMetadataFactoryInterface $metadataFactory)
public function __construct(MetadataFactoryInterface $metadataFactory)
{
$this->metadataFactory = $metadataFactory;
}
@ -269,7 +269,7 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
protected function guess($class, $property, \Closure $closure, $defaultValue = null)
{
$guesses = array();
$classMetadata = $this->metadataFactory->getClassMetadata($class);
$classMetadata = $this->metadataFactory->getMetadataFor($class);
if ($classMetadata->hasMemberMetadatas($property)) {
$memberMetadatas = $classMetadata->getMemberMetadatas($property);
@ -291,4 +291,4 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
return Guess::getBestGuess($guesses);
}
}
}