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 f3a0555

Browse filesBrowse files
committed
minor #30924 Move doctrine/collections to an optional dep in doctrine-bridge (stof)
This PR was merged into the 4.3-dev branch. Discussion ---------- Move doctrine/collections to an optional dep in doctrine-bridge | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | 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. The goal here is to reduce the dependencies of DoctrineBundle when using it in DBAL-only mode. doctrine/persistence still brings a bunch of unwanted dependencies for a DBAL-only project, but this requires work on the Doctrine side (we discussed it with @alcaeus) as the ConnectionRegistry is part of it. Moving it to an optional dependency in the bridge will probably come in 6 months instead. And doctrine-cache-bundle also brings some, but that's already in the work of being removed from DoctrineBundle 2.0. Commits ------- 07d90f9 Move doctrine/collections to an optional dep in doctrine-bridge
2 parents f551f2d + 07d90f9 commit f3a0555
Copy full SHA for f3a0555

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.