src/Builder/TypeTableBuilder.php
public function prepareConnectionCreateTableStatement(TypeInterface $source, TypeInterface $target, HasAndBelongsToManyAssociation $association)
    {
        $result = [];

        $result[] = 'CREATE TABLE IF NOT EXISTS ' . $this->getConnection()->escapeTableName($association->getConnectionTableName()) . ' (';

        $left_field_name = $association->getLeftFieldName();
        $right_field_name = $association->getRightFieldName();

        $left_field = (new IntegerField($left_field_name, 0))->unsigned(true)->size($source->getIdField()->getSize());
        $right_field = (new IntegerField($right_field_name, 0))->unsigned(true)->size($target->getIdField()->getSize());

        $result[] = '    ' . $this->prepareFieldStatement($left_field) . ',';
        $result[] = '    ' . $this->prepareFieldStatement($right_field) . ',';
        $result[] = '    ' . $this->prepareIndexStatement(new Index('PRIMARY', [$left_field->getName(), $right_field->getName()], IndexInterface::PRIMARY)) . ',';
        $result[] = '    ' . $this->prepareIndexStatement(new Index($right_field->getName()));

        $result[] = ') ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;';

        return implode("\n", $result);
    }
public function prepareConnectionCreateTableStatement(TypeInterface $source, TypeInterface $target, HasAndBelongsToManyAssociation $association)
    {
        $result = [];

        $result[] = 'CREATE TABLE IF NOT EXISTS ' . $this->getConnection()->escapeTableName($association->getConnectionTableName()) . ' (';

        $left_field_name = $association->getLeftFieldName();
        $right_field_name = $association->getRightFieldName();

        $left_field = (new IntegerField($left_field_name, 0))->unsigned(true)->size($source->getIdField()->getSize());
        $right_field = (new IntegerField($right_field_name, 0))->unsigned(true)->size($target->getIdField()->getSize());

        $result[] = '    ' . $this->prepareFieldStatement($left_field) . ',';
        $result[] = '    ' . $this->prepareFieldStatement($right_field) . ',';
        $result[] = '    ' . $this->prepareIndexStatement(new Index('PRIMARY', [$left_field->getName(), $right_field->getName()], IndexInterface::PRIMARY)) . ',';
        $result[] = '    ' . $this->prepareIndexStatement(new Index($right_field->getName()));

        $result[] = ') ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;';

        return implode("\n", $result);
    }
public function prepareConnectionCreateTableStatement ( TypeInterface $ source , TypeInterface $ target , HasAndBelongsToManyAssociation $ association ) { $ result = [ ] ; $ result [ ] = 'CREATE TABLE IF NOT EXISTS ' . $ this -> getConnection ( ) -> escapeTableName ( $ association -> getConnectionTableName ( ) ) . ' (' ; $ left_field_name = $ association -> getLeftFieldName ( ) ; $ right_field_name = $ association -> getRightFieldName ( ) ; $ left_field = ( new IntegerField ( $ left_field_name , 0 ) ) -> unsigned ( true ) -> size ( $ source -> getIdField ( ) -> getSize ( ) ) ; $ right_field = ( new IntegerField ( $ right_field_name , 0 ) ) -> unsigned ( true ) -> size ( $ target -> getIdField ( ) -> getSize ( ) ) ; $ result [ ] = '    ' . $ this -> prepareFieldStatement ( $ left_field ) . ',' ; $ result [ ] = '    ' . $ this -> prepareFieldStatement ( $ right_field ) . ',' ; $ result [ ] = '    ' . $ this -> prepareIndexStatement ( new Index ( 'PRIMARY' , [ $ left_field -> getName ( ) , $ right_field -> getName ( ) ] , IndexInterface :: PRIMARY ) ) . ',' ; $ result [ ] = '    ' . $ this -> prepareIndexStatement ( new Index ( $ right_field -> getName ( ) ) ) ; $ result [ ] = ') ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;' ; return implode ( "\n" , $ result ) ; }
Prepare create connection table statement.

@param  TypeInterface                  $source
@param  TypeInterface                  $target
@param  HasAndBelongsToManyAssociation $association
@return string
Prepare create connection table statement .