src/CodeGeneration/Generator/Field/FieldGenerator.php
public function generateField(
        string $fieldFqn,
        string $fieldType,
        ?string $phpType = null,
        $defaultValue = null,
        bool $isUnique = false
    ): string {
        $this->validateArguments($fieldFqn, $fieldType, $phpType);
        $this->setupClassProperties($fieldFqn, $fieldType, $phpType, $defaultValue, $isUnique);

        $this->pathHelper->ensurePathExists($this->fieldsPath);
        $this->pathHelper->ensurePathExists($this->fieldsInterfacePath);

        $this->assertFileDoesNotExist($this->getTraitPath(), 'Trait');
        $this->assertFileDoesNotExist($this->getInterfacePath(), 'Interface');

        if (true === $this->isArchetype) {
            return $this->createFieldFromArchetype();
        }

        return $this->createDbalField();
    }
public function generateField(
        string $fieldFqn,
        string $fieldType,
        ?string $phpType = null,
        $defaultValue = null,
        bool $isUnique = false
    ): string {
        $this->validateArguments($fieldFqn, $fieldType, $phpType);
        $this->setupClassProperties($fieldFqn, $fieldType, $phpType, $defaultValue, $isUnique);

        $this->pathHelper->ensurePathExists($this->fieldsPath);
        $this->pathHelper->ensurePathExists($this->fieldsInterfacePath);

        $this->assertFileDoesNotExist($this->getTraitPath(), 'Trait');
        $this->assertFileDoesNotExist($this->getInterfacePath(), 'Interface');

        if (true === $this->isArchetype) {
            return $this->createFieldFromArchetype();
        }

        return $this->createDbalField();
    }
public function generateField ( string $ fieldFqn , string $ fieldType , ? string $ phpType = null , $ defaultValue = null , bool $ isUnique = false ) : string { $ this -> validateArguments ( $ fieldFqn , $ fieldType , $ phpType ) ; $ this -> setupClassProperties ( $ fieldFqn , $ fieldType , $ phpType , $ defaultValue , $ isUnique ) ; $ this -> pathHelper -> ensurePathExists ( $ this -> fieldsPath ) ; $ this -> pathHelper -> ensurePathExists ( $ this -> fieldsInterfacePath ) ; $ this -> assertFileDoesNotExist ( $ this -> getTraitPath ( ) , 'Trait' ) ; $ this -> assertFileDoesNotExist ( $ this -> getInterfacePath ( ) , 'Interface' ) ; if ( true === $ this -> isArchetype ) { return $ this -> createFieldFromArchetype ( ) ; } return $ this -> createDbalField ( ) ; }
Generate a new Field based on a property name and Doctrine Type or Archetype field FQN

@see MappingHelper::ALL_DBAL_TYPES for the full list of Dbal Types

@param string      $fieldFqn
@param string      $fieldType
@param null|string $phpType

@param mixed       $defaultValue
@param bool        $isUnique

@return string - The Fully Qualified Name of the generated Field Trait

@throws DoctrineStaticMetaException
@throws \ReflectionException
@SuppressWarnings(PHPMD.StaticAccess)
@SuppressWarnings(PHPMD.BooleanArgumentFlag)
Generate a new Field based on a property name and Doctrine Type or Archetype field FQN