ip icon indicating copy to clipboard operation
ip copied to clipboard

[!] DBAL 4 incompatibility

Open DarthLegiON opened this issue 11 months ago • 3 comments

Hi guys! Is this package abandoned? Because I have a problem with it when Doctrine ORM is upgraded to 3.0 and DBAL to 4.0.

Starting from this:

Fatal error: Declaration of Darsyn\IP\Doctrine\AbstractType::convertToDatabaseValue($value, Doctrine\DBAL\Platforms\AbstractPlatform $platform) must be compatible with Doctrine\DBAL\Types\Type::convertToDatabaseValue(mixed $value, Doctrine\DBAL\Platforms\AbstractPlatform $platform): mixed in /var/app/vendor/darsyn/ip/src/Doctrine/AbstractType.php on line 85

And it's real:

public function convertToDatabaseValue($value, AbstractPlatform $platform)

vs

public function convertToDatabaseValue(mixed $value, AbstractPlatform $platform): mixed

It must be fixed. I can prepare the pull request, if you need it.

DarthLegiON avatar Mar 02 '24 22:03 DarthLegiON

Sorry, I've only just noticed this issue! There aren't going to be any new features, but I'm definitely interested in keeping this library up-to-date with newer Doctrine versions.

Currently, the IP library supports PHP versions all the way from 5.6 to 8.3 - if the newer Doctrine versions require adding return types then I'm going to have to think about backwards compatibility. Perhaps I might split it up into darsyn/ip and darsyn/ip-doctrine.

For the moment, it might be best if you copy the Doctrine type classes and make the modifications you need as I don't see the upgrades that are needed being particularly quick.

zanbaldwin avatar May 05 '24 21:05 zanbaldwin

Thanks for your attention! Your answer explains a lot for me.

I see that there are no problems with updating Doctrine itself but only with DBAL extension to v4. I set v3.8.4, it's enough for ORM v3 and doesn't conflict with packages that have to maintain PHP <8.

I suggest you to add "conflict" section to your composer.json with such code:

"conflict": {
    "doctrine/dbal": ">=4.0"
}

It should prevent automatic updates of DBAL when your package is installed.

DarthLegiON avatar May 06 '24 11:05 DarthLegiON

@zanbaldwin I've tested 5.0.0-rc now, looks good, passes all my tests, and not updating doctrine/dbal up to v4. Thanks!

It would be good to make doctrine bundle compatible with modern DBAL versions, it could be useful in future. It must require drop PHP < 8 support but can bring some advantages.

DarthLegiON avatar Jun 08 '24 13:06 DarthLegiON

can we do something here? total blocker :)

norkunas avatar Aug 08 '24 05:08 norkunas

can we do something here? total blocker :)

Yes, sorry I forgot to close this issue. Upgrading to darsyn/ip:^5 will remove the incompatibility with Doctrine 4. The only differences in v5 are:

While I do plan on improving darsyn/ip-doctrine to add DBAL4 support, it is unfortunately not a priority because of other life stuff happening. If you want to continue using the Doctrine type then your best option is to copy it into your project (a Doctrine type is only a single class). DBAL4 support should only require adding return types to the methods (I think?).

If you want to submit a pull request that would be greatly appreciated (if you have the time).

zanbaldwin avatar Aug 08 '24 11:08 zanbaldwin