As follow-up to #2116341: Apply defaults to definition objects, there are two @todo comments that links to a closed issue. Since they are referring to changes already done, they should be removed, and the BaseFieldDefinition::getFieldItemClass() method deprecated. Instead, the class should simply use $this->getItemDefinition()->getClass().
No other change as needed, since the other @todo comment is describing what the current code is already doing.
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | remove-todo-leftovers-2933964-20.patch | 2.84 KB | avpaderno |
| #17 | remove-todo-leftovers-2933964-17.patch | 2.54 KB | avpaderno |
| #10 | remove-left-over-2933964-10.patch | 2.67 KB | avpaderno |
| #9 | remove-left-over-2933964-9.patch | 2.07 KB | avpaderno |
| #8 | remote-the-code-2933964-8.patch | 874 bytes | oakulm |
Comments
Comment #2
avpadernoComment #3
avpadernoComment #5
avpadernoComment #7
avpadernoAfter having done some tests, and read the code, I am convinced the comment is just a left-over. There isn't any @todo to achieve.
Comment #8
oakulm commentedHi,
if I have understood this correctly the unnecessary code has to be removed as well as the @todo comment.
Patch https://www.drupal.org/files/issues/d8_definition_defaults_3.patch in https://www.drupal.org/node/2116341 adds in the functionality that is currently in the function we are talking about. See:
vs.
I have attached patch removing the duplicate code.
Comment #9
avpadernoComment #10
avpadernoThere is another @todo comment, but it seems describing exactly what the code after it is doing.
Comment #12
avpadernoComment #13
oakulm commentedYes this was my thinking also with this. Better to remove the whole function.
Comment #14
xjmBaseFieldDefinitionis public API, so I don't think we can get away with removing the protected method anymore following the release of 8.0.0. What we can do instead though is remove the usages of it and instead deprecate it. Reference: https://www.drupal.org/core/deprecationThanks!
Comment #15
avpaderno@xjm
BaseFieldDefinition::getFieldItemClass()is a protected method, not exposed from any interface, and in Drupal 8 backwards compatibility and internal API policy, I read:The patch can eventually keep the method. The purpose of the patch is removing those @todo comments and change the code where needed.
Comment #16
xjm@kiamlaluno, see: https://www.drupal.org/core/deprecation#internal
So, again, let's remove the usages and deprecate the method instead of removing it. Thanks!
Comment #17
avpadernoComment #18
oakulm commentedI was thinking the same thing should we remove the function or no. But this final patch seems to do the job and applies as it should.
Comment #19
xjmThanks, #17 looks good! We need just one more thing, a
@trigger_error()inside the function so that it gets removed. Example here: https://www.drupal.org/core/deprecation#how-methodSmall thing, this docs line should be indented by two spaces.
Comment #20
oakulm commentedGood catch. Also this trigger_error is new to me. Added trigger_error & added two spaces.
Comment #21
avpadernoI would also add a link to this very issue, as other
@trigger_error()calls in that class do.Comment #22
oakulm commentedComment #23
xjmOkay, that looks good! We don't need a change record for this one since it was only ever an internal helper; the deprecation notice by itself is sufficient in this case.