[drupal-devel] [feature] Allow node_load($nid)

chx drupal-devel at drupal.org
Sun Jul 17 18:07:28 UTC 2005


Issue status update for 
http://drupal.org/node/25634
Post a follow up: 
http://drupal.org/project/comments/add/25634

 Project:      Drupal
 Version:      cvs
 Component:    node system
 Category:     feature requests
 Priority:     normal
 Assigned to:  chx
 Reported by:  chx
 Updated by:   chx
 Status:       patch
 Attachment:   http://drupal.org/files/issues/nodeload.patch (15.46 KB)




chx



Previous comments:
------------------------------------------------------------------------

1119551855 : chx

Attachment: http://drupal.org/files/issues/node_load.patch (2.23 KB)

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.




------------------------------------------------------------------------

1119552118 : chx

Attachment: http://drupal.org/files/issues/node_load_0.patch (2.23 KB)




------------------------------------------------------------------------

1119552818 : adrian

I 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.




------------------------------------------------------------------------

1120237219 : chx

Attachment: http://drupal.org/files/issues/node_load_1.patch (27.89 KB)

Dries, if I remember correctly, you favoured this approach.




------------------------------------------------------------------------

1120237631 : chx

Attachment: http://drupal.org/files/issues/node_load_2.patch (27.97 KB)

PHPdoc.




------------------------------------------------------------------------

1120238082 : Jose A Reyero

+1
It's not only about lazy developers -which I am ;-)- it's also about
shorter code => less errors, easier to catch




------------------------------------------------------------------------

1120238246 : chx

The 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.




------------------------------------------------------------------------

1120239063 : chx

Attachment: http://drupal.org/files/issues/node_load_3.patch (18.95 KB)

A few things slipped in from another patch which should not be here.




------------------------------------------------------------------------

1120239220 : chx

Attachment: http://drupal.org/files/issues/node_load_4.patch (15.31 KB)

Same problem as above.




------------------------------------------------------------------------

1121404235 : clydefrog

I like this! Is there a similar issue for user_load()?




------------------------------------------------------------------------

1121495601 : Steven

I 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.




------------------------------------------------------------------------

1121500736 : chx

Steven. Dries did not like that version hence the additional parameter.


Dries, now that even Steven is on my side, would you please reconsider
:) ?




------------------------------------------------------------------------

1121504460 : adrian

I concurr about the mixed parameter.




------------------------------------------------------------------------

1121518557 : walkah

let 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 :)







More information about the drupal-devel mailing list