public function addField(Field $field, Key $key = null)
    {
        if (null !== $key) {
            $field->setKey($key);
        }
        
        $this->fields[$field->getName()] = $field;

        return $this;
    }
public function addField(Field $field, Key $key = null)
    {
        if (null !== $key) {
            $field->setKey($key);
        }
        
        $this->fields[$field->getName()] = $field;

        return $this;
    }
public function addField ( Field $ field , Key $ key = null ) { if ( null !== $ key ) { $ field -> setKey ( $ key ) ; } $ this -> fields [ $ field -> getName ( ) ] = $ field ; return $ this ; }
Add field.

@param Field $field
@param Key $key
@return $this
Add field .