symfony / orm-pack Goto Github PK
View Code? Open in Web Editor NEWA Symfony Pack for Doctrine ORM
License: MIT License
A Symfony Pack for Doctrine ORM
License: MIT License
https://github.com/doctrine/doctrine2
refer to the 2.6 branch for the current stable
doctrine/doctrine-migrations-bundle 2.1.2 => 3.0.1
doctrine/migrations 2.2.1 => 3.0.1
the composer update breaks lots of things that depend on those packages
In my microservice project, we have so many problems with this fix. This package update by minor version from 1.0.6 to 1.0.7 and doctrine upgrade to from 1 to 2 version, and we have an error exception.
Please use semantic versioning(https://semver.org/)
I already configured my project to use doctrine/migrations v3.
When I ran composer update recently it downgraded the bundle to v2.2.1:
Downgrading doctrine/migrations (3.0.1 => 2.2.1): Loading from cache
Downgrading doctrine/doctrine-migrations-bundle (3.0.1 => 2.1.2)
It breaks my project's configuration and can't even manually set the package back to v3 because this package restricts it.
Please advise.
Hi,
I installed a fresh symfony/skeleton:"6.4.*" project for an api app, then I required symfony/orm-pack and set the database in .env file as sqlite:
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
On executing the command console doctrine:database:create it throws the error:
Could not create database /home/user/skeleton-api/var/data.db for connection named default Operation "Doctrine\DBAL\Platforms\SQLitePlatform::getCreateDatabaseSQL" is not supported by platform.
After a lot of test and research I found that the doctrine/orm requires the doctrine/dbal version 4.0.0 and it seems nowadays it may be on development state without sqlite support or something similar, in fact at the doctrine website says that this version is not released yet.
Well, to solve this I made the following steps:
After that the console doctrine:database:create runs well with no error and the database is created.
I don't know whether I will have more problems from here, but I liked to share my experience if any one has the same issue.
Also, it will be good if someone can modify the doctrine/orm dependencies to <4.0 version of doctrine/dbal while it is not stable version with sqlite support, it will be fully appreciate.
Thanks for your work.
Avinsol.
This issue is to trigger a discussion after #16 bumped the doctrine/doctrine-bundle
dependency from ^1.6.10
to 1.6.10|^2.0
. This was released in 1.0.7 and causes some problems for people (also see #17).
DoctrineBundle 1.12 adds a deprecation layer to allow for an easier upgrade path, similar to the one from Symfony 4.4 -> 5.0. However, since this dependency change was hidden in a patch release, many people went from 1.11 directly to 2.0, which breaks their applications hard in some cases.
A similar thing happened with 1.0.6, where an equivalent change to the doctrine/doctrine-migrations-bundle
dependency caused BC breaks for people (see #15).
As a result of this, I would like to trigger a discussion on how to version packs to better allow people to control their dependency versions without having to unpack a pack.
I believe that the strategy above would help reduce the pain of upgrading packages in a pack, albeit at a slightly higher maintenance cost (which could be taken care of with tooling). What do you think @nicolas-grekas @fabpot?
It seems I cannot install symfony/orm-pack over a freshly created 5.4 / LTS project :
symfony new miniallocine --version=lts
* Creating a new Symfony 5.4 project with Composer
WARNING: Unable to find Composer, downloading one. It is recommended to install Composer yourself at https://getcomposer.org/download/
(running .../composer.phar create-project symfony/skeleton .../miniallocine 5.4.* --no-interaction)
* Setting up the project under Git version control
(running git init .../miniallocine)
[OK] Your project is now ready in .../miniallocine
cd miniallocine/
symfony composer require symfony/orm-pack
Using version ^2.3 for symfony/orm-pack
./composer.json has been updated
Running composer update symfony/orm-pack
Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "5.4.*"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- symfony/framework-bundle is locked to version v5.4.12 and an update of this package was not requested.
- symfony/orm-pack v2.3.0 conflicts with symfony/dependency-injection <6.2.
- symfony/framework-bundle v5.4.12 requires symfony/dependency-injection ^5.4.5|^6.0.5 -> satisfiable by symfony/dependency-injection[v5.4.11].
- Root composer.json requires symfony/orm-pack ^2.3 -> satisfiable by symfony/orm-pack[v2.3.0].
You can also try re-running composer require with an explicit version constraint, e.g. "composer require symfony/orm-pack:*" to figure out if any version is installable, or "composer require symfony/orm-pack:^2.1" if you know which you need.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
unable to run /home/olivier/.symfony5/composer/composer.phar require symfony/orm-pack
There is breaking change between versions v1.0.5 and v1.0.6 in doctrine/doctrine-migrations-bundle
.
v1.0.5 requires doctrine/doctrine-migrations-bundle: ^1.3
, but
v1.0.6 requires doctrine/doctrine-migrations-bundle: ^1.3|^2.0
.
That means anyone who has version constraint symfony/orm-pack ^1.0
(anyone who installed orm pack using composer require symfony/orm-pack
) will after update get breaking changes from doctrine migrations.
I think that version of this pack should reflect major version changes in it's requires.
Can we add doctrine/doctrine-fixtures-bundle also?
It gives warning when i create new project and install the orm package.
Package zendframework/zend-eventmanager is abandoned, you should avoid using it. Use laminas/laminas-eventmanager instead.
Package zendframework/zend-code is abandoned, you should avoid using it. Use laminas/laminas-code instead.
Symfony Version 4.2.2
When using a custom doctrine type doctrine:schema:validate
continuously fails although doctrine:schema:update --force
works
My solution was to remove symfony/orm-pack and run
composer require doctrine
composer update
ref
Any plans on making this compatible to symfony 5?
The requirement for doctrine-bundle should be "^1.6.10 || ^1.7"
This commit bf4bf67 added a dependency to composer/package-versions-deprecated which conflicts with any installed package using ocramius/package-versions (in my case infection).
I'm not sure what's the best way to handle this, but I can't install symfony/orm-pack
.
composer require symfony/orm-pack
Using version ^1.1 for symfony/orm-pack
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "5.1.*"
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for symfony/orm-pack ^1.1 -> satisfiable by symfony/orm-pack[v1.1.0].
- Conclusion: remove ocramius/package-versions 1.9.0
- Conclusion: don't install ocramius/package-versions 1.9.0
- symfony/orm-pack v1.1.0 requires composer/package-versions-deprecated * -> satisfiable by composer/package-versions-deprecated[1.8.0, 1.8.1].
- don't install composer/package-versions-deprecated 1.8.0|don't install ocramius/package-versions 1.9.0
- don't install composer/package-versions-deprecated 1.8.1|don't install ocramius/package-versions 1.9.0
- Installation request for ocramius/package-versions (locked at 1.9.0) -> satisfiable by ocramius/package-versions[1.9.0].
Installation failed, reverting ./composer.json to its original content.
If you create a brand new Symfony LTS 5.4 LTS project (I'm doing it on Windows) using this command:
symfony new testSymfony --version=lts --php=7.4
Then you add the doctrine-orm pack using this command:
composer require symfony/orm-pack
it will give you this error:
The service "doctrine.orm.default_annotation_metadata_driver" has a dependency on a non-existent service "doctrine.orm.metadata.annotation_reader".
It seems to me that you should have all the requirements needed to have it function when you install the orm-pack. You can fix this by running this:
composer require doctrine/annotations
I did a fresh install of symfony using PHP 7.4.13 then the symfony/orm-pack without a problem, I replicated the same using PHP 8.0.0 but encountered an error:
# composer require symfony/orm-pack
Using version ^2.0 for symfony/orm-pack
./composer.json has been updated
Running composer update symfony/orm-pack
Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "5.2.*"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- doctrine/doctrine-migrations-bundle[dev-2.2.x-merge-up-into-3.0.x_5f12ade8acaa06.99463690, v2.0.0-alpha1, ..., 2.2.x-dev] require php ^7.1 -> your php version (8.0.0) does not satisfy that requirement.
- doctrine/doctrine-migrations-bundle[dev-manager-loader, dev-container-aware-migration-factory, 3.0.0-alpha.1, ..., 3.1.x-dev] require php ^7.2 -> your php version (8.0.0) does not satisfy that requirement.
- doctrine/doctrine-migrations-bundle[1.0.x-dev, ..., 1.3.x-dev] require symfony/framework-bundle ~2.7|~3.3|~4.0 -> found symfony/framework-bundle[v2.7.0-BETA1, ..., 2.8.x-dev, v3.3.0-BETA1, ..., 3.4.x-dev, v4.0.0-BETA1, ..., 4.4.x-dev] but it conflicts with your root composer.json require (5.2.*).
- doctrine/doctrine-migrations-bundle[1.0.1, ..., 1.2.x-dev] require symfony/framework-bundle ~2.3|~3.0 -> found symfony/framework-bundle[v2.3.0, ..., 2.8.x-dev, v3.0.0-BETA1, ..., 3.4.x-dev] but it conflicts with your root composer.json require (5.2.*).
- doctrine/doctrine-migrations-bundle[1.0.0-BETA2, ..., 1.0.0] require symfony/framework-bundle ~2.1 -> found symfony/framework-bundle[v2.1.0, ..., 2.8.x-dev] but it conflicts with your root composer.json require (5.2.*).
- __root__ is present at version dev-master and cannot be modified by Composer
- doctrine/doctrine-migrations-bundle v1.0.0-beta1 requires symfony/symfony >=2.0 -> satisfiable by symfony/symfony[v5.2.0-BETA1, ..., 5.2.x-dev].
- symfony/orm-pack v2.0.0 requires doctrine/doctrine-migrations-bundle * -> satisfiable by doctrine/doctrine-migrations-bundle[dev-manager-loader, dev-container-aware-migration-factory, dev-2.2.x-merge-up-into-3.0.x_5f12ade8acaa06.99463690, v1.0.0-beta1, ..., 1.3.x-dev, v2.0.0-alpha1, ..., 2.2.x-dev, 3.0.0-alpha.1, ..., 3.1.x-dev].
- __root__ dev-master conflicts with symfony/symfony v5.2.0.
- __root__ dev-master conflicts with symfony/symfony v5.2.0-RC2.
- __root__ dev-master conflicts with symfony/symfony v5.2.0-RC1.
- __root__ dev-master conflicts with symfony/symfony v5.2.0-BETA3.
- __root__ dev-master conflicts with symfony/symfony v5.2.0-BETA2.
- __root__ dev-master conflicts with symfony/symfony v5.2.0-BETA1.
- __root__ dev-master conflicts with symfony/symfony 5.2.x-dev.
- Root composer.json requires symfony/orm-pack ^2.0 -> satisfiable by symfony/orm-pack[v2.0.0].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
# symfony console about
-------------------- ---------------------------------
Symfony
-------------------- ---------------------------------
Version 5.2.0
Long-Term Support No
End of maintenance 07/2021 (in +240 days)
End of life 07/2021 (in +240 days)
-------------------- ---------------------------------
Kernel
-------------------- ---------------------------------
Type App\Kernel
Environment dev
Debug true
Charset UTF-8
Cache directory ./var/cache/dev (253 KiB)
Build directory ./var/cache/dev (253 KiB)
Log directory ./var/log (0 B)
-------------------- ---------------------------------
PHP
-------------------- ---------------------------------
Version 8.0.0
Architecture 64 bits
Intl locale en_PH
Timezone UTC (2020-12-03T18:47:21+00:00)
OPcache true
APCu false
Xdebug false
-------------------- ---------------------------------
I ran into this issue today when I upgraded one of our Symfony 4.2 applications to run on PHP 7.4 and updated dependencies accordingly.
In the composer.json
we have symfony/orm-pack
installed, which installs doctrine/doctrine-bundle
properly at version 1.12.*
or so.
We also have DoctrineBundle
defined in config/bundles.php
properly.
Otherwise the application worked OK in PHP 7.4 and new dependencies, but I noticed that one of our controllers was throwing errors that displayed:
DoctrineBundle is not registered in your application
After digging, I noticed that the bundle was in fact registered when running console debug:container
. ManagerRegistry
instances were properly injected when passed in as constructor parameters, so it seemed to work.
What was different with the failing controller, was that it used $this->getDoctrine()
instead of injecting a ManagerRegistry
. The controller extends Symfony's AbstractController
.
The problem went away when I swapped the getDoctrine()
call to be a ManagerRegistry
injection instead.
I do think that this has something to do with a relatively stale Symfony 4.2 being in use, but wanted to post this issue to
@nicolas-grekas The issue is unresolved from #40 . It still shows the error "The service "doctrine.orm.default_annotation_metadata_driver" has a dependency on a non-existent service "doctrine.orm.metadata.annotation_reader".
It still requires using composer require doctrine/annotations
Can you add require doctrine/annotations
to the composer.json file or is this a doctrine issue?
Thank you for your help and all of your support to the Symfony community!
I just updated and got DoctrineMigrationsBundle, along with a lot of things that simply I don't need.
Why bloating this pack? Can't we just leave it with minimal requirements?
Hi,
Since this package requires symfony/orm 2.5.11 which requires symfony/console ~2.5|~3.0 this package seems not compatible with the new symfony/flex that requires symfony/console 4.0.
Or maybe I'm doing something wrong.
Thanks !
I just found about the unpack command. There was a misunderstanding on my side, because you want the versions to be non-restricted. My bad.
Because orm-pack
makes no restrictions in the versions for each package, it loads the latest stable. Unfortunately there were breaking changes between DoctrineMigrationsBundle 2.2.x and 3.0. These changes are related to an "incomplete" config file which raises an InvalidConfigurationException
.
I assume i just have to update that config file. But maybe that points to the question if its necessary to introduce version restrictions to orm-package libs?
Ref:
My setup is:
and i ran composer update
.
Output was:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.4.*"
Prefetching 6 packages ๐ถ ๐จ
- Downloading (100%)
Package operations: 0 installs, 6 updates, 0 removals
- Updating symfony/flex (v1.7.1 => v1.8.2): Loading from cache
- Updating jaybizzle/crawler-detect (v1.2.95 => v1.2.96): Loading from cache
- Updating sensio/framework-extra-bundle (v5.5.5 => v5.5.6): Loading from cache
- Updating symfony/string (v5.1.1 => v5.1.2): Loading from cache
- Updating doctrine/migrations (2.2.1 => 3.0.0): Loading from cache
- Updating doctrine/doctrine-migrations-bundle (2.1.2 => 3.0.1): Loading from cache
Package zendframework/zend-code is abandoned, you should avoid using it. Use laminas/laminas-code instead.
Package zendframework/zend-eventmanager is abandoned, you should avoid using it. Use laminas/laminas-eventmanager instead.
Afterwards running any commands results in the following exceptions:
PHP Fatal error: Uncaught Symfony\Component\Config\Definition\Exception\InvalidConfigurationException: Unrecognized options "dir_name, namespace" under "doctrine_migrations". Available options are "all_or_nothing", "check_database_platform", "connection", "custom_template", "em", "factories", "migrations", "migrations_paths", "organize_migrations", "services", "storage". in /var/www/html/vendor/symfony/config/Definition/ArrayNode.php:327
Stack trace:
#0 /var/www/html/vendor/symfony/config/Definition/BaseNode.php(382): Symfony\Component\Config\Definition\ArrayNode->normalizeValue(Array)
#1 /var/www/html/vendor/symfony/config/Definition/Processor.php(34): Symfony\Component\Config\Definition\BaseNode->normalize(Array)
#2 /var/www/html/vendor/symfony/config/Definition/Processor.php(50): Symfony\Component\Config\Definition\Processor->process(Object(Symfony\Component\Config\Definition\ArrayNode), Array)
#3 /var/www/html/vendor/symfony/dependency-injection/Extension/Extension.php(113): Symfony\Component\Config\Definition\Processor-> in /var/www/html/vendor/symfony/config/Definition/ArrayNode.php on line 327
Fatal error: Uncaught Symfony\Component\Config\Definition\Exception\InvalidConfigurationException: Unrecognized options "dir_name, namespace" under "doctrine_migrations". Available options are "all_or_nothing", "check_database_platform", "connection", "custom_template", "em", "factories", "migrations", "migrations_paths", "organize_migrations", "services", "storage". in /var/www/html/vendor/symfony/config/Definition/ArrayNode.php:327
Stack trace:
#0 /var/www/html/vendor/symfony/config/Definition/BaseNode.php(382): Symfony\Component\Config\Definition\ArrayNode->normalizeValue(Array)
#1 /var/www/html/vendor/symfony/config/Definition/Processor.php(34): Symfony\Component\Config\Definition\BaseNode->normalize(Array)
#2 /var/www/html/vendor/symfony/config/Definition/Processor.php(50): Symfony\Component\Config\Definition\Processor->process(Object(Symfony\Component\Config\Definition\ArrayNode), Array)
#3 /var/www/html/vendor/symfony/dependency-injection/Extension/Extension.php(113): Symfony\Component\Config\Definition\Processor-> in /var/www/html/vendor/symfony/config/Definition/ArrayNode.php on line 327
My doctrine_migrations.yml
looks like:
doctrine_migrations:
dir_name: '%kernel.project_dir%/src/DoctrineMigrations'
# namespace is arbitrary but should be different from App\Migrations
# as migrations classes should NOT be autoloaded
namespace: DoctrineMigrations
Part of my composer.json
:
{
"require": {
"php": "^7.3",
"ext-iconv": "*",
"erusev/parsedown": "^1.7.3",
"genkgo/mail": "^2.6.1",
"jaybizzle/crawler-detect": "^1.2.84",
"league/iso3166": "^2.1.4",
"php-curl-class/php-curl-class": "^8.6",
"sensio/framework-extra-bundle": "^5.5.1",
"symfony/apache-pack": "^1.0",
"symfony/asset": "4.4.*",
"symfony/cache": "4.4.*",
"symfony/console": "4.4.*",
"symfony/dotenv": "4.4.*",
"symfony/flex": "^1.7.1",
"symfony/form": "4.4.*",
"symfony/framework-bundle": "4.4.*",
"symfony/monolog-bundle": "^3.5.0",
"symfony/orm-pack": "^1.0.8",
"symfony/polyfill-php80": "^1.14",
"symfony/property-access": "4.4.*",
"symfony/proxy-manager-bridge": "4.4.*",
"symfony/security-bundle": "4.4.*",
"symfony/serializer": "4.4.*",
"symfony/twig-bridge": "4.4.*",
"symfony/twig-bundle": "4.4.*",
"symfony/validator": "4.4.*",
"symfony/yaml": "4.4.*",
"twig/twig": "^3.0.3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16.3",
"phpstan/phpstan": "^0.11.15",
"symfony/filesystem": "4.4.*",
"symfony/maker-bundle": "^1.19",
"symfony/phpunit-bridge": "4.4.*",
"symfony/polyfill-php80": "^1.15.0",
"symfony/web-profiler-bundle": "4.4.*",
"symplify/easy-coding-standard": "^6.1"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.4.*"
}
},
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"App\\": "src/App/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Test\\": "test/",
"App\\Tests\\": "tests/"
}
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
}
}
}
I think this package needs symfony/doctrine-messenger
since I can not use symfony/symfony ^5.4
and symfony/orm-pack ^2.2
together without that package. I'm not using Symfony Flex.
Running bin/console
with just give me:
The autoloader expected class "Symfony\Component\Messenger\Transport\Doctrine\DoctrineTransportFactory" to be defined in file "/var/www/html/vendor/composer/../symfony/symfony/src/Symfony/Component/Messenger/Transport/Doctrine/DoctrineTransportFactory.php". The file was found but the class was not in it, the class name or namespace probably has a typo.
Well, true. This class is deprecated:
// Symfony\Component\Messenger\Transport\Doctrine\DoctrineTransportFactory.php
if (false) {
/**
* @deprecated since Symfony 5.1, to be removed in 6.0. Use symfony/doctrine-messenger instead.
*/
class DoctrineTransportFactory
{
}
}
$> grep symfony\/ composer.json
"symfony/monolog-bundle": "^3.8",
"symfony/orm-pack": "^2.2",
"symfony/symfony": "^5.4"
After requiring symfony/doctrine-messanger
, the autoloading/-wiring works fine.
Using this pack gives me tons of deprecation warnings in combination with symfony 5. It's hard to figure out what i need to update, if anything.
Examples:
User Deprecated: The Doctrine\Common\Persistence\Proxy class is deprecated since doctrine/persistence 1.3 and will be removed in 2.0. Use \Doctrine\Persistence\Proxy instead.
User Deprecated: The Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory class is deprecated since doctrine/persistence 1.3 and will be removed in 2.0. Use \Doctrine\Persistence\Mapping\AbstractClassMetadataFactory instead.
User Deprecated: The Doctrine\Common\PropertyChangedListener class is deprecated since doctrine/persistence 1.3 and will be removed in 2.0. Use \Doctrine\Persistence\PropertyChangedListener instead.
Also since last update:
Package zendframework/zend-code is abandoned, you should avoid using it. Use laminas/laminas-code instead.
Package zendframework/zend-eventmanager is abandoned, you should avoid using it. Use laminas/laminas-eventmanager instead.
I understand that this is not directly related to this pack, but any tips are welcome :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.