Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing doctrine/common requirement ? #517

Closed
MelvinLoos opened this issue Nov 4, 2015 · 2 comments
Closed

Missing doctrine/common requirement ? #517

MelvinLoos opened this issue Nov 4, 2015 · 2 comments

Comments

@MelvinLoos
Copy link

I might be missing something so correct me if I am wrong but I found the following issue:
serializer/src/JMS/Serializer/Handler/ArrayCollectionHandler.php contains a use statement,

use Doctrine\Common\Collections\ArrayCollection;

however the Doctrine\Common library is not included in the composer.json file requirements so this results in a class not found message.

This is for a production environment installed by composer install --no-dev, the development does not have this problem as it is apparently installed through one of the dev dependencies:

>> composer depends doctrine/common
doctrine/dbal requires doctrine/common (>=2.3.0,<2.5-dev)
doctrine/phpcr-odm requires doctrine/common (~2.4.0)

Include doctrine/common as requirement?

@goetas
Copy link
Collaborator

goetas commented Aug 3, 2016

Doctrine is an optional requirement, so if you want to use ArrayCollection you have to include it by your self.

A similar case to use as example is the symfony dependency componenent. that uses the YAML dumper
https://github.com/symfony/dependency-injection/blob/master/Dumper/YamlDumper.php#L14 but the component it self is not part of requirements as is visible in https://github.com/symfony/dependency-injection/blob/master/composer.json#L18

@MelvinLoos
Copy link
Author

I don't totally agree on the reason of use being the same in the case you provide. In the case of the symfony dependency component the YamlDumper class is purely used for development/testing (like the var_dump function) therefore justifying the dev requirement of said repository . Maybe @fabpot can even confirm this.
In the case of JMS this might be an optional component but even so it is enable by default through the builder at SerializerBuilder::addDefaultHandlers ([https://github.com/schmittjoh/serializer/blob/master/src/JMS/Serializer/SerializerBuilder.php]). And if it were optional wouldn't it be handier to add it to the "suggest" section of composer.json? Because now you will not find the missing dependency until you run composer without dev requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants