getSingleValueIndex() публичный Метод

If the key does not exist, null should be returned.
public getSingleValueIndex ( string $key ) : string | null
$key string
Результат string | null
Пример #1
0
 /**
  * Retrieve an entity by an index
  *
  * @param string $class_name
  * @param string $index_name
  * @param string $index_key
  * @param bool   $use_cache
  * @return object
  */
 public function retrieveByIndex($class_name, $index_name, $index_key, $use_cache = true)
 {
     $metadata = $this->mapper->getEntityMetadata($class_name);
     $index = $metadata->getIndexByName($index_name);
     if (!$index) {
         throw new InvalidArgumentException('Index "' . $index_name . '" is not valid');
     }
     $id = $this->driver->getSingleValueIndex($this->key_scheme->getIndexKey($index, $index_key));
     if (!$id) {
         throw new NotFoundException('Index "' . $index_key . '" not found');
     }
     return $this->retrieve($class_name, $id, $use_cache);
 }