public function optimize (stdClass $data)
    {
        $data->modelDirectory = str_replace ('/http/controllers', '/models', $data->controllerDestination);
        $data->modelNamespace = str_replace ('\\http\\controllers', '\\models', $data->controllerNamespace);

        foreach ($data->database as $dbItem) {
            $dbItem->columns       = $this->getTableColumns ($dbItem->tableName);
            $dbItem->modelLocation = $data->modelDirectory . '/' . $dbItem->modelName . '.php';

            if (isset($dbItem->default) && $dbItem->default)
                if (isset($dbItem->multiLanguage)) {
                    $dbItem->multiLanguage->columns       = $this->getTableColumns ($dbItem->multiLanguage->tableName);
                    $dbItem->multiLanguage->modelName     = $dbItem->modelName . 'Translations';
                    $dbItem->multiLanguage->modelLocation = $data->modelDirectory . '/' . $dbItem->modelName . 'Translations.php';
                }
        }

        //TODO get default model, there can be only one
        $data->mainModel = $data->database[0];

        return $data;
    }
public function optimize (stdClass $data)
    {
        $data->modelDirectory = str_replace ('/http/controllers', '/models', $data->controllerDestination);
        $data->modelNamespace = str_replace ('\\http\\controllers', '\\models', $data->controllerNamespace);

        foreach ($data->database as $dbItem) {
            $dbItem->columns       = $this->getTableColumns ($dbItem->tableName);
            $dbItem->modelLocation = $data->modelDirectory . '/' . $dbItem->modelName . '.php';

            if (isset($dbItem->default) && $dbItem->default)
                if (isset($dbItem->multiLanguage)) {
                    $dbItem->multiLanguage->columns       = $this->getTableColumns ($dbItem->multiLanguage->tableName);
                    $dbItem->multiLanguage->modelName     = $dbItem->modelName . 'Translations';
                    $dbItem->multiLanguage->modelLocation = $data->modelDirectory . '/' . $dbItem->modelName . 'Translations.php';
                }
        }

        //TODO get default model, there can be only one
        $data->mainModel = $data->database[0];

        return $data;
    }
public function optimize ( stdClass $ data ) { $ data -> modelDirectory = str_replace ( '/http/controllers' , '/models' , $ data -> controllerDestination ) ; $ data -> modelNamespace = str_replace ( '\\http\\controllers' , '\\models' , $ data -> controllerNamespace ) ; foreach ( $ data -> database as $ dbItem ) { $ dbItem -> columns = $ this -> getTableColumns ( $ dbItem -> tableName ) ; $ dbItem -> modelLocation = $ data -> modelDirectory . '/' . $ dbItem -> modelName . '.php' ; if ( isset ( $ dbItem -> default ) && $ dbItem -> default ) if ( isset ( $ dbItem -> multiLanguage ) ) { $ dbItem -> multiLanguage -> columns = $ this -> getTableColumns ( $ dbItem -> multiLanguage -> tableName ) ; $ dbItem -> multiLanguage -> modelName = $ dbItem -> modelName . 'Translations' ; $ dbItem -> multiLanguage -> modelLocation = $ data -> modelDirectory . '/' . $ dbItem -> modelName . 'Translations.php' ; } } //TODO get default model, there can be only one $ data -> mainModel = $ data -> database [ 0 ] ; return $ data ; }
Optimizing configuration for models

@param $data
@internal param $item
@internal param $modelData
@return stdClass
Optimizing configuration for models