Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@
<tag name="kernel.cache_warmer" />
</service>

<service id="validator.mapping.cache.symfony" class="Symfony\Component\Validator\Mapping\Cache\Psr6Cache">
<argument type="service" id="validator.mapping.cache.adapter" />
<deprecated>The "%service_id%" service is deprecated since Symfony 4.4. Use validator.mapping.cache.adapter instead.</deprecated>
</service>

<service id="validator.mapping.cache.adapter" class="Symfony\Component\Cache\Adapter\PhpArrayAdapter">
<factory class="Symfony\Component\Cache\Adapter\PhpArrayAdapter" method="create" />
<argument>%validator.mapping.cache.file%</argument>
Expand Down
45 changes: 0 additions & 45 deletions src/Symfony/Component/Validator/Mapping/Cache/CacheInterface.php

This file was deleted.

63 changes: 0 additions & 63 deletions src/Symfony/Component/Validator/Mapping/Cache/DoctrineCache.php

This file was deleted.

80 changes: 0 additions & 80 deletions src/Symfony/Component/Validator/Mapping/Cache/Psr6Cache.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Validator\Exception\NoSuchMetadataException;
use Symfony\Component\Validator\Mapping\Cache\CacheInterface;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Mapping\Loader\LoaderInterface;

Expand Down Expand Up @@ -49,20 +48,8 @@ class LazyLoadingMetadataFactory implements MetadataFactoryInterface
*/
protected $loadedClasses = [];

/**
* Creates a new metadata factory.
*
* @param CacheItemPoolInterface|null $cache The cache for persisting metadata
* between multiple PHP requests
*/
public function __construct(LoaderInterface $loader = null, $cache = null)
public function __construct(LoaderInterface $loader = null, CacheItemPoolInterface $cache = null)
{
if ($cache instanceof CacheInterface) {
@trigger_error(sprintf('Passing a "%s" to "%s" is deprecated in Symfony 4.4 and will trigger a TypeError in 5.0. Please pass an implementation of "%s" instead.', \get_class($cache), __METHOD__, CacheItemPoolInterface::class), E_USER_DEPRECATED);
} elseif (!$cache instanceof CacheItemPoolInterface && null !== $cache) {
throw new \TypeError(sprintf('Expected an instance of %s, got %s.', CacheItemPoolInterface::class, \is_object($cache) ? \get_class($cache) : \gettype($cache)));
}

$this->loader = $loader;
$this->cache = $cache;
}
Expand Down Expand Up @@ -98,24 +85,14 @@ public function getMetadataFor($value)
throw new NoSuchMetadataException(sprintf('The class or interface "%s" does not exist.', $class));
}

$cacheItem = null;
if ($this->cache instanceof CacheInterface) {
if ($metadata = $this->cache->read($class)) {
// Include constraints from the parent class
$this->mergeConstraints($metadata);

return $this->loadedClasses[$class] = $metadata;
}
} elseif (null !== $this->cache) {
$cacheItem = $this->cache->getItem($this->escapeClassName($class));
if ($cacheItem->isHit()) {
$metadata = $cacheItem->get();
$cacheItem = null === $this->cache ? null : $this->cache->getItem($this->escapeClassName($class));
if ($cacheItem && $cacheItem->isHit()) {
$metadata = $cacheItem->get();

// Include constraints from the parent class
$this->mergeConstraints($metadata);
// Include constraints from the parent class
$this->mergeConstraints($metadata);

return $this->loadedClasses[$class] = $metadata;
}
return $this->loadedClasses[$class] = $metadata;
}

$metadata = new ClassMetadata($class);
Expand All @@ -124,9 +101,7 @@ public function getMetadataFor($value)
$this->loader->loadClassMetadata($metadata);
}

if ($this->cache instanceof CacheInterface) {
$this->cache->write($metadata);
} elseif (null !== $cacheItem) {
if (null !== $cacheItem) {
$this->cache->save($cacheItem->set($metadata));
}

Expand Down

This file was deleted.

This file was deleted.

Loading