Problem/Motivation
#2628130: SQL error on revision export from view removed all usages of the database service in this plugin. It was decided to do the deprecate separately as we want to remove a argument from the constrcutor.
Proposed resolution
@todo
Remaining tasks
User interface changes
None
API changes
@todo
Data model changes
None
Release notes snippet
@todo
| Comment | File | Size | Author |
|---|---|---|---|
| #24 | 3187435-24.patch | 3.77 KB | spokje |
| #24 | interdiff_19_24.txt | 738 bytes | spokje |
Comments
Comment #2
Pooja Ganjage commentedHi,
Tried to creating a patch for this issue.
Please review the patch.
Let me know if any suggestions.
Thanks.
Comment #3
Pooja Ganjage commentedComment #4
Pooja Ganjage commentedComment #5
alexpott@Pooja Ganjage thanks for working on this!
You'll need to update \Drupal\node\Plugin\views\argument\Vid::create()
You'll need to update use \Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait to deprecate the database property.
You'll need to remove the typehint from the NodeStorageInterface - and then handle getting the node storage from the correct arg.
Comment #6
Pooja Ganjage commentedHi,
Creating a patch as suggested in #5 comment excepted 3rd point.
Please review the patch.
Thanks.
Comment #7
Pooja Ganjage commentedComment #8
raman.b commentedAddressing #5
DeprecatedServicePropertyTraitto deprecate$databaseproperty$node_storageand handled retreiving of$node_storagein case!$node_storage instanceof NodeStorageInterfacecreate()Not providing an interdiff since #6 included changes already committed in #2628130: SQL error on revision export from view
Comment #9
daffie commentedLets take #3157895: Move 'install_time' state update from \Drupal\Core\Installer\Form\SiteConfigureForm to installed_finished() as the example of how to do it. See: https://git.drupalcode.org/project/drupal/-/blob/HEAD/core/lib/Drupal/Co....
Only with the link to the followup for our class.
and then the docblock must be updated with:
Comment #10
spokjeon isleDrupal 10Comment #11
spokjeComment #12
daffie commentedThis is not the correct followup. I think that the followup first needs to be created.
Comment #13
spokjeIt is in the attached patch. Already created follow-up issue, but forgot to change the link in the previous patch.
Comment #14
daffie commentedThe patch does what the IS says it should do.
There is a CR for the deprecation.
There is also a followup issue for 10.0.
All code changes look good to me.
For me it is RTBC.
There is a double space between "is not" and "of the". Can be fixed on commit.
Comment #15
alexpottI don't think we should be adding this. It's all stuff that needs removing and doesn't document the now. The @trigger_error() and use of the DeprecatedServicePropertyTrait is enough.
Let's not add this either as it'll need removing in D10 when we add the typehint back again.
Comment #16
spokje@alexpott: I can see the validity of your points in #15, but as pointed out by @Daffie in #9 those were also done in #3157895: Move 'install_time' state update from \Drupal\Core\Installer\Form\SiteConfigureForm to installed_finished(), which issue handles about basically the same thing: Removing a service from a constructor where the argument for that constructor isn't the last argument fed to the constructor.
1) Do we want to take #3157895: Move 'install_time' state update from \Drupal\Core\Installer\Form\SiteConfigureForm to installed_finished() as a kind of standard for these remove-non-last-argument-from-constructor issues? If so, we should keep the bits you asked to remove in #15.
2) If we opt for removing them, do we still need the follow-up issue: #3189241: Remove deprecation and fix constructor args for \Drupal\node\Plugin\views\argument\Vid
Comment #17
alexpott@Spokje - good points about precedence. Hmmm... We still need the follow-up to do the work in D10.
So I think we should remove the comments... and a yet-another-issue to clean up SiteConfigureForm prior to D10 and remove the comments there. To be honest none of this documentation helps much because we have the create methods.
Also we should add some form test here because we have logic in the constructor now. The reason we didn't add tests to #3157895: Move 'install_time' state update from \Drupal\Core\Installer\Form\SiteConfigureForm to installed_finished() is because SiteConfigureForm has the @internal annotation.
Comment #18
spokjeThanks @alexpott for the clarification
Seems we have that one covered with #3189241: Remove deprecation and fix constructor args for \Drupal\node\Plugin\views\argument\Vid?
Isn't #3159456: Remove deprecation and fix constructor args for \Drupal\Core\Installer\Form\SiteConfigureForm already covering just that?
Attached patch removes comments as requested in #15.
Keeping on
Needs workbecause this patch doesn't cover:Comment #19
raman.b commentedTook some inspiration from
Drupal\Tests\book\Functional\BookTest::testBookNavigationCacheContextDeprecatedParameter()to add a quick test for thisComment #20
daffie commentedThe added deprecation test looks good to me.
All code changes look good to me.
We have a CR and a followup issue to restore stuff in 10.0.
For me it is RTBC.
I know that @alexpott did not want to have the following documentation in the docblock, but for me it should be in there:
Comment #21
alexpottRe #18
This needs to stay there. It's only the @throws documentation that's not needed. I should have been clearer.
Comment #22
spokjeI personally find it a bit "weird" to _not_ document the thrown
InvalidArgumentException.Also, I must say I'm on #TeamDaffie on keeping the DocBlock comments (#20). I think they help clarifying the why of not being able to typehint.
But again: Personal opinion, your milage may vary (and in fact be kilometres depending on where you live).
Comment #23
alexpottThe reason reason we don't need to document the @throws is because invalid argument exceptions are already implied by the documentation - the @param and by the language itself... if we had the typehint. It's over-documentation that has to be removed in the future... even when it it'd still be true - because right now in HEAD we'd trigger an invalid argument exception when calling this with the wrong argument types. We'll never have an initiative to add @throws for all the existing typehints in core because that'd be wrong. Also the reason we don't need the other document is that directly constructing this is wrong too. It is a plugin you get instantiated plugins from a plugin manager.
Comment #24
spokjeThanks @alexpott for the explanation.
Sorry @daffie, but I'm switching teams ;)
Attached patch addresses #21
Comment #25
daffie commentedReinserted the
InvalidArgumentExceptionas requested by @alexpott.There is no testing added for the exception, because it is only temporary.
Addressed all points of @alexpott.
Back to RTBC.
Comment #26
alexpottCommitted ad34608 and pushed to 9.2.x. Thanks!