Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ba78b7b

Browse files
committed
[DoctrineBridge] remove deprecated features
1 parent 31f74ca commit ba78b7b

File tree

7 files changed

+2
-233
lines changed

7 files changed

+2
-233
lines changed

src/Symfony/Bridge/Doctrine/ExpressionLanguage/DoctrineParserCache.php

Lines changed: 0 additions & 56 deletions
This file was deleted.

src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,8 @@ class DoctrineChoiceLoader implements ChoiceLoaderInterface
6565
* @param ChoiceListFactoryInterface $factory The factory for creating
6666
* the loaded choice list
6767
*/
68-
public function __construct($manager, $class, $idReader = null, $objectLoader = null, $factory = null)
68+
public function __construct(ObjectManager $manager, $class, $idReader = null, $objectLoader = null, $factory = null)
6969
{
70-
// BC to be removed and replace with type hints in 4.0
71-
if ($manager instanceof ChoiceListFactoryInterface) {
72-
@trigger_error(sprintf('Passing a ChoiceListFactoryInterface to %s is deprecated since version 3.1 and will no longer be supported in 4.0. You should either call "%s::loadChoiceList" or override it to return a ChoiceListInterface.', __CLASS__, __CLASS__), E_USER_DEPRECATED);
73-
74-
// Provide a BC layer since $factory has changed
75-
// form first to last argument as of 3.1
76-
$manager = $class;
77-
$class = $idReader;
78-
$idReader = $objectLoader;
79-
$objectLoader = $factory;
80-
}
81-
8270
$classMetadata = $manager->getClassMetadata($class);
8371

8472
$this->manager = $manager;

src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -27,34 +27,19 @@
2727
*/
2828
class MergeDoctrineCollectionListener implements EventSubscriberInterface
2929
{
30-
// Keep BC. To be removed in 4.0
31-
private $bc = true;
32-
private $bcLayer = false;
33-
3430
public static function getSubscribedEvents()
3531
{
3632
// Higher priority than core MergeCollectionListener so that this one
3733
// is called before
3834
return array(
3935
FormEvents::SUBMIT => array(
40-
array('onBind', 10), // deprecated
4136
array('onSubmit', 5),
4237
),
4338
);
4439
}
4540

4641
public function onSubmit(FormEvent $event)
4742
{
48-
if ($this->bc) {
49-
// onBind() has been overridden from a child class
50-
@trigger_error('The onBind() method is deprecated since version 3.1 and will be removed in 4.0. Use the onSubmit() method instead.', E_USER_DEPRECATED);
51-
52-
if (!$this->bcLayer) {
53-
// If parent::onBind() has not been called, then logic has been executed
54-
return;
55-
}
56-
}
57-
5843
$collection = $event->getForm()->getData();
5944
$data = $event->getData();
6045

@@ -64,20 +49,4 @@ public function onSubmit(FormEvent $event)
6449
$collection->clear();
6550
}
6651
}
67-
68-
/**
69-
* Alias of {@link onSubmit()}.
70-
*
71-
* @deprecated since version 3.1, to be removed in 4.0.
72-
* Use {@link onSubmit()} instead.
73-
*/
74-
public function onBind(FormEvent $event)
75-
{
76-
if (__CLASS__ === get_class($this)) {
77-
$this->bc = false;
78-
} else {
79-
// parent::onBind() has been called
80-
$this->bcLayer = true;
81-
}
82-
}
8352
}

src/Symfony/Bridge/Doctrine/ManagerRegistry.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@ protected function resetService($name)
4545
$manager = $this->container->get($name);
4646

4747
if (!$manager instanceof LazyLoadingInterface) {
48-
@trigger_error(sprintf('Resetting a non-lazy manager service is deprecated since Symfony 3.2 and will throw an exception in version 4.0. Set the "%s" service as lazy and require "symfony/proxy-manager-bridge" in your composer.json file instead.', $name), E_USER_DEPRECATED);
49-
50-
$this->container->set($name, null);
51-
52-
return;
48+
throw new \LogicException(sprintf('Resetting a non-lazy manager service is not supported. Set the "%s" service as lazy and require "symfony/proxy-manager-bridge" in your composer.json file instead.', $name));
5349
}
5450
$manager->setProxyInitializer(\Closure::bind(
5551
function (&$wrappedInstance, LazyLoadingInterface $manager) use ($name) {

src/Symfony/Bridge/Doctrine/Tests/ExpressionLanguage/DoctrineParserCacheTest.php

Lines changed: 0 additions & 64 deletions
This file was deleted.

src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -113,37 +113,6 @@ public function testLoadChoiceList()
113113
$this->assertEquals($choiceList, $loader->loadChoiceList($value));
114114
}
115115

116-
/**
117-
* @group legacy
118-
*/
119-
public function testLegacyLoadChoiceList()
120-
{
121-
$factory = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface')->getMock();
122-
$loader = new DoctrineChoiceLoader(
123-
$factory,
124-
$this->om,
125-
$this->class,
126-
$this->idReader
127-
);
128-
129-
$choices = array($this->obj1, $this->obj2, $this->obj3);
130-
$value = function () {};
131-
$choiceList = new ArrayChoiceList($choices, $value);
132-
133-
$this->repository->expects($this->once())
134-
->method('findAll')
135-
->willReturn($choices);
136-
137-
$factory->expects($this->never())
138-
->method('createListFromChoices');
139-
140-
$this->assertEquals($choiceList, $loaded = $loader->loadChoiceList($value));
141-
142-
// no further loads on subsequent calls
143-
144-
$this->assertSame($loaded, $loader->loadChoiceList($value));
145-
}
146-
147116
public function testLoadChoiceListUsesObjectLoaderIfAvailable()
148117
{
149118
$loader = new DoctrineChoiceLoader(

src/Symfony/Bridge/Doctrine/Tests/Form/EventListener/MergeDoctrineCollectionListenerTest.php

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -78,37 +78,4 @@ public function testOnSubmitNullClearCollection()
7878

7979
$this->assertTrue($this->collection->isEmpty());
8080
}
81-
82-
/**
83-
* @group legacy
84-
*/
85-
public function testLegacyChildClassOnSubmitCallParent()
86-
{
87-
$form = $this->getBuilder('name')
88-
->setData($this->collection)
89-
->addEventSubscriber(new TestClassExtendingMergeDoctrineCollectionListener())
90-
->getForm();
91-
$submittedData = array();
92-
$event = new FormEvent($form, $submittedData);
93-
94-
$this->dispatcher->dispatch(FormEvents::SUBMIT, $event);
95-
96-
$this->assertTrue($this->collection->isEmpty());
97-
$this->assertTrue(TestClassExtendingMergeDoctrineCollectionListener::$onBindCalled);
98-
}
99-
}
100-
101-
/**
102-
* @group legacy
103-
*/
104-
class TestClassExtendingMergeDoctrineCollectionListener extends MergeDoctrineCollectionListener
105-
{
106-
public static $onBindCalled = false;
107-
108-
public function onBind(FormEvent $event)
109-
{
110-
self::$onBindCalled = true;
111-
112-
parent::onBind($event);
113-
}
11481
}

0 commit comments

Comments
 (0)