public function writeForeignKeysOut($index, OutputInterface $output = null, $force = false)
    {
        if ($this->status !== self::STATUS_RECURSIVE_FOREIGN_KEY) {
            return;
        }

        $class = studly_case('add_foreign_keys_to_' . snake_case($this->table->getTableName()) . '_table');

        $fileName = date('Y_m_d_') . str_pad($index, 6, '0', STR_PAD_LEFT) . '_' . snake_case($class) . '.php';

        $this->writeToFileFromTemplate($this->path . '/' . $fileName, 'migrationAddForeignKey', $output, [
            'className'         => $class,
            'tableName'         => snake_case($this->table->getTableName()),
            'createForeignKeys' => $this->table->renderCreateForeignKeys(),
            'dropForeignKeys'   => $this->table->renderDropForeignKeys(),
        ], $force);
    }
public function writeForeignKeysOut($index, OutputInterface $output = null, $force = false)
    {
        if ($this->status !== self::STATUS_RECURSIVE_FOREIGN_KEY) {
            return;
        }

        $class = studly_case('add_foreign_keys_to_' . snake_case($this->table->getTableName()) . '_table');

        $fileName = date('Y_m_d_') . str_pad($index, 6, '0', STR_PAD_LEFT) . '_' . snake_case($class) . '.php';

        $this->writeToFileFromTemplate($this->path . '/' . $fileName, 'migrationAddForeignKey', $output, [
            'className'         => $class,
            'tableName'         => snake_case($this->table->getTableName()),
            'createForeignKeys' => $this->table->renderCreateForeignKeys(),
            'dropForeignKeys'   => $this->table->renderDropForeignKeys(),
        ], $force);
    }
public function writeForeignKeysOut ( $ index , OutputInterface $ output = null , $ force = false ) { if ( $ this -> status !== self :: STATUS_RECURSIVE_FOREIGN_KEY ) { return ; } $ class = studly_case ( 'add_foreign_keys_to_' . snake_case ( $ this -> table -> getTableName ( ) ) . '_table' ) ; $ fileName = date ( 'Y_m_d_' ) . str_pad ( $ index , 6 , '0' , STR_PAD_LEFT ) . '_' . snake_case ( $ class ) . '.php' ; $ this -> writeToFileFromTemplate ( $ this -> path . '/' . $ fileName , 'migrationAddForeignKey' , $ output , [ 'className' => $ class , 'tableName' => snake_case ( $ this -> table -> getTableName ( ) ) , 'createForeignKeys' => $ this -> table -> renderCreateForeignKeys ( ) , 'dropForeignKeys' => $ this -> table -> renderDropForeignKeys ( ) , ] , $ force ) ; }
Render migration add foreign keys to table class and write out to file

@param int                                                    $index  migration file index
@param \Symfony\Component\Console\Output\OutputInterface|null $output command line output
@param bool                                                   $force  force overwrite existing models or not
Render migration add foreign keys to table class and write out to file