Closed (fixed)
Project:
Drupal core
Component:
node system
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
23 Jun 2005 at 18:37 UTC
Updated:
12 Oct 2005 at 22:20 UTC
Jump to comment: Most recent file
I am fed up writing node_load(array('nid' => $nid)) all the time.
BTW. if this is accepted, next is node_view to accept a $nid.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | nodeload_1.patch | 18.15 KB | chx |
| #15 | nodeload_0.patch | 18.98 KB | chx |
| #14 | nodeload.patch | 15.46 KB | chx |
| #8 | node_load_4.patch | 15.31 KB | chx |
| #7 | node_load_3.patch | 18.95 KB | chx |
Comments
Comment #1
chx commentedComment #2
adrian commentedI am going to +1 this.
node_load(x) is much more natural to type. Having it use an array if found is useful too though.
Comment #3
chx commentedDries, if I remember correctly, you favoured this approach.
Comment #4
chx commentedPHPdoc.
Comment #5
jose reyero commented+1
It's not only about lazy developers -which I am ;-)- it's also about shorter code => less errors, easier to catch
Comment #6
chx commentedThe patch and its consequences makes me love the version at http://drupal.org/node/25634#comment-33584 more, but Dries will be the one to decide.
Comment #7
chx commentedA few things slipped in from another patch which should not be here.
Comment #8
chx commentedSame problem as above.
Comment #9
ezheidtmann commentedI like this! Is there a similar issue for user_load()?
Comment #10
Steven commentedI definitely prefer the version where we simply allow $conditions to be passed as an integer, rather than introducing additional parameters.
It matches PHP's convention of having "mixed" argument types for some functions for shorthands (e.g. str_replace allows array arguments to compact multiple replacements in one statement). And not unimportant: it does not break backwards compatibility for what it essentially syntactic sugar.
Comment #11
chx commentedSteven. Dries did not like that version hence the additional parameter.
Dries, now that even Steven is on my side, would you please reconsider :) ?
Comment #12
adrian commentedI concurr about the mixed parameter.
Comment #13
walkah commentedlet me weigh in +1 on the mixed parameter side ... let's get away from blowing up backwards compatibility unless it's justified and/or unavoidable for the sake of progress. please :)
Comment #14
chx commentedComment #15
chx commentedpoor book module remained unpatched.
Comment #16
chx commentedwrong version.
Comment #17
Stefan Nagtegaal commentedI thought this had hit the trunk some days ago.. Chx, can you or Dries confirm and mark this issue as "Fixed"?
Comment #18
dries commentedThis has been committed. Marking it 'fixed'.
Comment #19
(not verified) commentedComment #20
(not verified) commentedComment #21
ax commentedComment #22
(not verified) commentedComment #23
(not verified) commentedComment #24
(not verified) commented