Révision 4444412d
Ajouté par Julien Enselme il y a presque 10 ans
drupal7/includes/entity.inc | ||
---|---|---|
360 | 360 |
// This ensures the same behavior whether loading from memory or database. |
361 | 361 |
if ($conditions) { |
362 | 362 |
foreach ($entities as $entity) { |
363 |
$entity_values = (array) $entity; |
|
364 |
if (array_diff_assoc($conditions, $entity_values)) { |
|
365 |
unset($entities[$entity->{$this->idKey}]); |
|
363 |
// Iterate over all conditions and compare them to the entity |
|
364 |
// properties. We cannot use array_diff_assoc() here since the |
|
365 |
// conditions can be nested arrays, too. |
|
366 |
foreach ($conditions as $property_name => $condition) { |
|
367 |
if (is_array($condition)) { |
|
368 |
// Multiple condition values for one property are treated as OR |
|
369 |
// operation: only if the value is not at all in the condition array |
|
370 |
// we remove the entity. |
|
371 |
if (!in_array($entity->{$property_name}, $condition)) { |
|
372 |
unset($entities[$entity->{$this->idKey}]); |
|
373 |
continue 2; |
|
374 |
} |
|
375 |
} |
|
376 |
elseif ($condition != $entity->{$property_name}) { |
|
377 |
unset($entities[$entity->{$this->idKey}]); |
|
378 |
continue 2; |
|
379 |
} |
|
366 | 380 |
} |
367 | 381 |
} |
368 | 382 |
} |
Formats disponibles : Unified diff
Update drupal 7.27 -> 7.28