You are here

public function ExecutionContext::getMetadataFactory in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/validator/ExecutionContext.php \Symfony\Component\Validator\ExecutionContext::getMetadataFactory()
  2. 8 vendor/symfony/validator/Context/ExecutionContext.php \Symfony\Component\Validator\Context\ExecutionContext::getMetadataFactory()
  3. 8 core/lib/Drupal/Core/TypedData/Validation/ExecutionContext.php \Drupal\Core\TypedData\Validation\ExecutionContext::getMetadataFactory()
Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Context/ExecutionContext.php \Symfony\Component\Validator\Context\ExecutionContext::getMetadataFactory()

Returns the used metadata factory.

Return value

MetadataFactoryInterface The metadata factory.

Overrides ExecutionContextInterface::getMetadataFactory

Deprecated

since version 2.5, to be removed in 3.0. Use {@link Context\ExecutionContextInterface::getValidator()} instead and call {@link Validator\ValidatorInterface::getMetadataFor()} or {@link Validator\ValidatorInterface::hasMetadataFor()} there.

File

vendor/symfony/validator/Context/ExecutionContext.php, line 399

Class

ExecutionContext
The context used and created by {@link ExecutionContextFactory}.

Namespace

Symfony\Component\Validator\Context

Code

public function getMetadataFactory() {
  @trigger_error('The ' . __METHOD__ . ' is deprecated since version 2.5 and will be removed in 3.0. Use the new Symfony\\Component\\Validator\\Context\\ExecutionContext::getValidator method in combination with Symfony\\Component\\Validator\\Validator\\ValidatorInterface::getMetadataFor or Symfony\\Component\\Validator\\Validator\\ValidatorInterface::hasMetadataFor method instead.', E_USER_DEPRECATED);
  $validator = $this
    ->getValidator();
  if ($validator instanceof LegacyValidatorInterface) {
    return $validator
      ->getMetadataFactory();
  }

  // The ValidatorInterface extends from the deprecated MetadataFactoryInterface, so return it when we don't have the factory instance itself
  return $validator;
}