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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chx’s picture

FileSize
2.23 KB
adrian’s picture

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.

chx’s picture

FileSize
27.89 KB

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

chx’s picture

FileSize
27.97 KB

PHPdoc.

Jose Reyero’s picture

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

chx’s picture

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.

chx’s picture

FileSize
18.95 KB

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

chx’s picture

FileSize
15.31 KB

Same problem as above.

ezheidtmann’s picture

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

Steven’s picture

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.

chx’s picture

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

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

adrian’s picture

I concurr about the mixed parameter.

walkah’s picture

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

chx’s picture

FileSize
15.46 KB
chx’s picture

FileSize
18.98 KB

poor book module remained unpatched.

chx’s picture

FileSize
18.15 KB

wrong version.

Stefan Nagtegaal’s picture

I thought this had hit the trunk some days ago.. Chx, can you or Dries confirm and mark this issue as "Fixed"?

Dries’s picture

Status: Needs review » Fixed

This has been committed. Marking it 'fixed'.

Anonymous’s picture

Anonymous’s picture

ax’s picture

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Status: Fixed » Closed (fixed)