Übersetzungen dieser Seite:
  • de

Back to Yii2 Overview

Yii Framework Website

This page describes some interesting coded solutions within the Yii Framework website.

Migrations

  • All migrations extend from migrations/BaseMigration.php
  • Migration Template: migrations/migration_template.php
config/console.php
<?php
return [
    ...
    'controllerMap' => [
        'migrate' => [
            'class' => yii\console\controllers\MigrateController::class,
            // use custom migration template
            'templateFile' => '@app/migrations/migration_template.php',
    ...
];

Custom Formatter

The custom formatter overrides the default formatter, adding extra features.

config/web.php
<?php
return [
    ...
    'components' => [
        'formatter' => [
            'class' => app\components\Formatter::class,
            'thousandSeparator' => '&thinsp;',
        ],
    ....

Data Imports

The Import command uses a second DB connection for the source database during import.

WebUser Behavior