src/CsvMigration.php
private function handleCsv() : void
    {
        $tableName = Inflector::pluralize(Inflector::classify($this->table->getName()));
        $mc = new ModuleConfig(ConfigType::MIGRATION(), $tableName);
        $data = json_encode($mc->parse());
        if (false === $data) {
            $this->log(sprintf('No data found for %s module', $tableName), LogLevel::ERROR);

            return;
        }
        $data = json_decode($data, true);
        $data = array_merge($data, self::$_requiredFields);

        try {
            $tableFields = $this->table->getColumns();
        } catch (PDOException $e) {
            $tableFields = [];
        }

        empty($tableFields) ?
            $this->createFromCsv($data, $tableName) :
            $this->updateFromCsv($data, $tableName, $tableFields);
    }
private function handleCsv() : void
    {
        $tableName = Inflector::pluralize(Inflector::classify($this->table->getName()));
        $mc = new ModuleConfig(ConfigType::MIGRATION(), $tableName);
        $data = json_encode($mc->parse());
        if (false === $data) {
            $this->log(sprintf('No data found for %s module', $tableName), LogLevel::ERROR);

            return;
        }
        $data = json_decode($data, true);
        $data = array_merge($data, self::$_requiredFields);

        try {
            $tableFields = $this->table->getColumns();
        } catch (PDOException $e) {
            $tableFields = [];
        }

        empty($tableFields) ?
            $this->createFromCsv($data, $tableName) :
            $this->updateFromCsv($data, $tableName, $tableFields);
    }
private function handleCsv ( ) : void { $ tableName = Inflector :: pluralize ( Inflector :: classify ( $ this -> table -> getName ( ) ) ) ; $ mc = new ModuleConfig ( ConfigType :: MIGRATION ( ) , $ tableName ) ; $ data = json_encode ( $ mc -> parse ( ) ) ; if ( false === $ data ) { $ this -> log ( sprintf ( 'No data found for %s module' , $ tableName ) , LogLevel :: ERROR ) ; return ; } $ data = json_decode ( $ data , true ) ; $ data = array_merge ( $ data , self :: $ _requiredFields ) ; try { $ tableFields = $ this -> table -> getColumns ( ) ; } catch ( PDOException $ e ) { $ tableFields = [ ] ; } empty ( $ tableFields ) ? $ this -> createFromCsv ( $ data , $ tableName ) : $ this -> updateFromCsv ( $ data , $ tableName , $ tableFields ) ; }
Apply changes from the JSON file

@return void
Apply changes from the JSON file