Skip to content

Navigation Menu

Sign in
Appearance settings

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 07d90f9

Browse filesBrowse files
committed
Move doctrine/collections to an optional dep in doctrine-bridge
The EntityType does not need to convert the array to a collection if the project does not care about using doctrine/collections. So this can become an optional dependency.
1 parent ede6660 commit 07d90f9
Copy full SHA for 07d90f9

File tree

Expand file treeCollapse file tree

2 files changed

+3
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-2
lines changed

‎src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Form\Type;
1313

14+
use Doctrine\Common\Collections\Collection;
1415
use Doctrine\Common\Persistence\ManagerRegistry;
1516
use Doctrine\Common\Persistence\ObjectManager;
1617
use Symfony\Bridge\Doctrine\Form\ChoiceList\DoctrineChoiceLoader;
@@ -107,7 +108,7 @@ public function __construct(ManagerRegistry $registry)
107108

108109
public function buildForm(FormBuilderInterface $builder, array $options)
109110
{
110-
if ($options['multiple']) {
111+
if ($options['multiple'] && interface_exists(Collection::class)) {
111112
$builder
112113
->addEventSubscriber(new MergeDoctrineCollectionListener())
113114
->addViewTransformer(new CollectionToArrayTransformer(), true)

‎src/Symfony/Bridge/Doctrine/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/composer.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
],
1818
"require": {
1919
"php": "^7.1.3",
20-
"doctrine/collections": "~1.0",
2120
"doctrine/event-manager": "~1.0",
2221
"doctrine/persistence": "~1.0",
2322
"symfony/contracts": "^1.0",
@@ -39,6 +38,7 @@
3938
"symfony/translation": "~3.4|~4.0",
4039
"doctrine/annotations": "~1.0",
4140
"doctrine/cache": "~1.6",
41+
"doctrine/collections": "~1.0",
4242
"doctrine/data-fixtures": "1.0.*",
4343
"doctrine/dbal": "~2.4",
4444
"doctrine/orm": "^2.4.5",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.