Timestamble error getRawDateValue
adam314315 opened this issue · 10 comments
Hello,
I just did a fresh installation symfony new test --version="7.0.*" --webapp of symfony (7.0) with PHP 8.3.6 and while trying to use Timestampable feature of stof/doctrine-extensions-bundle with Gedmo I got the following error after integration of the timestampable created and updated when trying to persist an entity. Any idea if this is related to some issues with version or any fix as it comes from the direct installation of symfony
Gedmo\Timestampable\Mapping\Event\Adapter\ORM::getRawDateValue(): Argument stof/StofDoctrineExtensionsBundle#1 ($mapping) must be of type array, Doctrine\ORM\Mapping\FieldMapping given, called in /vendor/gedmo/doctrine-extensions/src/Timestampable/Mapping/Event/Adapter/ORM.php on line 35
Here are the version declared via the composer.json and at composer install :
-- extract composer.json ---
"doctrine/dbal": "^3",
"doctrine/orm": "^3.1",
"stof/doctrine-extensions-bundle": "^1.10",
composer require stof/doctrine-extensions-bundle result:
Lock file operations: 5 installs, 0 updates, 0 removals
Locking behat/transliterator (v1.5.0)
Locking doctrine/annotations (2.0.1)
Locking doctrine/common (3.4.4)
Locking gedmo/doctrine-extensions (v3.14.0)
Locking stof/doctrine-extensions-bundle (v1.10.1)
same problem here
You are trying to use ORM 3.x which this package is not yet compatible with. Please downgrade to ORM 2.x.
@mbabker Ok. Just tested. It works with the downgrade but why is it now defined in the standard symfony sf 7.0 installation if not working with the doctrine extensions ?
Symfony itself is compatible with ORM 3.x, so when you set up a new app, then add the ORM, Composer will grab the latest compatible versions. Adding this library afterwards ends up creating the incompatible dependency tree (this package didn't have a high version conflict blocking ORM 3.x until the latest release, so Composer is installing an older version where that conflict doesn't exist; it would've been good to have that conflict sooner but you can't go back in time and fix this stuff).
I get it's all less than optimal, and there are plenty of issues about it, but because of how this package integrates with the ORM, there's just a lot of small things that have to be fixed up to make it work and I'm not aware of if anyone is contributing to that with any sponsored time (I know all my contributions are in my free time).
I just looked at some old PRs today and this particular compat issue is fixed in this package's 3.15 release via #2765, so this issue can be closed out. There are still some other things to fix, but this specific item isn't one of them.
@mbabker I tried to use the 3.15 version but got errors.
I did:
composer require gedmo/doctrine-extensions:3.15
The errors:
The "3.15" constraint for "gedmo/doctrine-extensions" appears too strict and will likely not match what you want. See https://getcomposer.org/constraints
./composer.json has been updated
Running composer update gedmo/doctrine-extensions
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- doctrine/orm is locked to version 3.1.3 and an update of this package was not requested.
- gedmo/doctrine-extensions v3.15.0 conflicts with doctrine/orm <2.14.0 || 2.16.0 || 2.16.1 || >=3.0.
- Root composer.json requires gedmo/doctrine-extensions 3.15 -> satisfiable by gedmo/doctrine-extensions[v3.15.0].
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
OK, so there are a couple of things in your case.
-
Just as the first line in the output says, the version constraint your using is less than optimal as it doesn't match to an exact version nor does it have any SemVer range constraints.
composer require gedmo/doctrine-extensions:^3.15
would be the better command to use here. -
Also as noted in the output, you're trying to install this package's 3.15 release, and it explicitly conflicts against
doctrine/orm >= 3.0
, so you also need to downgrade the ORM to 2.x to be able to use this package. If you add the-w
flag to the above command, that may take care of that issue (depending on whether you've got the ORM listed in yourcomposer.json
or not). If that doesn't fix it, you'll probably need to manually edit yourcomposer.json
file to make suredoctrine/orm ^2.19
is being installed.
2. Also as noted in the output, you're trying to install this package's 3.15 release, and it explicitly conflicts against `doctrine/orm >= 3.0`, so you also need to downgrade the ORM to 2.x to be able to use this package. If you add the `-w` flag to the above command, that may take care of that issue (depending on whether you've got the ORM listed in your `composer.json` or not). If that doesn't fix it, you'll probably need to manually edit your `composer.json` file to make sure `doctrine/orm ^2.19` is being installed.
Iam running against a similar problem with a fresh symfony 7.0.* installation. Can you explain to me why the conflict exsists in the first place? gedmo/doctrine-extensions should be compatible with doctrine/orm >=3.0 or am I getting it wrong here?
My conflict looks like this:
Problem 1
- Root composer.json requires doctrine/doctrine-fixtures-bundle ^3.6 -> satisfiable by doctrine/doctrine-fixtures-bundle[3.6.0].
- doctrine/doctrine-fixtures-bundle 3.6.0 requires doctrine/orm ^2.14.0 || ^3.0 -> satisfiable by doctrine/orm[3.0.0, ..., 3.2.0].
- gedmo/doctrine-extensions v3.15.0 conflicts with doctrine/orm <2.14.0 || 2.16.0 || 2.16.1 || >=3.0.
- Root composer.json requires gedmo/doctrine-extensions ^3.15 -> satisfiable by gedmo/doctrine-extensions[v3.15.0].
Thanks in advance for your help,
Cheers
gedmo/doctrine-extensions should be compatible with doctrine/orm >=3.0 or am I getting it wrong here?
You're getting it wrong here, this package is not yet compatible with doctrine/orm >= 3.0
and you need to downgrade to ORM 2.19.
Closing here as the package is compatible now with ORM 3 (there is no release yet, but you can test the main
branch)