public function addField(Field $field)
    {
        $name = $field->getName();
        if (array_key_exists($name, $this->fields)) {
            throw new DuplicateFieldNameException($name);
        }
        $this->fields[$name] = $field;
        foreach ($field->getAliases() as $alias) {
            if (array_key_exists($alias, $this->fieldAliases)) {
                throw new DuplicateFieldAliasException($alias);
            }
            $this->fieldAliases[$alias] = $name;
        }

        return $this;
    }
public function addField(Field $field)
    {
        $name = $field->getName();
        if (array_key_exists($name, $this->fields)) {
            throw new DuplicateFieldNameException($name);
        }
        $this->fields[$name] = $field;
        foreach ($field->getAliases() as $alias) {
            if (array_key_exists($alias, $this->fieldAliases)) {
                throw new DuplicateFieldAliasException($alias);
            }
            $this->fieldAliases[$alias] = $name;
        }

        return $this;
    }
public function addField ( Field $ field ) { $ name = $ field -> getName ( ) ; if ( array_key_exists ( $ name , $ this -> fields ) ) { throw new DuplicateFieldNameException ( $ name ) ; } $ this -> fields [ $ name ] = $ field ; foreach ( $ field -> getAliases ( ) as $ alias ) { if ( array_key_exists ( $ alias , $ this -> fieldAliases ) ) { throw new DuplicateFieldAliasException ( $ alias ) ; } $ this -> fieldAliases [ $ alias ] = $ name ; } return $ this ; }
Define a field

@param \sndsgd\Field $field The field to define
@return \sndsgd\field\Collection
Define a field