protected function EntityAPIControllerExportable::applyConditions in Entity API 7
2 calls to EntityAPIControllerExportable::applyConditions()
- EntityAPIControllerExportable::cacheGet in includes/entity.controller.inc
- Overridden.
- EntityAPIControllerExportable::cacheGetByName in includes/entity.controller.inc
- Like cacheGet() but keyed by name.
File
- includes/entity.controller.inc, line 800
- Provides a controller building upon the core controller but providing more
features like full CRUD functionality.
Class
- EntityAPIControllerExportable
- A controller implementing exportables stored in the database.
Code
protected function applyConditions($entities, $conditions = array()) {
if ($conditions) {
foreach ($entities as $key => $entity) {
$entity_values = (array) $entity;
foreach ($conditions as $condition_key => $condition_value) {
if (is_array($condition_value)) {
if (!isset($entity_values[$condition_key]) || !in_array($entity_values[$condition_key], $condition_value)) {
unset($entities[$key]);
}
}
elseif (!isset($entity_values[$condition_key]) || $entity_values[$condition_key] != $condition_value) {
unset($entities[$key]);
}
}
}
}
return $entities;
}