W3cubDocs

/Drupal 8

protected function SqlContentEntityStorage::buildPropertyQuery

protected SqlContentEntityStorage::buildPropertyQuery(QueryInterface $entity_query, array $values)

Builds an entity query.

Parameters

\Drupal\Core\Entity\Query\QueryInterface $entity_query: EntityQuery instance.

array $values: An associative array of properties of the entity, where the keys are the property names and the values are the values those properties must have.

Overrides EntityStorageBase::buildPropertyQuery

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php, line 598

Class

SqlContentEntityStorage
A content entity database storage implementation.

Namespace

Drupal\Core\Entity\Sql

Code

protected function buildPropertyQuery(QueryInterface $entity_query, array $values) {
  if ($this->dataTable) {
    // @todo We should not be using a condition to specify whether conditions
    //   apply to the default language. See
    //   https://www.drupal.org/node/1866330.
    // Default to the original entity language if not explicitly specified
    // otherwise.
    if (!array_key_exists($this->defaultLangcodeKey, $values)) {
      $values[$this->defaultLangcodeKey] = 1;
    }
    // If the 'default_langcode' flag is explicitly not set, we do not care
    // whether the queried values are in the original entity language or not.
    elseif ($values[$this->defaultLangcodeKey] === NULL) {
      unset($values[$this->defaultLangcodeKey]);
    }
  }

  parent::buildPropertyQuery($entity_query, $values);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Sql!SqlContentEntityStorage.php/function/SqlContentEntityStorage::buildPropertyQuery/8.1.x