public function addAttribute(AttributeMetadata $attribute)
    {
        if (isset($this->relationships[$attribute->getKey()])) {
            throw MetadataException::fieldKeyInUse('attribute', 'relationship', $attribute->getKey(), $this->type);
        }
        $this->attributes[$attribute->getKey()] = $attribute;
        ksort($this->attributes);
        return $this;
    }
public function addAttribute(AttributeMetadata $attribute)
    {
        if (isset($this->relationships[$attribute->getKey()])) {
            throw MetadataException::fieldKeyInUse('attribute', 'relationship', $attribute->getKey(), $this->type);
        }
        $this->attributes[$attribute->getKey()] = $attribute;
        ksort($this->attributes);
        return $this;
    }
public function addAttribute ( AttributeMetadata $ attribute ) { if ( isset ( $ this -> relationships [ $ attribute -> getKey ( ) ] ) ) { throw MetadataException :: fieldKeyInUse ( 'attribute' , 'relationship' , $ attribute -> getKey ( ) , $ this -> type ) ; } $ this -> attributes [ $ attribute -> getKey ( ) ] = $ attribute ; ksort ( $ this -> attributes ) ; return $ this ; }
Adds an attribute field to this entity.

@param   AttributeMetadata   $attribute
@return  self
@throws  MetadataException   If the attribute key already exists as a relationship.
Adds an attribute field to this entity .