deleteMetadata() public méthode

If you pass a name, only metadata matching that name will be deleted.
Since: 1.8
public deleteMetadata ( null | string $name = null ) : boolean
$name null | string The name of the metadata to remove.
Résultat boolean
Exemple #1
0
 public function testElggEntityMetadata()
 {
     // let's delete a non-existent metadata
     $this->assertFalse($this->entity->deleteMetadata('important'));
     // let's add the metadata
     $this->entity->important = 'indeed!';
     $this->assertIdentical('indeed!', $this->entity->important);
     $this->entity->less_important = 'true, too!';
     $this->assertIdentical('true, too!', $this->entity->less_important);
     // test deleting incorrectly
     // @link https://github.com/elgg/elgg/issues/2273
     $this->assertNull($this->entity->deleteMetadata('impotent'));
     $this->assertEqual($this->entity->important, 'indeed!');
     // get rid of one metadata
     $this->assertEqual($this->entity->important, 'indeed!');
     $this->assertTrue($this->entity->deleteMetadata('important'));
     $this->assertNull($this->entity->important);
     // get rid of all metadata
     $this->assertTrue($this->entity->deleteMetadata());
     $this->assertNull($this->entity->less_important);
 }