-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
Rewrite factories for mongodb-odm version 2 #222
Conversation
@TomHAnderson @alcaeus Do you mind giving some feedback? I'd like to start using odm2 in production, but I'm not sure about the future of that module (nor is it my decision). For my projects I just need the service factories, which I already migrated to be compatible with ODM2. IMO all the other Laminas relates stuff shouldn't be here anyways, that includes the
Basically, my goal is having a package like Roave/psr-container-doctrine and, if necessary, provide depper Laminas integration in a separate package. But usage of this package is quite low, so I don't know if it's worth the work. If we can decide how to go further, I could improve the code a bit and write more tests to make it mergeable. Thanks! |
Hi @rieschl , I wish we already had ODM 2.0 in this package. Work was done to implement it but never finished. This became the last package I control to be migrated to Laminas so I made the decision to ship with ODM v1. I appreciate your work! Even if moving to 2.0 isn't backwards compatible I'd welcome a major version change to give Laminas users a choice of as-is-now and 2.0. All the fluff, like pagination, really needs to stay. I view this repo as a sister to doctrine-orm-module which also has fluffy helper classes. I'm afraid I don't know enough to answer your question about a minimalist repo vs a fluffy one. I think the fluff differentiates this repo as it shows "fuller" support of Laminas. Let's work out the direction this module should take then we can address issues you need help with like skipped tests. |
Alright then. Most of the things should work already, I'll test it in my environment later on but I think there aren't many BC breaks for standard usage. I tried to keep the configuration keys the same so it should minimal effort to upgrade.
I managed to fix two tests, so only the pagination Cursor stuff is remaining. After that, I'll increase the test coverage. Maybe, in future iterations we can strip out the service factories to a separate package and use that package in this one, to increase abstraction and broaden the usability. As I said, sooner or later I'll need that for mezzio anyways and my preference goes to a neutral PSR-style code. Maybe @alcaeus can help me with the cursor? Also, I never wrote a changelog and Doctrine (and Laminas for that matter) keep very good changelogs to ease upgrading. So maybe someone can halp me there or point me to a correct direction. Thanks! |
0f89984
to
258e344
Compare
@rieschl I hope I'm not too late in the process here but if you want to write a new repository let's call it You already defined the idea in the quote here and if we had a fluffy and non-fluffy support I like that idea a lot. So whether you want to do that now or in the future it would be welcome. |
Hm that shouldn't be a problem. It's basically just extracting the service factories into a separate package. I'd name it
Most of the factories are just copied from roave/psr-container-doctrine anyways. But I'm not sure if the config key names are the same as here. What do you think? |
Sure. The biggest change is going to be the absence of a To deal with this, you could change the signature to accept a The workaround for |
Hi @rieschl , I've talked with the Doctrine team and they have concerns about taking on a new repository because that has been a problem in the past. I recognize your solution here is either put it all into this repository or split out a repo which is very similar to the successful Roave repo which has become the standard for Mezzio installations. I can confidently say Doctrine is not interested in a repository so similar to the functional Roave repository. This is not a judgement on the usefulness of such a repository. But you're still proposing moving to ODM 2.0 (thanks for the earlier typo correction) and that is something I do want to do. Work on this move internal to Doctrine has stagnated and outside contributions are welcome. I want to stop this reply at this point to hear if you're interested in this approach and what you'll need from me to keep driving towards the ODM 2.0 goal. |
Hey @TomHAnderson Alright, it's fine for me. As everything is MIT licensed anyways, I have no problem to copy&paste the service factories into a separate roave-like repo and also keep everything in this one. It just isn't that DRY. Thanks! |
Since that's the drama of the week in PHP-land, please adhere to the license and properly attribute code. Thanks ;) |
hm? I'm no license guru, but afaik MIT license doesn't require to mention the source, just to add the copyright notice in the LICENCE file. Or what exactly do you mean? |
Sorry to ask again, but isn't a |
Yes that seems fine. |
@TomHAnderson I just had a talk with @alcaeus about the Is it ok for you to drop the paginator? Also, I added license headers and asked roave for their permission, just to be sure. |
Thank you for letting me know about the paginator. I'm fine dropping that class as you and @alcaeus can agree to that. |
I had some time to work on that PR. |
@rieschl yes, CommandLogger is what should be used. You may take a page from doctrine/DoctrineMongoDBBundle#569 which brought logging back to the Symfony bundle. |
…ith doctrine/mongodb-odm 2.0 * remove DoctrinePaginator * adapt tests Signed-off-by: Thomas Rieschl <[email protected]>
Signed-off-by: Thomas Rieschl <[email protected]>
Signed-off-by: Thomas Rieschl <[email protected]>
Signed-off-by: Thomas Rieschl <[email protected]>
Hi all! Sorry for the delay. Covid is quite time consuming :/ I (force) pushed the latest version of my changes, going a different path. Instead of changing all factories to be config driven I kept the Options Classes and just adapted everything that's required to work with ODM 2. What do you think? Edit: I tried to use the library in on of our bigger projects and everything worked without changing anything in the configuration. Some changes were necessary because of changes in mongodb-odm 2. We get the Mongo Client/Collection in some places from the Edit2: Edit3: |
Two more questions:
|
In the Symfony bundle, we replaced the logger with a
If that's what they are being used for, or if they are not being used at all, then go for it. Keep in mind that you may want to deprecate any |
I'll look into it if I can easily rewrite that. I just noticed that this logger is used in the logging facility of the Laminas developer tools. I don't use that myself so I haven't noticed before.
|
Signed-off-by: Thomas Rieschl <[email protected]>
* remove Logger interface * make existing loggers implement CommandLoggerInterface * rename view directory (typo) Signed-off-by: Thomas Rieschl <[email protected]>
Logger looks good. I'm going to leave this PR alone until I hear from you, @rieschl , that it's ready to be put into a new release. |
Ah, sorry, I forgot that the PR isn't marked as draft anymore. |
* remove LoggerChain (not needed because multiple Loggers can be registered directly with the driver) * Configuration can only take a service name, not a concrete instance * add some tests for MongoLoggerCollector and its factory Signed-off-by: Thomas Rieschl <[email protected]>
Alright, I added some tests and checked the package in one of my projects, including the Laminas developer toolbar. Everything seems alright. From my point of view it can be merged. Travis is failing because of the release of composer 2 and I don't know how to force usage of composer 1 ( |
Well keep at it. You're in the home stretch. Did you submit a PR to dealerdirect? |
correction.. composer 2 compatibility was already merged some time ago. Problem is the outdated version of |
It needs to be done. Go ahead and update the Doctrine Coding Standard in this repo. Once that PR is in place I'll start running it locally to help the migration to the updated standard. I'll push PRs to you so we can keep this on the same branch and get some peer review. Sound good? |
update composer dependencies; remove doctrine coding-standard and use php_codesniffer directly fix typo in travis config Signed-off-by: Thomas Rieschl <[email protected]>
I just looked into the phpcs and related travis configuration. It doesn't use the doctrine coding standard anyways, so I dropped it entirely. It can be implemented in a separate PR. Edit: the travis pipeline also passed. So you can throw your reviews and change requests at me 🙂 |
tests/DoctrineMongoODMModuleTest/Doctrine/ConfigurationFactoryTest.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one change for the whole PR. Looks excellent and was a flowing read.
I just noticed that coveralls has stopped working with build 457. it worked until 456. |
Not off the top of my head. But I need to create Docker testing for this repo anyway and I can add fix Coveralls to it (it may be Doctrine has dropped Coveralls; I can't remember for certain). How soon do you need a release with this PR? |
Signed-off-by: Thomas Rieschl <[email protected]>
Signed-off-by: Thomas Rieschl <[email protected]>
I got it. There was just an env var missing. Everything is now ok.
Asap of course 😉 My initial push was on May 18, so I think I can be patient 🙂 |
https://github.com/doctrine/DoctrineMongoODMModule/releases/tag/3.0.0 @rieschl there is no rush or reason to wait so I've released it right now. I just wanted to get an idea from you about timelines. |
This is still a WIPThe abstract ServiceFactory and a bunch of code is borrowed from https://github.com/Roave/psr-container-doctrineSome tests are marked skippedOptions classes are deprectated (and will be deleted). They are quite useless in a config driven factory.My personal goal is that everything that's not required for setting up the ODM (Paginator, Logger) and all Laminas specific stuff is stripped and maybe put in a separate package, so that we have a Laminas agnostic way to set up the ODM, just like psr-container-doctrine is doing. At least it should work with mezzio because I'll need it there, too :)Current behavior and configuration almost stays the same, except for changes that happened in the
mongodb-odm
package.Fixes #205