Closed (fixed)
Project:
Drupal core
Version:
8.4.x-dev
Component:
documentation
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
19 Oct 2016 at 13:10 UTC
Updated:
8 Aug 2017 at 23:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
gianani commentedComment #3
gianani commentedAdding a patch.
Comment #4
arunkumarkThe patch #3 looks good. Some more detailed description added to it and created a new patch.
Comment #5
zeip commentedAttached is a patch for a slightly reworded version fixing a small spelling mistake.
Comment #6
jungleMore clear for me.
Comment #7
xjmThanks for working on this patch to improve Drupal's documentation.
This docblock does not follow the documentation standards. The summary should be a single line of 80 characters or fewer. The restriction is deliberate, in order to make sure that function summaries are succinct and clear.
Reference: https://www.drupal.org/node/1354
So, we should try to reword this to fit in a single 80-character line. If necessary, we can add subsequent (longer) paragraphs, but I don't think that's necessary here.
Thanks!
Comment #8
jungleIt's a method in an interface, IMO, short description is enough.
- Creates a new handler instance for a entity type and handler type.
+ Gets a handler instance for the entity and handler type.
Leave the details to the implementation, so omit here "creating a new one if one doesn't exist".
Comment #9
jungleComment #10
jungleChange a little bit.
- Gets a handler instance for the entity and handler type.
+ Gets a handler instance for a entity type and handler type.
Comment #11
joachim commentedThat's not addressing this issue at all.
> Leave the details to the implementation, so omit here "creating a new one if one doesn't exist".
That's not an implementation detail. Handlers rely on this behaviour when they cache data in themselves, so it has to be part of the interface's specification.
Comment #12
zeip commentedAttached is a new wording mentioning the caching.
Comment #13
jungleAccurate and followed the documentation standards.
Comment #14
xjmThanks @joachim, @ZeiP, and @jungle!
Based on #11 and a re-read of the summary, I do think that we should add a second paragraph that retirates that it will either use an existing one or create a new one otherwise (if that's correct), and that also addresses:
So something like:
That's just an example and I haven't reviewed the code in depth -- so please use that example just as a suggested format and improve on the actual documentation.
Thanks!
Comment #15
arunkumarkAs per comment #14 i have re-pached. @xjm thanks for comment.
Comment #16
joachim commentedThe bit in square brackets is a placeholder! ;)
Comment #17
arunkumarkAs per comment 16 the patch was re-rolled,
@joachim thanks for your comment.
Comment #19
joachim commentedThat still has the text in square brackets!
Comment #20
arunkumarkBrackets are removed.
@joachim thanks.
Comment #21
arunkumarkComment #22
joachim commentedRight but the text that was in those needs WRITING!!! It was just a placeholder!
Comment #24
shashikant_chauhan commentedComment #25
joachim commentedHow about this for description text:
Entity handlers are instantiated once per entity type and then cached in the entity type manager, and so subsequent calls to getHandler() for a particular entity type and handler type will return the same object. This means that properties on a handler may be used as a static cache, although care must be taken with any data that is specific to a particular entity.
Comment #26
tameeshb commentedAdding description from #25
Comment #27
tameeshb commentedSome irrelevant changes came along in #26,
Patch redone with interdiff against #26
Comment #28
joachim commentedThanks. Quick work!
What you're adding looks good, but you shouldn't be removing the first line of the docs. All docblocks should start with a paragraph of a single line. The one that is already here is fine and should stay.
Comment #29
tameeshb commentedAdded the first line, with the interdiff against 27!
Comment #30
joachim commentedPatch looks perfect. Thanks!
Though someone else should review it, since it's me that wrote the text.
Comment #31
Munavijayalakshmi commentedApplied patch core/lib/Drupal/Core/Entity/EntityTypeManagerInterface.php cleanly.
Comment #32
himanshu-dixit commented@munavijayalakshmi Screenshots of code are really not helpful.
Comment #33
tameeshb commented@Munavijayalakshmi Screenshots of "before" and "after" are attached when there has been some UI changes in the issue. In that case we post screenshots of the UI components that have changed before and after.
Code is text, and there is no use of taking screenshots of code snippets.
Comment #34
Munavijayalakshmi commented@tameeshb thank you for your suggestion. I am new to drupal.
Comment #35
tameeshb commentedRTBCing was fine though.
Reverting back to RTBC
Comment #36
xjmThanks @joachim for providing mentoring on this issue. Going to add my own again now: for @tameeshb, the patch should only be marked RTBC by someone who has performed the review task. Creating patches for Drupal is not just a matter of following instructions; we need your contributions to include your thoughtful evaluation of what the best change is and whether it is correct. Also, as a best practice, you should not mark any patch that you create as RTBC.
In #30, joachim acknowledges that he wrote the text, so his proposed text needs to be reviewed for its accuracy and clarity by a peer reviewer. So, the way to provide a review for (and then RTBC) this patch is to read the documentation, read the code describes, and confirm that what the code does is properly explained by the documentation.
Thanks!
Comment #37
xjmHere is an example of what I might ask when reviewing the documentation:
What kind of care must be taken? As a developer, this does not give me enough information to know what I need to do when using this method for my entity data.
Comment #38
joachim commented> What kind of care must be taken? As a developer, this does not give me enough information to know what I need to do when using this method for my entity data.
I'm not really sure what we can say that's not going to be way too specific. What I am trying to say here basically is that if you store data in the handler by doing $this->mystuff = 'cats', you need to be sure that 'cats' applies to all entities of this type, and if not, do $this->mystuff[ENTITY ID] = 'cats'.
Perhaps we can say something like:
> This means that properties on a handler may be used as a static cache, although as the handler is common to all entities of the same type, any data that is per-entity should be keyed by the entity ID.
-- but I feel that's rather too bogged down in implementation details.
Comment #39
gaurav.kapoor commentedThis looks appropriate to me.
Comment #40
pk188 commentedUpdate the patch accordingly to #38 and #39.
Check once please.
Comment #41
joachim commentedPerfect! Thanks for working on the patch.
I'm taking the liberty of setting to RTBC despite having had a hand in writing the text, as my initial text was reviewed already in the previous patch and my amendment was reviewed in #39.
Comment #42
pk188 commented.
Comment #43
larowlanUpdating issue credit to add @joachim and @xjm who were instrumental in shaping the patch and provided in-depth mentoring - thanks!
Hiding some outdated files.
Comment #44
larowlanUnless I'm mistaken, the original intent of this issue was that the short description was inaccurate. But we're not changing it here? Is that correct?
Shouldn't this now read something like
Returns a handler instance for the given entity type and handlerFrom what I can gather, the original issue summary objected to the use of the word 'new' but we've retained it.
Comment #45
dinesh18 commentedI agree with @larowlan.
Here is an updated patch and interdiff
Comment #46
joachim commentedGood catch!
Thanks for the updated patch.
I'd say this is ready now.
Comment #48
larowlanCommitted as 4f1d0f7 and pushed to 8.4.x. Thanks everyone.