cross-solution / YAWIK

YAWIK is a web application. It can be used as an ATS applicant tracking system or as a jobboard.
https://yawik.org
MIT License
125 stars 67 forks source link

Update Doctrine ODM #591

Closed TiSiE closed 3 years ago

TiSiE commented 4 years ago

Update 23.11.2020:

We want YAWIK to run with Doctrine Mongo ODM 2.x
We need doctrine/DoctrineMongoODMModule Version 3.x as this version finally support Doctrine ODM 2.x

TiSiE commented 4 years ago

The Laminas wrapper module for Doctrine MongoODM has not yet released a version compatible with Doctrine MongoODM 2.x

https://github.com/doctrine/DoctrineMongoODMModule/pull/222

We should wait till its released.

cbleek commented 4 years ago

OK, let's wait

TiSiE commented 4 years ago

Here are the migration guides from doctrine/mongodb-odm:

https://github.com/doctrine/mongodb-odm/blob/2.1.2/UPGRADE-2.0.md https://github.com/doctrine/mongodb-odm/blob/2.1.2/UPGRADE-2.1.md

TiSiE commented 3 years ago

Version 3.x of doctrine/DoctrineMongoODMModule is now released.

TiSiE commented 3 years ago

@kilip If you want, can you migrate YAWIK to Doctrine Mongo ODM 2 and doctrine/DoctrineMongoODMModule 3? That would be awesome. Simply assign this issue to yourself. Ty

kilip commented 3 years ago

@TiSiE yes I can working on this issue

cbleek commented 3 years ago

@kilip

I can see, that you've committed the first commit into you fork. And it's displayed here, because you've mentioned the Issue in the commit message.

OK.

Shall we do something? Or should we just wait for your pull request?

kilip commented 3 years ago

@cbleek I will make a pull request when it's ready.

cbleek commented 3 years ago

Do you already have an idea how much time you will need to complete the tasks?

kilip commented 3 years ago

@cbleek Don't know exactly how much time I need. Because there are a lot of major changes required by mongodb-odm 2.0 which will be affecting all paginator (since Doctrine Cursor class is removed without replacement), and all tests that mocking a Doctrine Final Class (Query, UnitOfWork, etc now marked as Final Class).

I am now have all behat tests passed, and 20 errors on phpunit tests. I hope this week I can make a pull requests.

cbleek commented 3 years ago

Thank you. That's OK. just go on.

cbleek commented 3 years ago

Can you commit your changes to your issue-591 branch on occasion?

cbleek commented 3 years ago

@kilip if I run a "composer install" on the latest version, I get a fatal error.

Do you have any idea?

cbleek@php7-cb:~/kilip-yawik$ composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
In Laminas\DependencyPlugin\DependencyRewriterV2::onPrePoolCreate
Nothing to install, update or remove
Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
Package paypal/rest-api-sdk-php is abandoned, you should avoid using it. No replacement was suggested.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Generating optimized autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
PHP Fatal error:  Declaration of Symfony\Component\Console\Style\OutputStyle::write($messages, bool $newline = false, int $type = self::OUTPUT_NORMAL) must be compatibth Symfony\Component\Console\Output\OutputInterface::write($messages, $newline = false, $options = 0) in /home/cbleek/kilip-yawik/vendor/symfony/console/Style/OutputSthp on line 52

Fatal error: Declaration of Symfony\Component\Console\Style\OutputStyle::write($messages, bool $newline = false, int $type = self::OUTPUT_NORMAL) must be compatible wimfony\Component\Console\Output\OutputInterface::write($messages, $newline = false, $options = 0) in /home/cbleek/kilip-yawik/vendor/symfony/console/Style/OutputStyle.p line 52
cbleek@php7-cb:~/kilip-yawik$ git log -1
commit af05f490cc8aaaf2a8a827d6bedc664519968335 (HEAD -> issue-591, origin/issue-591)
Author: Anthonius Munthi <me@itstoni.com>
Date:   Fri Dec 4 15:53:22 2020 +0800

    added 0.36 migrator
kilip commented 3 years ago

@cbleek

yawik/composer-plugin package is broken. Just run composer install with --no-scripts: composer install --no-scripts

kilip commented 3 years ago

@TiSiE @cbleek

Upgrade summary:

Here's a reference on new doctrine GridFS upload method: https://www.doctrine-project.org/projects/doctrine-mongodb-odm/en/2.1/reference/storing-files-with-gridfs.html

TiSiE commented 3 years ago

PHP Fatal error: Declaration of Symfony\Component\Console\Style\OutputStyle::write($messages, bool $newline = false, int $type = self::OUTPUT_NORMAL) must be compatibth Symfony\Component\Console\Output\OutputInterface::write($messages, $newline = false, $options = 0) in /home/cbleek/kilip-yawik/vendor/symfony/console/Style/OutputSthp on line 52

I cannot see how this could be a problem in yawik/composer-plugin? Looks like a problem in symfony/console

However, browsing symfony issues, it may be that dependencies are installed for a different php versions - which is not the case, since we require php 7.4 now...

TiSiE commented 3 years ago

@cbleek @kilip see https://github.com/symfony/symfony/issues/39368

TiSiE commented 3 years ago

We have a big problem with this composer-plugin issue.

The OutputInterface of Symfony has changed in symfony/console 5.x .

When running a plugin, composers internal dependencies override the dependencies defined in composer.json.

Composer 2.0 uses symfony/console 2.8

When the yawik/composer-plugin is run, it uses Core\Application to initialize the Yawik application, which creates a SymfonyStyle instance in the clearCache method. Here, the SymfonyStyle class from the console 5.x package is used, but the OutputInterface it must implement is loaded from composers console 2.8 package - hence the incompatible declarations.


We must use symfony/console 5.x because it#s required by DoctrineMongoODMModule.


According to https://github.com/composer/composer/issues/9531 , composer 2.2 should have more recent symfony dependencies.


The only solution I see for now is to not use symfony/console in the plugin and Core\Application

TiSiE commented 3 years ago

@kilip I will handle that

cbleek commented 3 years ago

@kilip I've merged your PR into odm-module3. The brnch ist running at https://staging.yawik.org

I create Issues for things, which I nitice. Please feel free to assign them to yourself