getSingle() public method

Warning: You should always call isLoaded() beforehand to verify that this function's return value can be trusted.
See also: isLoaded
public getSingle ( integer $entity_guid, string $name ) : array | string | integer | null
$entity_guid integer The GUID of the entity
$name string The metadata name
return array | string | integer | null null = value does not exist
Exemplo n.º 1
0
 public function testPopulateFromEntities()
 {
     // test populating cache from set of entities
     $this->obj1->setMetadata($this->name, $this->value);
     $this->obj1->setMetadata($this->name, 4, 'integer', true);
     $this->obj1->setMetadata("{$this->name}-2", "{$this->value}-2");
     $this->obj2->setMetadata($this->name, $this->value);
     $this->cache->clearAll();
     $this->cache->populateFromEntities(array($this->guid1, $this->guid2));
     $this->assertIdentical($this->cache->getSingle($this->guid1, $this->name), [$this->value, 4]);
     $this->assertIdentical($this->cache->getSingle($this->guid1, "{$this->name}-2"), "{$this->value}-2");
     $this->assertIdentical($this->cache->getSingle($this->guid2, $this->name), $this->value);
 }