Method that is called when field is added to a type.

@param TypeInterface $type
346115
public function onAddedToType(TypeInterface &$type)
    {
        parent::onAddedToType($type);

        if ($this->getAddIndex()) {
            $type->addIndex(new Index($this->name));
        }

        $type->addTrait(CreatedAtInterface::class, CreatedAtInterfaceImplementation::class)->serialize($this->name);
    }
40665
public function add($type, $listener)
    {
        if (!array_key_exists($type, $this->_eventListeners)) {
            $this->_eventListeners [$type] = [];
        }
        array_push($this->_eventListeners[$type], $listener);
    }
1292549
public function setType( $type )
	{
		if ( $type == $this->getType() ) { return; }

		$this->_checkType( $type );

		$this->_values['type'] = (string) $type;
		$this->setModified();
	}
199136
private function resolveType(FormTypeInterface $type)
    {
        $typeExtensions = [];
        $parentType = $type->getParent();
        $fqcn = \get_class($type);

        if (isset($this->checkedTypes[$fqcn])) {
            $types = implode(' > ', array_merge(array_keys($this->checkedTypes), [$fqcn]));
            throw new LogicException(sprintf('Circular reference detected for form type "%s" (%s).', $fqcn, $types));
        }

        $this->checkedTypes[$fqcn] = true;

        try {
            foreach ($this->extensions as $extension) {
                $typeExtensions = array_merge(
                    $typeExtensions,
                    $extension->getTypeExtensions($fqcn)
                );
            }

            return $this->resolvedTypeFactory->createResolvedType(
                $type,
                $typeExtensions,
                $parentType ? $this->getType($parentType) : null
            );
        } finally {
            unset($this->checkedTypes[$fqcn]);
        }
    }
722706
public function addFieldType($name, Field\FieldInterface $field)
    {
        $this->setHandler($name, $field);
        $this->customHandlers[] = $name;
        $this->boltConfig->getFields()->addField($field);
    }
986411
public function asType(Type $type)
    {
        if ($this->nullable) {
            $type = $type->nullable();
        }

        $this->invokeCallback($type);

        if ($this->indexName) {
            if ($this->isUnique) {
                $this->definition->unique($this->indexName)->on($this->name);
            } else {
                $this->definition->index($this->indexName)->on($this->name);
            }
        }
    }
1210091
public function setType($parameterIndex, ObjectTypeInterface $type)
    {
        $this->setParameter($parameterIndex, $this->escape($type->getQueryName()));
    }
1113946
private function validateFieldCompatibility(FieldDefinition $interface, FieldDefinition $object): void
    {
        $this->getValidator(Inheritance::class)->validate($object, $interface);

        $this->validateArgumentExistence($interface, $object);
    }
213564
public static function removeType($type)
    {
        if (!static::hasType($type)) {
            throw TypeException::typeDoesNotExist($type);
        }

        if (isset(static::$mappedTypeInstances[$type])) {
            unset(static::$mappedTypeInstances[$type]);
        }

        unset(static::$mappedTypeClasses[$type]);
    }
97187
public function setType($type)
    {
      if(!is_string($type) || strlen(trim($type)) == 0)
        throw new InvalidArgumentException(__METHOD__ . '; Invalid type, must be a non empty string');

      $this->type = $type;
    }
865371
public function onAddedToType(TypeInterface &$type)
    {
        parent::onAddedToType($type);

        if ($this->getAddIndex()) {
            $type->addIndex(new Index($this->name));
        }

        $type->addTrait(PositionInterface::class, PositionInterfaceImplementation::class);
    }
559459
public function addChange(
        string $field,
        $value,
        int $type = self::TYPE_VALUE
    ): self {
        $this->changes[] = [
            'field' => $field,
            'type' => $type,
            'value' => $value,
        ];

        return $this;
    }
728541
protected function addContentTypeFieldsToForm($contentTypeFields, FormInterface $form)
    {
        /** @var FieldTypeInterface $contentTypeField */
        foreach ($contentTypeFields as $contentTypeField) {

            if (isset($this->fieldTypesConfiguration[$contentTypeField->getType()])) {
                $this->addFieldToForm($contentTypeField, $form);
            }
        }
    }
157895
public function register(TypeInterface $type)
    {
        if (isset($this->types[$name = $type->getName()])) {
            throw new \RuntimeException("Slide type '$name' is already registered.");
        }

        $this->types[$name] = $type;

        return $this;
    }
1338049
public function created(EntryInterface $entry)
    {
        $this->commands->dispatch(new CreateTypeStream($entry));

        parent::created($entry);
    }
692620
public function addType(DefinitionInterface $type): Endpoint
    {
        if ($this->hasType($type->getName())) {
            throw new \RuntimeException(sprintf('Duplicate definition for type with name "%s"', $type->getName()));
        }
        $this->types[$type->getName()] = $type;

        if ($type instanceof InterfaceDefinition) {
            $this->interfaces[$type->getName()] = $type;
        }

        if ($type instanceof ClassAwareDefinitionInterface) {
            if ($type->getClass()) {
                $class = $type->getClass();
                //all classes are saved without \ at the beginning
                $class = preg_replace('/^\\\\/', null, $class);
                $this->typeMap[$type->getName()] = $class;
            }
        }

        return $this;
    }
244265
public function setType($type)
    {
        if ($this->formHelper->getFieldType($type)) {
            $this->type = $type;
        }

        return $this;
    }