Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
At the moment views just use a stdClass object, returned from the PDO query. We can get it to return our own classed object instead. Me and Daniel were talking about this on IRC, and decided ResultRow might be a good place to start.
It would be good for documentation reasons. For now, it would not do a great deal functionally.
Something like this...
Comment | File | Size | Author |
---|---|---|---|
#21 | 2034947-21.patch | 32.12 KB | damiankloip |
#18 | 2034947-18.patch | 32.12 KB | damiankloip |
#11 | 2034947-11.patch | 32.16 KB | damiankloip |
#11 | interdiff-2034947-11.txt | 502 bytes | damiankloip |
#8 | 2034947-8.patch | 32.02 KB | damiankloip |
Comments
Comment #1
dawehnerSo we could typehint something like \Drupal\Core\Entity\EntityInterface[]
Comment #2
damiankloip CreditAttribution: damiankloip commentedYep, good docs. I will open a follow up to do the type conversions, as there will be alot.
Comment #3
damiankloip CreditAttribution: damiankloip commentedI created #2034979: Typehint Views field handler methods with ResultRow as a followup to typehint all the things.
Comment #5
damiankloip CreditAttribution: damiankloip commentedOk, we have to make atleast one typehint change...
Comment #6
dawehnerThis is definitive if used everywhere a huge DX win! that is public and named exactly like that so we don't have to change like everything.
Comment #8
damiankloip CreditAttribution: damiankloip commentedOk, so there are some render_link methods with \stdClass typed. Let's change those.
I think fixing/adding docblocks and adding public to methods is out of scope of this issue, what do you think?
Comment #9
dawehnerLets try to keep it as small as possible so +1 if it is green.
Comment #11
damiankloip CreditAttribution: damiankloip commentedOops, missed a use statement. noise - sorry.
Comment #12
dawehnerLet's go!
Comment #13
chx CreditAttribution: chx commentedHard to find the words for the joy I have over this. stdClass is a sad remnant of an ancient age (like Drupal 7).
With that said,
public $_entity = NULL;
-- I see it's not this issue, perhaps a followup to rename wholesale?Comment #14
damiankloip CreditAttribution: damiankloip commentedYeah :) I see your point, $_entity suggests protected. I think a follow up would be a good plan, as we could potentially get into conflicts if a field was called 'entity' at the moment, unlikely, but could happen I think.
Comment #15
dawehnerYeah on the longrun having that is a method would be just perfect!
Comment #16
dawehnerYeah on the longrun having that is a method would be just perfect, especially fetching this information could be deferred until it is needed.
Comment #17
alexpottNeeds a reroll...
Comment #18
damiankloip CreditAttribution: damiankloip commentedThere we go.
Comment #19
damiankloip CreditAttribution: damiankloip commentedAnd back..
Comment #20
alexpottNeeds a reroll...
Comment #21
damiankloip CreditAttribution: damiankloip commentedAgain!! ok :)
Comment #22
alvar0hurtad0I applyes and works fine
Comment #23
damiankloip CreditAttribution: damiankloip commentedThanks for testing.
Comment #24
alexpottCommitted 08aeb87 and pushed to 8.x. Thanks!
Comment #25
xjmComment #26
damiankloip CreditAttribution: damiankloip commentedHow about this? https://drupal.org/node/2059483
We don't need too much because it doesn't do a great deal at the moment, until we typehint where we need to.
Comment #27
dawehner+1