src/Type.php
public function &addField(FieldInterface $field)
    {
        if (empty($this->fields[$field->getName()])) {
            $this->fields[$field->getName()] = $field;
            $field->onAddedToType($this); // Let the field register indexes, custom behaviour etc
        } else {
            throw new InvalidArgumentException("Field '" . $field->getName() . "' already exists in this type");
        }

        return $this;
    }
public function &addField(FieldInterface $field)
    {
        if (empty($this->fields[$field->getName()])) {
            $this->fields[$field->getName()] = $field;
            $field->onAddedToType($this); // Let the field register indexes, custom behaviour etc
        } else {
            throw new InvalidArgumentException("Field '" . $field->getName() . "' already exists in this type");
        }

        return $this;
    }
public function & addField ( FieldInterface $ field ) { if ( empty ( $ this -> fields [ $ field -> getName ( ) ] ) ) { $ this -> fields [ $ field -> getName ( ) ] = $ field ; $ field -> onAddedToType ( $ this ) ; // Let the field register indexes, custom behaviour etc } else { throw new InvalidArgumentException ( "Field '" . $ field -> getName ( ) . "' already exists in this type" ) ; } return $ this ; }
Add a single field to the type.

@param  FieldInterface $field
@return $this
Add a single field to the type .