8000 [Serializer] Remove deprecated DoctrineCache support · symfony/symfony@f6af75a · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f6af75a

Browse files
committed
[Serializer] Remove deprecated DoctrineCache support
1 parent 15b7cdb commit f6af75a

File tree

2 files changed

+1
-51
lines changed

2 files changed

+1
-51
lines changed

src/Symfony/Component/Serializer/Mapping/Factory/ClassMetadataFactory.php

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,17 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
3030
*/
3131
private $loader;
3232

33-
/**
34-
* @var Cache
35-
*/
36-
private $cache;
37-
3833
/**
3934
* @var array
4035
*/
4136
private $loadedClasses;
4237

4338
/**
4439
* @param LoaderInterface $loader
45-
* @param Cache|null $cache
4640
*/
47-
public function __construct(LoaderInterface $loader, Cache $cache = null)
41+
public function __construct(LoaderInterface $loader)
4842
{
4943
$this->loader = $loader;
50-
$this->cache = $cache;
51-
52-
if (null !== $cache) {
53-
@trigger_error(sprintf('Passing a Doctrine Cache instance as 2nd parameter of the "%s" constructor is deprecated since version 3.1. This parameter will be removed in Symfony 4.0. Use the "%s" class instead.', __CLASS__, CacheClassMetadataFactory::class), E_USER_DEPRECATED);
54-
}
5544
}
5645

5746
/**
@@ -65,10 +54,6 @@ public function getMetadataFor($value)
6554
return $this->loadedClasses[$class];
6655
}
6756

68-
if ($this->cache && ($this->loadedClasses[$class] = $this->cache->fetch($class))) {
69-
return $this->loadedClasses[$class];
70-
}
71-
7257
$classMetadata = new ClassMetadata($class);
7358
$this->loader->loadClassMetadata($classMetadata);
7459

@@ -84,10 +69,6 @@ public function getMetadataFor($value)
8469
$classMetadata->merge($this->getMetadataFor($interface->name));
8570
}
8671

87-
if ($this->cache) {
88-
$this->cache->save($class, $classMetadata);
89-
}
90-
9172
return $this->loadedClasses[$class] = $classMetadata;
9273
}
9374

src/Symfony/Component/Serializer/Tests/Mapping/Factory/ClassMetadataFactoryTest.php

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -45,35 +45,4 @@ public function testHasMetadataFor()
4545
$this->assertTrue($factory->hasMetadataFor('Symfony\Component\Serializer\Tests\Fixtures\GroupDummyInterface'));
4646
$this->assertFalse($factory->hasMetadataFor('Dunglas\Entity'));
4747
}
48-
49-
/**
50-
* @group legacy
51-
*/
52-
public function testCacheExists()
53-
{
54-
$cache = $this->getMockBuilder('Doctrine\Common\Cache\Cache')->getMock();
55-
$cache
56-
->expects($this->once())
57-
->method('fetch')
58-
->will($this->returnValue('foo'))
59-
;
60-
61-
$factory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()), $cache);
62-
$this->assertEquals('foo', $factory->getMetadataFor('Symfony\Component\Serializer\Tests\Fixtures\GroupDummy'));
63-
}
64-
65-
/**
66-
* @group legacy
67-
*/
68-
public function testCacheNotExists()
69-
{
70-
$cache = $this->getMockBuilder('Doctrine\Common\Cache\Cache')->getMock();
71-
$cache->method('fetch')->will($this->returnValue(false));
72-
$cache->method('save');
73-
74-
$factory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()), $cache);
75-
$metadata = $factory->getMetadataFor('Symfony\Component\Serializer\Tests\Fixtures\GroupDummy');
76-
77-
$this->assertEquals(TestClassMetadataFactory::createClassMetadata(true, true), $metadata);
78-
}
7948
}

0 commit comments

Comments
 (0)
0