Comments

jhodgdon’s picture

Status: Active » Postponed (maintainer needs more info)

What problem did you find that you want to point out here?

iccle’s picture

Hmm i thought i posted my question here, apparently not, basically my question is regarding the documentation for the $conditions parameter, $conditions An array of conditions in the form 'field' => $value. I assume that this means conditions of equality? ie, if i implement this class then i should allow for testing of equality on any fields i provide?, to what extent does the drupal framework use these conditions?

jhodgdon’s picture

Status: Postponed (maintainer needs more info) » Active
Issue tags: +Novice

Yes, equality. We should probably make that clearer in the doc. Good project for a novice doc patch contributor...

iccle’s picture

Thanks, and if only i knew how... and was not on a windows machine with unreliable patch...

iccle’s picture

Well i created an issue for a request to update the documentation, i hope i did it correctly ;)

http://drupal.org/node/1090210

jhodgdon’s picture

Title: Documentation problem with DrupalEntityControllerInterface::load » DrupalEntityControllerInterface::load - doc needs to clarify $conditions

This issue here is already a request to update the documentation. We don't really need two. I've closed the other issue as a duplicate.

jhodgdon’s picture

From that other issue -- suggested change is:

$conditions An array of conditions in the form 'field' => $value where each 'field' is tested for equality against the corrisponding $value.

Aside from the spelling of corresponding, and I'm not sure about 'field' vs. $value, something like this makes sense. Still needs a patch...

By the way, it's definitely possible to make patches on Windows. I did it for several years, though I'm not using Windows at this time.... There are instructions in http://drupal.org/documentation/git and subpages

iccle’s picture

Nice docs, thanks :}

drewish’s picture

Status: Active » Needs review

We should also update DrupalEntityControllerInterface::buildQuery since it has basically the same documentation.

What do people think about this? I felt it was important to make it clear that the conditions must be on the base table and are ANDed together.

   * @param $conditions
   *   An array of conditions. Keys are field names on the entity's base table.
   *   Values will be compared for equality. All the comparisons will be ANDed
   *   together.
jhodgdon’s picture

Status: Needs review » Active

That looks reasonable to me. Just needs a patch...

fago’s picture

>Values will be compared for equality.

That's not entirely true. If you pass an array as value, DB-TNG and so entity-load will default to use the operator IN for comparison.

In that regard I think core also suffers the problem I noted in #1008324-5: problem applying conditions with an array as value, thus cacheGet() would fail to apply the same condition. entity_load() would continue with loading the entity from the DB then, though.

damien tournoud’s picture

Status: Active » Needs work

>Values will be compared for equality.

That's not entirely true. If you pass an array as value, DB-TNG and so entity-load will default to use the operator IN for comparison.

Debatable. As far as I know, it was never the intent of the Entity API to support array conditions. The fact that it works by chance when the hitting the DB query directly does not mean it is supported.

Also, we need to add there that $conditions is deprecated in favor of EntityFieldQuery.

starsinmypockets’s picture

If folks can agree on the update I can roll the patch :)

fago’s picture

>The fact that it works by chance when the hitting the DB query directly does not mean it is supported.

Indeed, but one really cannot know as it's un-documented. I think, fixing it to work like #9 makes sense as it makes things clear - but this might break some existing code...

star-szr’s picture

Version: 7.x-dev » 8.x-dev
Status: Needs work » Active

In D8, it looks like DrupalEntityControllerInterface::load has moved to EntityStorageControllerInterface::load, while DrupalEntityControllerInterface::buildQuery has moved to DatabaseStorageController::buildQuery.

Setting to active until we get a patch as per http://drupal.org/node/156119.

berdir’s picture

#1184272: Remove deprecated $conditions support from entity controller removes conditions, but probably needs better docs as well.

filijonka’s picture

Version: 8.0.x-dev » 7.x-dev
Issue summary: View changes
zealfire’s picture

Assigned: Unassigned » zealfire
Status: Active » Needs review
StatusFileSize
new1.17 KB

Submitting a patch taking into consideration comments 9 and 7.Now a further discussion can take place so as to decide what needs to be updated in this patch.
Thanks.

jhodgdon’s picture

Status: Needs review » Needs work

I am not sure why the current patch has two different versions of the documentation for those two different classes? Let's make them the same. Then we need to address #12 and suggest people use an entity query instead of these methods anyway.

zealfire’s picture

Submitting the patch along with a interdiff file.Please review.
Thanks.

zealfire’s picture

Status: Needs work » Needs review
jhodgdon’s picture

Status: Needs review » Needs work

Almost there!

The only problem I can see now is that EntityFieldQuery is a class, not a function. So I think I would say "... deprecated; use an EntityFieldQuery instead."; maybe you can come up with better wording? In any case, it shouldn't have () after it.

zealfire’s picture

Status: Needs work » Needs review
StatusFileSize
new1.33 KB
new1.07 KB

Submitting a patch with an interdiff file.Please review.
Thanks.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

This looks reasonable to me. Provisionally setting to RTBC pending any further reviews. Thanks!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 23: revised-changed-in-entity-1081902-23.patch, failed testing.

filijonka’s picture

Status: Needs work » Reviewed & tested by the community

testboot hickup setting rtbc per #24

jhodgdon’s picture

Status: Reviewed & tested by the community » Fixed

Thanks again! Committed to 7.x.

  • jhodgdon committed 9b993d5 on 7.x
    Issue #1081902 by zealfire: DrupalEntityControllerInterface::load - doc...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.