From 5563ac12d67fdce4ab0da7f7126f82f20c4dd05e Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 22 Oct 2025 14:33:45 +0300 Subject: [PATCH 01/16] Working with databases --- guide/en/start/databases.md | 148 +++++++++++++++++++++++++++++++++++- 1 file changed, 146 insertions(+), 2 deletions(-) diff --git a/guide/en/start/databases.md b/guide/en/start/databases.md index 661ca81..1d9ff3d 100644 --- a/guide/en/start/databases.md +++ b/guide/en/start/databases.md @@ -15,11 +15,155 @@ For non-relational ones, there are usually official libraries available: - [Redis](https://redis.io/docs/clients/#php) - ... -In this guide, we will focus on working with relational databases using Yii DB. +In this guide, we will focus on working with relational databases using Yii DB. We'll use PostgreSQL to implement a +simple CRUD (create read update delete). + +## Installing PostgreSQL + +You need to install PostgreSQL. If you prefer not to use Docker, +[get the installer from official website](https://www.postgresql.org/download/), install it and create a database. + +If you use Docker, it is a bit simpler. Modify `docker/dev/compose.yml`: + + +```yaml +services: + app: + build: + dockerfile: docker/Dockerfile + context: .. + target: dev + args: + USER_ID: ${UID} + GROUP_ID: ${GID} + env_file: + - path: ./dev/.env + - path: ./dev/override.env + required: false + ports: + - "${DEV_PORT:-80}:80" + volumes: + - ../:/app + - ../runtime:/app/runtime + - caddy_data:/data + - caddy_config:/config + tty: true + depends_on: + db: + condition: service_healthy + + db: + image: postgres:${POSTGRES_VERSION:-15}-alpine + environment: + POSTGRES_DB: app + POSTGRES_PASSWORD: password + POSTGRES_USER: user + volumes: + - ./runtime/db:/var/lib/postgresql/data:rw + ports: + - "${DEV_DB_PORT:-5432}:5432" + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U user -d app" ] + interval: 5s + timeout: 5s + retries: 5 + +volumes: + db: +``` + +Note that we add `depends_on` so application waits for database to be up. + +Also, we'll need a `pdo_pgsql` extension to communicate with PostgreSQL. You can enable it locally in `php.ini`. +If you use Docker, check `docker/Dockerfile` and add `pdo_pgsql` in `install-php-extensions` list. Then rebuild +PHP image with `make build && make down && make up`. ## Configuring connection -## Creating and applying migration +Now that we have the database, it's time to define the connection. We need a package to be installed first: + +```sh +composer require yiisoft/db-pgsql +``` + +Now create `config/common/di/db-pgsql.php`: + +```php + [ + 'class' => Connection::class, + '__construct()' => [ + 'driver' => new Driver( + $params['yiisoft/db-pgsql']['dsn'], + $params['yiisoft/db-pgsql']['username'], + $params['yiisoft/db-pgsql']['password'], + ), + ], + ], +]; +``` + +And define parameters in `config/common/params.php`. For Docker that would be: + +```php +use Yiisoft\Db\Pgsql\Dsn; + +return [ + // ... + 'yiisoft/db-pgsql' => [ + 'dsn' => (new Dsn('pgsql', 'db', 'app', '5432'))->asString(), + 'username' => 'user', + 'password' => 'password', + ], +]; +``` + +`db` host is resolved automatically within the Docker network. + +For local installation without Docker the host in Dsn would be `localhost`. You'll have to adjust the rest to match +how you configured the database. + +## Creating and applying migrations + +For the initial state of the application and for further database changes, it is a good idea to use migrations. These +are files creating changes to be applied to the database. Which are applied is tracked in the same database so we always +know which state is it now and what is to be applied. + +To use migrations we need another package installed: + +```sh +composer require yiisoft/db-migration +``` + +And a directory to store migrations such as `migrations` right in the project root. + +Now you can use `yii migrate:create user` to create a new migration. For our example we need a `page` table with some +columns: + +```php + +public function up(MigrationBuilder $b): void +{ + $b->createTable('page', [ + 'id' => $b->primaryKey(), + 'title' => $b->string()->notNull(), + 'text' => $b->text()->notNull(), + 'created_at' => $b->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'), + 'updated_at' => $b->dateTime(), + 'deleted_at' => $b->dateTime(), + ]); +} +``` + +Apply it with `yii migrate:up`. ## Inserting From 0a33da4feeda818baaf4c914a13f544831bc8889 Mon Sep 17 00:00:00 2001 From: samdark <47294+samdark@users.noreply.github.com> Date: Wed, 22 Oct 2025 11:35:45 +0000 Subject: [PATCH 02/16] Update translation --- _translations/guide/po/es/README.md.po | 684 ++++++++++------- .../guide/po/es/databases_db-migrations.md.po | 6 +- _translations/guide/po/es/glossary.md.po | 18 +- .../guide/po/es/intro_upgrade-from-v2.md.po | 99 +-- .../guide/po/es/start_databases.md.po | 241 +++++- _translations/guide/po/id/README.md.po | 688 +++++++++++------- .../guide/po/id/databases_db-migrations.md.po | 6 +- _translations/guide/po/id/glossary.md.po | 18 +- .../guide/po/id/intro_upgrade-from-v2.md.po | 99 +-- .../guide/po/id/start_databases.md.po | 242 +++++- _translations/guide/po/ru/README.md.po | 521 +++++++------ .../guide/po/ru/databases_db-migrations.md.po | 6 +- _translations/guide/po/ru/glossary.md.po | 18 +- .../guide/po/ru/intro_upgrade-from-v2.md.po | 99 +-- .../guide/po/ru/start_databases.md.po | 243 ++++++- _translations/guide/pot/README.md.pot | 520 ++++++------- .../guide/pot/databases_db-migrations.md.pot | 6 +- _translations/guide/pot/glossary.md.pot | 26 +- .../guide/pot/intro_upgrade-from-v2.md.pot | 99 +-- .../guide/pot/start_databases.md.pot | 265 ++++++- guide/es/README.md | 338 ++++----- guide/es/glossary.md | 25 +- guide/es/start/databases.md | 155 +++- guide/id/README.md | 340 ++++----- guide/id/glossary.md | 25 +- guide/id/start/databases.md | 155 +++- guide/ru/README.md | 335 ++++----- guide/ru/glossary.md | 25 +- guide/ru/start/databases.md | 155 +++- 29 files changed, 3395 insertions(+), 2062 deletions(-) diff --git a/_translations/guide/po/es/README.md.po b/_translations/guide/po/es/README.md.po index b2c1c56..4c646b7 100644 --- a/_translations/guide/po/es/README.md.po +++ b/_translations/guide/po/es/README.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" -"POT-Creation-Date: 2025-10-19 11:32+0000\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: 2025-09-05 13:17+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -28,618 +28,738 @@ msgstr "La Guía Definitiva de Yii 3.0" msgid "We release this guide under the [Terms of Yii Documentation](https://www.yiiframework.com/license#docs)." msgstr "Esta guía se publica bajo los [Términos de documentación de Yii](https://www.yiiframework.com/license#docs))." -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Introduction +" +#, fuzzy, no-wrap +#| msgid "Introduction +" +msgid "Introduction" msgstr "Introducción" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[About Yii](intro/what-is-yii.md) +" +#, fuzzy +#| msgid "[About Yii](intro/what-is-yii.md) +" +msgid "[About Yii](intro/what-is-yii.md)" msgstr "[Acerca de Yii](intro/what-is-yii.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Upgrading from version 2.0](intro/upgrade-from-v2.md) +" +#, fuzzy +#| msgid "[Upgrading from version 2.0](intro/upgrade-from-v2.md) +" +msgid "[Upgrading from version 2.0](intro/upgrade-from-v2.md)" msgstr "[Actualizar desde la Version 2.0](intro/upgrade-from-v2.md)" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Getting started -" +#, fuzzy, no-wrap +#| msgid "Getting started -" +msgid "Getting started" msgstr "Primeros Pasos" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[What do you need to know?](start/prerequisites.md) +" +#, fuzzy +#| msgid "[What do you need to know?](start/prerequisites.md) +" +msgid "[What do you need to know?](start/prerequisites.md)" msgstr "[Qué Necesitas Saber](start/prerequisites.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Creating a project](start/creating-project.md) +" +msgid "[Creating a project](start/creating-project.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Running applications](start/workflow.md) +" +#, fuzzy +#| msgid "[Running applications](start/workflow.md) +" +msgid "[Running applications](start/workflow.md)" msgstr "[Ejecutando Aplicaciones](start/workflow.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Saying hello](start/hello.md) +" +#, fuzzy +#| msgid "[Saying hello](start/hello.md) +" +msgid "[Saying hello](start/hello.md)" msgstr "[Hola Mundo](start/hello.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Working with forms](start/forms.md) +" +#, fuzzy +#| msgid "[Working with forms](start/forms.md) +" +msgid "[Working with forms](start/forms.md)" msgstr "[Trabajar con Formularios](start/forms.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Working with databases](start/databases.md) !" +#, fuzzy +#| msgid "[Working with databases](start/databases.md) !" +msgid "[Working with databases](start/databases.md) TODO" msgstr "[Trabajar con Bases de Datos](start/databases.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Generating code with Gii](start/gii.md) -" +#, fuzzy +#| msgid "[Generating code with Gii](start/gii.md) -" +msgid "[Generating code with Gii](start/gii.md) TODO" msgstr "[Generación de Código con Gii](start/gii.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Looking ahead](start/looking-ahead.md) +" +#, fuzzy +#| msgid "[Looking ahead](start/looking-ahead.md) +" +msgid "[Looking ahead](start/looking-ahead.md)" msgstr "[Adentrarse en Yii](start/looking-ahead.md)" -#. type: Plain text -#: ../../guide/en/README.md -msgid "Application structure +" -msgstr "Estructura De Una Aplicación" +#. type: Title ### +#: ../../guide/en/README.md ../../guide/en/intro/upgrade-from-v2.md +#, no-wrap +msgid "Application structure" +msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Application structure overview](structure/overview.md) +" +#, fuzzy +#| msgid "[Application structure overview](structure/overview.md) +" +msgid "[Application structure overview](structure/overview.md)" msgstr "[Información General de Estructura de Una Aplicación](structure/overview.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Entry scripts](structure/entry-script.md) +" +#, fuzzy +#| msgid "[Entry scripts](structure/entry-script.md) +" +msgid "[Entry scripts](structure/entry-script.md)" msgstr "[Scripts de Entrada](structure/entry-script.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Application](structure/application.md) +" +#, fuzzy +#| msgid "[Application](structure/application.md) +" +msgid "[Application](structure/application.md)" msgstr "[Applicación](structure/application.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Service components](structure/service.md) +" +#, fuzzy +#| msgid "[Service components](structure/service.md) +" +msgid "[Service components](structure/service.md)" msgstr "[Componentes de Servicios](structure/service.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Actions](structure/action.md) +" +#, fuzzy +#| msgid "[Actions](structure/action.md) +" +msgid "[Actions](structure/action.md)" msgstr "[Acciones](structure/action.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Domain](structure/domain.md) +" +#, fuzzy +#| msgid "[Domain](structure/domain.md) +" +msgid "[Domain](structure/domain.md)" msgstr "[Dominio](structure/domain.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Middleware](structure/middleware.md) +" +#, fuzzy +#| msgid "[Middleware](structure/middleware.md) +" +msgid "[Middleware](structure/middleware.md)" msgstr "[Lógica de Intercambio (middleware)](structure/middleware.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Packages](structure/package.md) +" +#, fuzzy +#| msgid "[Packages](structure/package.md) +" +msgid "[Packages](structure/package.md)" msgstr "[Paquetes](structure/package.md)" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Key concepts +" +#, fuzzy, no-wrap +#| msgid "Key concepts +" +msgid "Key concepts" msgstr "Conceptos Clave" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Class autoloading](concept/autoloading.md) +" +#, fuzzy +#| msgid "[Class autoloading](concept/autoloading.md) +" +msgid "[Class autoloading](concept/autoloading.md)" msgstr "[Autocarga de Clases (Autoloading)](concept/autoloading.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Dependency injection container](concept/di-container.md) +" +#, fuzzy +#| msgid "[Dependency injection container](concept/di-container.md) +" +msgid "[Dependency injection container](concept/di-container.md)" msgstr "[Contenedor de Inyección de Dependencia](concept/di-container.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Configuration](concept/configuration.md) +" +#, fuzzy +#| msgid "[Configuration](concept/configuration.md) +" +msgid "[Configuration](concept/configuration.md)" msgstr "[Configuración](concept/configuration.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Aliases](concept/aliases.md) +" +#, fuzzy +#| msgid "[Aliases](concept/aliases.md) +" +msgid "[Aliases](concept/aliases.md)" msgstr "[Alias](concept/aliases.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Events](concept/events.md) +" +#, fuzzy +#| msgid "[Events](concept/events.md) +" +msgid "[Events](concept/events.md)" msgstr "[Eventos](concept/events.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Immutability](concept/immutability.md) +" +msgid "[Immutability](concept/immutability.md)" msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Handling requests +" +#, fuzzy, no-wrap +#| msgid "Handling requests +" +msgid "Handling requests" msgstr "Gestión de las Peticiones" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Routing and URL generation](runtime/routing.md) +" +#, fuzzy +#| msgid "[Routing and URL generation](runtime/routing.md) +" +msgid "[Routing and URL generation](runtime/routing.md)" msgstr "[Enrutamiento y Creación de las URL](runtime/routing.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Request](runtime/request.md) +" +#, fuzzy +#| msgid "[Request](runtime/request.md) +" +msgid "[Request](runtime/request.md)" msgstr "[Peticiones (Requests)](runtime/request.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Response](runtime/response.md) +" +#, fuzzy +#| msgid "[Response](runtime/response.md) +" +msgid "[Response](runtime/response.md)" msgstr "[Respuestas (Responses)](runtime/response.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Sessions](runtime/sessions.md) +" +#, fuzzy +#| msgid "[Sessions](runtime/sessions.md) +" +msgid "[Sessions](runtime/sessions.md)" msgstr "[Sesiones (Sessions)](runtime/sessions.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Cookies](runtime/cookies.md) +" +#, fuzzy +#| msgid "[Cookies](runtime/cookies.md) +" +msgid "[Cookies](runtime/cookies.md)" msgstr "[Cookies](runtime/cookies.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Handling errors](runtime/handling-errors.md) +" +#, fuzzy +#| msgid "[Handling errors](runtime/handling-errors.md) +" +msgid "[Handling errors](runtime/handling-errors.md)" msgstr "[Manejo de Errores](runtime/handling-errors.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Logging](runtime/logging.md) +" +#, fuzzy +#| msgid "[Logging](runtime/logging.md) +" +msgid "[Logging](runtime/logging.md)" msgstr "[Registros (logs)](runtime/logging.md)" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -#, fuzzy +#, fuzzy, no-wrap #| msgid "Views -" -msgid "Views +" +msgid "Views" msgstr "Vistas" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md #, fuzzy #| msgid "[Views](views/view.md) -" -msgid "[View](views/view.md) +" +msgid "[View](views/view.md)" msgstr "[Vistas](views/view.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md #, fuzzy #| msgid "[Template engines](views/template-engines.md) -" -msgid "[Template engines](views/template-engines.md) +- TODO: verify!" +msgid "[Template engines](views/template-engines.md) TODO: verify!" msgstr "[Motores de Plantillas](views/template-engines.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[View injections](views/view-injections.md) +" -msgstr "" +#, fuzzy +#| msgid "[Views](views/view.md) -" +msgid "[View injections](views/view-injections.md)" +msgstr "[Vistas](views/view.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Scripts, styles and metatags](views/script-style-meta.md) +- TODO: verify!" -msgstr "" +#, fuzzy +#| msgid "[Assets](views/asset.md) -" +msgid "[Scripts, styles and metatags](views/script-style-meta.md) TODO: verify!" +msgstr "[Assets](views/asset.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md #, fuzzy #| msgid "[Assets](views/asset.md) -" -msgid "[Assets](views/asset.md) +- TODO: verify!" +msgid "[Assets](views/asset.md) TODO: verify!" msgstr "[Assets](views/asset.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md #, fuzzy #| msgid "[Widgets](views/widget.md) -" -msgid "[Widgets](views/widget.md) +- TODO: verify!" +msgid "[Widgets](views/widget.md) TODO: verify!" msgstr "[Widgets](views/widget.md)" -#. type: Plain text -#: ../../guide/en/README.md -msgid "Working with databases +-" -msgstr "Trabajar con Bases de Datos" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Database access objects](db-dao.md): Connecting to a database, basic queries, transactions, and schema manipulation" -msgstr "[Objeto de Acceso a Datos](db-dao.md): Conexión a una base de datos, consultas básicas, transacciones y manipulación de esquemas" +#. type: Title # +#: ../../guide/en/README.md ../../guide/en/start/databases.md +#, no-wrap +msgid "Working with databases" +msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Query builder](db-query-builder.md): Querying the database using a simple abstraction layer" -msgstr "[Constructor de Consultas](db-query-builder.md): Consulta de la base de datos utilizando una capa simple de abstracción" +#, fuzzy +#| msgid "[Validating input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md) +" +msgid "[Yii DB](https://github.com/yiisoft/db/blob/master/docs/guide/en/README.md)" +msgstr "[Validar Datos](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Active record](db-active-record.md): The Active Record ORM, retrieving and manipulating records, and defining relations" -msgstr "[Active Record](db-active-record.md): ORM Active Record, recuperación y manipulación de registros y definición de relaciones" +#, fuzzy +#| msgid "[Validating input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md) +" +msgid "[Active Record](https://github.com/yiisoft/active-record/blob/master/README.md)" +msgstr "[Validar Datos](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Migrations](databases/db-migrations.md): +" +#, fuzzy +#| msgid "[Migrations](databases/db-migrations.md): +" +msgid "[Migrations](databases/db-migrations.md) TODO: verify/update!" msgstr "[Migraciones](db-migrations.md)" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Getting data from users -" +#, fuzzy, no-wrap +#| msgid "Getting data from users -" +msgid "Getting data from users" msgstr "Obtener Datos de los Usuarios" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Creating forms](input/forms.md) -" +#, fuzzy +#| msgid "[Creating forms](input/forms.md) -" +msgid "[Creating forms](input/forms.md) TODO" msgstr "[Crear Formularios](input/forms.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Validating input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md) +" +#, fuzzy +#| msgid "[Validating input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md) +" +msgid "[Validating input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md)" msgstr "[Validar Datos](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Uploading files](input/file-upload.md) -" +#, fuzzy +#| msgid "[Uploading files](input/file-upload.md) -" +msgid "[Uploading files](input/file-upload.md) TODO" msgstr "[Carga de Archivos](input/file-upload.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Collecting tabular input](input/tabular-input.md) -" +#, fuzzy +#| msgid "[Collecting tabular input](input/tabular-input.md) -" +msgid "[Collecting tabular input](input/tabular-input.md) TODO" msgstr "[Obtener Datos de Formularios Tabulados (Tabular Input)](input/tabular-input.md)" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Displaying data -" +#, fuzzy, no-wrap +#| msgid "Displaying data -" +msgid "Displaying data" msgstr "Visualizar Datos" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Data formatting](output/formatting.md) -" +#, fuzzy +#| msgid "[Data formatting](output/formatting.md) -" +msgid "[Data formatting](output/formatting.md) TODO" msgstr "[Formato de Datos](output/formatting.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Pagination](output/pagination.md) -" +#, fuzzy +#| msgid "[Pagination](output/pagination.md) -" +msgid "[Pagination](output/pagination.md) TODO" msgstr "[Paginación](output/pagination.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Sorting](output/sorting.md) -" +#, fuzzy +#| msgid "[Sorting](output/sorting.md) -" +msgid "[Sorting](output/sorting.md) TODO" msgstr "[Ordenamiento](output/sorting.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Data providers](output/data-providers.md) -" +#, fuzzy +#| msgid "[Data providers](output/data-providers.md) -" +msgid "[Data providers](output/data-providers.md) TODO" msgstr "[Proveedores de Datos](output/data-providers.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Data widgets](output/data-widgets.md) -" +#, fuzzy +#| msgid "[Data widgets](output/data-widgets.md) -" +msgid "[Data widgets](output/data-widgets.md) TODO" msgstr "[Widgets de Datos](output/data-widgets.md)" -#. type: Plain text -#: ../../guide/en/README.md -msgid "Security +-" -msgstr "Seguridad" +#. type: Title # +#: ../../guide/en/README.md ../../guide/en/security/overview.md +#, no-wrap +msgid "Security" +msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Security overview](security/overview.md) +" +#, fuzzy +#| msgid "[Security overview](security/overview.md) +" +msgid "[Security overview](security/overview.md)" msgstr "[Información General de Seguridad](security/overview.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Authentication](security/authentication.md) +" +#, fuzzy +#| msgid "[Authentication](security/authentication.md) +" +msgid "[Authentication](security/authentication.md)" msgstr "[Autenticación](security/authentication.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Authorization](security/authorization.md) +-" +#, fuzzy +#| msgid "[Authorization](security/authorization.md) +-" +msgid "[Authorization](security/authorization.md) TODO: verify and complete!" msgstr "[Autorización](security/authorization.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Working with passwords](security/passwords.md) +" +#, fuzzy +#| msgid "[Working with passwords](security/passwords.md) +" +msgid "[Working with passwords](security/passwords.md)" msgstr "[Trabajar con Contraseñas](security/passwords.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Cryptography](security/cryptography.md) +" +#, fuzzy +#| msgid "[Cryptography](security/cryptography.md) +" +msgid "[Cryptography](security/cryptography.md)" msgstr "[Criptografía](security/cryptography.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Best practices](security/best-practices.md) +" +#, fuzzy +#| msgid "[Best practices](security/best-practices.md) +" +msgid "[Best practices](security/best-practices.md)" msgstr "[Buenas Prácticas](security/best-practices.md)" -#. type: Plain text -#: ../../guide/en/README.md -msgid "Caching +-" -msgstr "Caché" +#. type: Title # +#: ../../guide/en/README.md ../../guide/en/caching/overview.md +#, no-wrap +msgid "Caching" +msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Caching overview](caching/overview.md) +" +#, fuzzy +#| msgid "[Caching overview](caching/overview.md) +" +msgid "[Caching overview](caching/overview.md)" msgstr "[Información General de Caché](caching/overview.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Data caching](caching/data.md) +" +#, fuzzy +#| msgid "[Data caching](caching/data.md) +" +msgid "[Data caching](caching/data.md)" msgstr "[Caché de Datos](caching/data.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Fragment caching](caching/fragment.md) -" +#, fuzzy +#| msgid "[Fragment caching](caching/fragment.md) -" +msgid "[Fragment caching](caching/fragment.md) TODO" msgstr "[Caché de Fragmentos](caching/fragment.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Page caching](caching/page.md) -" +#, fuzzy +#| msgid "[Page caching](caching/page.md) -" +msgid "[Page caching](caching/page.md) TODO" msgstr "[Caché de Páginas](caching/page.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[HTTP caching](caching/http.md) -" +#, fuzzy +#| msgid "[HTTP caching](caching/http.md) -" +msgid "[HTTP caching](caching/http.md) TODO" msgstr "[Caché HTTP](caching/http.md)" -#. type: Title - +#. type: Title ## #: ../../guide/en/README.md #, fuzzy, no-wrap -msgid "REST APIs -" +msgid "REST APIs" msgstr "Servicios Web RESTful" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Quick start](rest/quick-start.md)" +#, fuzzy +#| msgid "[Quick start](rest/quick-start.md)" +msgid "[Quick start](rest/quick-start.md) TODO" msgstr "[Inicio Rápido](rest/quick-start.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Resources](rest/resources.md)" +#, fuzzy +#| msgid "[Resources](rest/resources.md)" +msgid "[Resources](rest/resources.md) TODO" msgstr "[Recursos](rest/resources.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Controllers](rest/controllers.md)" +#, fuzzy +#| msgid "[Controllers](rest/controllers.md)" +msgid "[Controllers](rest/controllers.md) TODO" msgstr "[Controladores](rest/controllers.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Routing](rest/routing.md)" +#, fuzzy +#| msgid "[Routing](rest/routing.md)" +msgid "[Routing](rest/routing.md) TODO" msgstr "[Enrutamiento](rest/routing.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Authentication](rest/authentication.md)" +#, fuzzy +#| msgid "[Authentication](rest/authentication.md)" +msgid "[Authentication](rest/authentication.md) TODO" msgstr "[Autentificación](rest/authentication.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Rate limiting](rest/rate-limiting.md)" +#, fuzzy +#| msgid "[Rate limiting](rest/rate-limiting.md)" +msgid "[Rate limiting](rest/rate-limiting.md) TODO" msgstr "[Límite de Solicitudes por Cliente (Rate Limiting)](rest/rate-limiting.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Versioning](rest/versioning.md)" +#, fuzzy +#| msgid "[Versioning](rest/versioning.md)" +msgid "[Versioning](rest/versioning.md) TODO" msgstr "[Gestión de Versiones](rest/versioning.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Error handling](rest/error-handling.md)" +#, fuzzy +#| msgid "[Error handling](rest/error-handling.md)" +msgid "[Error handling](rest/error-handling.md) TODO" msgstr "[Manejo de Errores](rest/error-handling.md)" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Development tools -" +#, fuzzy, no-wrap +#| msgid "Development tools -" +msgid "Development tools" msgstr "Herramientas de Desarrollo" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "Debug toolbar and debugger" msgstr "Depurador y Barra de Herramientas de Depuración" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "Generating code using Gii" msgstr "Generación de Código con Gii" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "Generating API documentation" msgstr "Generación de Documentación de API" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Testing -" +#, fuzzy, no-wrap +#| msgid "Testing -" +msgid "Testing" msgstr "Pruebas (Testing)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Testing overview](testing/overview.md)" +#, fuzzy +#| msgid "[Testing overview](testing/overview.md)" +msgid "[Testing overview](testing/overview.md) TODO" msgstr "[Información General de Pruebas](testing/overview.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Testing environment setup](testing/environment-setup.md)" +#, fuzzy +#| msgid "[Testing environment setup](testing/environment-setup.md)" +msgid "[Testing environment setup](testing/environment-setup.md) TODO" msgstr "[Configuración del Entorno de Pruebas](testing/environment-setup.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Unit tests](testing/unit.md)" +#, fuzzy +#| msgid "[Unit tests](testing/unit.md)" +msgid "[Unit tests](testing/unit.md) TODO" msgstr "[Pruebas Unitarias](testing/unit.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Functional tests](testing/functional.md)" +#, fuzzy +#| msgid "[Functional tests](testing/functional.md)" +msgid "[Functional tests](testing/functional.md) TODO" msgstr "[Pruebas Funcionales](testing/functional.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Acceptance tests](testing/acceptance.md)" +#, fuzzy +#| msgid "[Acceptance tests](testing/acceptance.md)" +msgid "[Acceptance tests](testing/acceptance.md) TODO" msgstr "[Pruebas de Aceptación](testing/acceptance.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Fixtures](testing/fixtures.md)" +#, fuzzy +#| msgid "[Fixtures](testing/fixtures.md)" +msgid "[Fixtures](testing/fixtures.md) TODO" msgstr "[Datos de Prueba (Fixtures)](testing/fixtures.md)" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Special topics -" +#, fuzzy, no-wrap +#| msgid "Special topics -" +msgid "Special topics" msgstr "Temas Especiales" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Building application from scratch](tutorial/start-from-scratch.md) -" -msgstr "[Creación de una Aplicación Desde Cero](tutorial/start-from-scratch.md)" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Console applications](tutorial/console-applications.md) +" +#, fuzzy +#| msgid "[Console applications](tutorial/console-applications.md) +" +msgid "[Console applications](tutorial/console-applications.md)" msgstr "[Comandos de Consola](tutorial/console-applications.md)" -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Docker](tutorial/docker.md) -" -msgstr "[Docker](tutorial/docker.md)" - -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Internationalization](tutorial/i18n.md) -" +#, fuzzy +#| msgid "[Internationalization](tutorial/i18n.md) -" +msgid "[Internationalization](tutorial/i18n.md) TODO" msgstr "[Internacionalización](tutorial/i18n.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Mailing](tutorial/mailing.md) +" +#, fuzzy +#| msgid "[Mailing](tutorial/mailing.md) +" +msgid "[Mailing](tutorial/mailing.md)" msgstr "[Envío de Correos Electrónicos](tutorial/mailing.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Performance tuning](tutorial/performance-tuning.md) +" +#, fuzzy +#| msgid "[Performance tuning](tutorial/performance-tuning.md) +" +msgid "[Performance tuning](tutorial/performance-tuning.md)" msgstr "[Ajustes de Rendimiento](tutorial/performance-tuning.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Using Yii with event loop](tutorial/using-with-event-loop.md) +" +#, fuzzy +#| msgid "[Using Yii with event loop](tutorial/using-with-event-loop.md) +" +msgid "[Using Yii with event loop](tutorial/using-with-event-loop.md)" msgstr "[Utilizar Yii con Bucle de Eventos](tutorial/using-with-event-loop.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Using Yii with RoadRunner](tutorial/using-yii-with-roadrunner.md) +" +#, fuzzy +#| msgid "[Using Yii with RoadRunner](tutorial/using-yii-with-roadrunner.md) +" +msgid "[Using Yii with RoadRunner](tutorial/using-yii-with-roadrunner.md)" msgstr "[Utilizar Yii con RoadRunner](tutorial/using-yii-with-roadrunner.md)" -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Using Yii with Swoole](tutorial/using-yii-with-swoole.md) +" -msgstr "" - -#. type: Plain text -#: ../../guide/en/README.md -msgid "Widgets -" -msgstr "Widgets" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[GridView](https://www.yiiframework.com/doc-2.0/yii-grid-gridview.html)" -msgstr "[GridView](https://www.yiiframework.com/doc-2.0/yii-grid-gridview.html)" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[ListView](https://www.yiiframework.com/doc-2.0/yii-widgets-listview.html)" -msgstr "[ListView](https://www.yiiframework.com/doc-2.0/yii-widgets-listview.html)" - -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[DetailView](https://www.yiiframework.com/doc-2.0/yii-widgets-detailview.html)" -msgstr "[DetailView](https://www.yiiframework.com/doc-2.0/yii-widgets-detailview.html)" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[ActiveForm](https://www.yiiframework.com/doc-2.0/guide-input-forms.html#activerecord-based-forms-activeform)" -msgstr "[ActiveForm](https://www.yiiframework.com/doc-2.0/guide-input-forms.html#activerecord-based-forms-activeform)" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Menu](https://www.yiiframework.com/doc-2.0/yii-widgets-menu.html)" -msgstr "[Menu](https://www.yiiframework.com/doc-2.0/yii-widgets-menu.html)" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[LinkPager](https://www.yiiframework.com/doc-2.0/yii-widgets-linkpager.html)" -msgstr "[LinkPager](https://www.yiiframework.com/doc-2.0/yii-widgets-linkpager.html)" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[LinkSorter](https://www.yiiframework.com/doc-2.0/yii-widgets-linksorter.html)" -msgstr "[LinkSorter](https://www.yiiframework.com/doc-2.0/yii-widgets-linksorter.html)" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Bootstrap widgets](https://www.yiiframework.com/extension/yiisoft/yii2-bootstrap/doc/guide)" -msgstr "[Bootstrap widgets](https://www.yiiframework.com/extension/yiisoft/yii2-bootstrap/doc/guide)" +#, fuzzy +#| msgid "[Using Yii with RoadRunner](tutorial/using-yii-with-roadrunner.md) +" +msgid "[Using Yii with Swoole](tutorial/using-yii-with-swoole.md)" +msgstr "[Utilizar Yii con RoadRunner](tutorial/using-yii-with-roadrunner.md)" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Helpers +" +#, fuzzy, no-wrap +#| msgid "Helpers +" +msgid "Helpers" msgstr "Clases Auxiliares" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Arrays](https://github.com/yiisoft/arrays/)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Files](https://github.com/yiisoft/files/)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Html](https://github.com/yiisoft/html/)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Json](https://github.com/yiisoft/json)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Network utilities](https://github.com/yiisoft/network-utilities/)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[VarDumper](https://github.com/yiisoft/var-dumper)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Strings](https://github.com/yiisoft/strings)" msgstr "" -#. type: Plain text +#. type: Title ## +#: ../../guide/en/README.md +#, no-wrap +msgid "Extras" +msgstr "" + +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "Extras +" +msgid "[Cookbook](../../cookbook/en/README.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Glossary](glossary.md)" msgstr "" diff --git a/_translations/guide/po/es/databases_db-migrations.md.po b/_translations/guide/po/es/databases_db-migrations.md.po index 1d56a10..ebcc007 100644 --- a/_translations/guide/po/es/databases_db-migrations.md.po +++ b/_translations/guide/po/es/databases_db-migrations.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-11 10:15+0500\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -27,8 +27,8 @@ msgstr "" msgid "To use migrations, install [yiisoft/db-migration](https://github.com/yiisoft/db-migration/) package:" msgstr "" -#. type: Fenced code block (shell) -#: ../../guide/en/databases/db-migrations.md +#. type: Fenced code block (sh) +#: ../../guide/en/databases/db-migrations.md ../../guide/en/start/databases.md #, no-wrap msgid "composer require yiisoft/db-migration\n" msgstr "" diff --git a/_translations/guide/po/es/glossary.md.po b/_translations/guide/po/es/glossary.md.po index 8b848f4..c500156 100644 --- a/_translations/guide/po/es/glossary.md.po +++ b/_translations/guide/po/es/glossary.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-11 10:15+0500\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: 2025-09-11 10:15+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -42,7 +42,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "Asset refers to a resource file. Typically, it contains JavaScript or CSS code but can be any static content accessed via HTTP." +msgid "Asset refers to a resource file. Typically, it contains JavaScript or CSS code but can be any static content accessed via HTTP. Read more in [\"Assets\"](views/asset.md)." msgstr "" #. type: Title # @@ -59,7 +59,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "The Configuration may refer either to the process of setting properties of an object or to a configuration file that stores settings for an object, or a class of objects. Read more in [\"Configuration\"](concept/configuration.md)." +msgid "The Configuration may refer either to the process of setting properties of an object or to a configuration file that stores settings for an object, or a class of objects. Read more in [\"Configuration\"](concept/configuration.md)." msgstr "" #. type: Title # @@ -76,7 +76,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "Dependency Injection is a programming technique where an object injects a dependent object. [\"DI\"](concept/di-container.md)" +msgid "Dependency Injection is a programming technique where an object injects a dependent object. Read more in [\"Dependency injection and container\"](concept/di-container.md)." msgstr "" #. type: Title # @@ -110,7 +110,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "Middleware is a processor in the request processing stack. Given a request, it may either produce a response or do some action and pass processing to the next middleware. Read more in [\"Middleware\"](structure/middleware.md)." +msgid "Middleware is a processor in the request processing stack. Given a request, it may either produce a response or do some action and pass processing to the next middleware. Read more in [\"Middleware\"](structure/middleware.md)." msgstr "" #. type: Title ## @@ -121,7 +121,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "The module is a sub-application that groups some code based on a use-case. It's typically used within the main application and may contain URL handlers or console commands." +msgid "The module is a namespace that groups some code based on a use-case. It's typically used within the main application and may contain any source code, define additional URL handlers or console commands." msgstr "" #. type: Title # @@ -138,7 +138,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "Namespace refers to a [PHP language feature](https://www.php.net/manual/en/language.namespaces.php)." +msgid "Namespace refers to a [PHP language feature](https://www.php.net/manual/en/language.namespaces.php) to group multiple classes under a certain name." msgstr "" #. type: Title # @@ -189,7 +189,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "A queue is similar to a stack. Queue follows First-In-First-Out methodology." +msgid "A queue is similar to a stack. Queue follows First-In-First-Out methodology. Yii has a [yiisoft/queue](https://github.com/yiisoft/queue) package." msgstr "" #. type: Title # @@ -206,5 +206,5 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "A Vendor is an organization or individual developer providing code in the form of packages. It also may refer to [Composer's `vendor` directory](https://getcomposer.org/doc/)." +msgid "A Vendor is an organization or individual developer providing code in the form of packages. It also may refer to [Composer's `vendor` directory](https://getcomposer.org/doc/)." msgstr "" diff --git a/_translations/guide/po/es/intro_upgrade-from-v2.md.po b/_translations/guide/po/es/intro_upgrade-from-v2.md.po index 2c70236..861d70d 100644 --- a/_translations/guide/po/es/intro_upgrade-from-v2.md.po +++ b/_translations/guide/po/es/intro_upgrade-from-v2.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-04 11:19+0500\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -16,14 +16,20 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +#. type: Title ### +#: ../../guide/en/README.md ../../guide/en/intro/upgrade-from-v2.md +#, no-wrap +msgid "Application structure" +msgstr "" + #. type: Title # -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Upgrading from Version 2.0" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "" "> If you haven't used Yii2, you can skip this section and get directly to \"[getting started](../start/installation.md)\"\n" @@ -31,100 +37,100 @@ msgid "" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "While sharing some common ideas and values, Yii 3 is conceptually different from Yii 2. There is no easy upgrade path, so first [check maintenance policy and end-of-life dates for Yii 2](https://www.yiiframework.com/release-cycle) and consider starting new projects on Yii 3 while keeping existing ones on Yii 2." msgstr "" #. type: Title ## -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "PHP requirements" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Yii3 requires PHP 8.2 or above. As a result, there are language features used that weren't used in Yii 2:" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Type declarations](https://www.php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Return type declarations](https://www.php.net/manual/en/functions.returning-values.php#functions.returning-values.type-declaration)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Class constant visibility](https://www.php.net/manual/en/language.oop5.constants.php)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Named arguments](https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Anonymous classes](https://www.php.net/manual/en/language.oop5.anonymous.php)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[::class](https://www.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Generators](https://www.php.net/manual/en/language.generators.php)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Variadic functions](https://www.php.net/manual/en/functions.arguments.php#functions.variable-arg-list)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Readonly properties](https://www.php.net/manual/en/language.oop5.properties.php#language.oop5.properties.readonly-properties)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Readonly classes](https://www.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.readonly)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Constructor property promotion](https://www.php.net/manual/en/language.oop5.decon.php#language.oop5.decon.constructor.promotion)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Attributes](https://www.php.net/manual/en/language.attributes.php)" msgstr "" #. type: Title ## -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Preliminary refactoring" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "It's a good idea to refactor your Yii 2 project before porting it to Yii 3. That would both make porting easier and benefit the project in question while it's not moved to Yii 3 yet." msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Use DI instead of the service locator" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "" "Since Yii 3 is forcing you to inject dependencies, it's a good idea to prepare and switch from using\n" @@ -132,7 +138,7 @@ msgid "" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "" "If usage of DI container is problematic for whatever reason, consider moving all calls to `Yii::$app->` to controller\n" @@ -140,23 +146,23 @@ msgid "" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "See [Dependency injection and container](../concept/di-container.md) for an explanation of the idea." msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Introduce repositories for getting data" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Since Active Record isn't the only way to work with a database in Yii 3, consider introducing repositories that would hide details of getting data and gather them in a single place. You can later redo it:" msgstr "" #. type: Fenced code block (php) -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "" "final readonly class PostRepository\n" @@ -175,93 +181,88 @@ msgid "" msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Separate domain layer from infrastructure" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "In case you have a rich complicated domain, it's a good idea to separate it from infrastructure provided by a framework that's all the business logic has to go to framework-independent classes." msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Move more into components" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Yii 3 services are conceptually similar to Yii 2 components, so it's a good idea to move reusable parts of your application into components." msgstr "" #. type: Title ## -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Things to learn" msgstr "" #. type: Title ## -#: en/intro/upgrade-from-v2.md en/start/prerequisites.md +#: ../../guide/en/intro/upgrade-from-v2.md +#: ../../guide/en/start/prerequisites.md #, no-wrap msgid "Docker" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Default application templates are using [Docker](https://www.docker.com/get-started/) to run application. It's a good idea to learn how to use it and use it for your own projects since it provides a lot of benefits:" msgstr "" #. type: Bullet: '1. ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Exactly the same environment as in production." msgstr "" #. type: Bullet: '2. ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "No need to install anything except Docker itself." msgstr "" #. type: Bullet: '3. ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Environment is per application, not per server." msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Environment variables" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Yii3 application templates are using [environment variables](https://en.wikipedia.org/wiki/Environment_variable) to configure pars of the application. The concept is [very handy for Dockerized applications](https://12factor.net/) but might be alien to users of Yii 1.1 and Yii 2." msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Handlers" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Unlike Yii2, Yii3 doesn't have controllers per se. Instead, it uses [handlers](../structure/handler.md) which are similar to controllers but different." msgstr "" -#. type: Title ### -#: en/intro/upgrade-from-v2.md -#, no-wrap -msgid "Application structure" -msgstr "" - #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Suggested Yii3 application structure is different from Yii 2. It's described in [application structure](../structure/overview.md)." msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Despite that, Yii3 is flexible, so it's still possible to use a structure similar to Yii 2 with Yii 3." msgstr "" diff --git a/_translations/guide/po/es/start_databases.md.po b/_translations/guide/po/es/start_databases.md.po index 7093fc1..345140e 100644 --- a/_translations/guide/po/es/start_databases.md.po +++ b/_translations/guide/po/es/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-04 11:19+0500\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -17,104 +17,301 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. type: Title # -#: en/start/databases.md +#: ../../guide/en/README.md ../../guide/en/start/databases.md #, no-wrap msgid "Working with databases" msgstr "" +#. type: Fenced code block (sh) +#: ../../guide/en/databases/db-migrations.md ../../guide/en/start/databases.md +#, no-wrap +msgid "composer require yiisoft/db-migration\n" +msgstr "" + #. type: Plain text -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "Yii doesn't dictate using a particular database or storage for your application. There are many ways you can work with relational databases:" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[Yii DB](https://github.com/yiisoft/db)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[Yii Active Record](https://github.com/yiisoft/active-record)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[Cycle](https://github.com/cycle) via [Yii Cycle package](https://github.com/yiisoft/yii-cycle)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[PDO](https://www.php.net/manual/en/book.pdo.php)" msgstr "" #. type: Plain text -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "For non-relational ones, there are usually official libraries available:" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[ElasticSearch](https://github.com/elastic/elasticsearch-php)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[Redis](https://redis.io/docs/clients/#php)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "..." msgstr "" #. type: Plain text -#: en/start/databases.md -msgid "In this guide, we will focus on working with relational databases using Yii DB." +#: ../../guide/en/start/databases.md +msgid "In this guide, we will focus on working with relational databases using Yii DB. We'll use PostgreSQL to implement a simple CRUD (create read update delete)." +msgstr "" + +#. type: Title ## +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "Installing PostgreSQL" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "You need to install PostgreSQL. If you prefer not to use Docker, [get the installer from official website](https://www.postgresql.org/download/), install it and create a database." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "If you use Docker, it is a bit simpler. Modify `docker/dev/compose.yml`:" +msgstr "" + +#. type: Fenced code block (yaml) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"services:\n" +" app:\n" +" build:\n" +" dockerfile: docker/Dockerfile\n" +" context: ..\n" +" target: dev\n" +" args:\n" +" USER_ID: ${UID}\n" +" GROUP_ID: ${GID}\n" +" env_file:\n" +" - path: ./dev/.env\n" +" - path: ./dev/override.env\n" +" required: false\n" +" ports:\n" +" - \"${DEV_PORT:-80}:80\"\n" +" volumes:\n" +" - ../:/app\n" +" - ../runtime:/app/runtime\n" +" - caddy_data:/data\n" +" - caddy_config:/config\n" +" tty: true\n" +" depends_on:\n" +" db:\n" +" condition: service_healthy\n" +"\n" +" db:\n" +" image: postgres:${POSTGRES_VERSION:-15}-alpine\n" +" environment:\n" +" POSTGRES_DB: app\n" +" POSTGRES_PASSWORD: password\n" +" POSTGRES_USER: user\n" +" volumes:\n" +" - ./runtime/db:/var/lib/postgresql/data:rw\n" +" ports:\n" +" - \"${DEV_DB_PORT:-5432}:5432\"\n" +" healthcheck:\n" +" test: [ \"CMD-SHELL\", \"pg_isready -U user -d app\" ]\n" +" interval: 5s\n" +" timeout: 5s\n" +" retries: 5\n" +"\n" +"volumes:\n" +" db:\n" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Note that we add `depends_on` so application waits for database to be up." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Also, we'll need a `pdo_pgsql` extension to communicate with PostgreSQL. You can enable it locally in `php.ini`. If you use Docker, check `docker/Dockerfile` and add `pdo_pgsql` in `install-php-extensions` list. Then rebuild PHP image with `make build && make down && make up`." msgstr "" #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "Configuring connection" msgstr "" +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Now that we have the database, it's time to define the connection. We need a package to be installed first:" +msgstr "" + +#. type: Fenced code block (sh) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "composer require yiisoft/db-pgsql\n" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Now create `config/common/di/db-pgsql.php`:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +" [\n" +" 'class' => Connection::class,\n" +" '__construct()' => [\n" +" 'driver' => new Driver(\n" +" $params['yiisoft/db-pgsql']['dsn'],\n" +" $params['yiisoft/db-pgsql']['username'],\n" +" $params['yiisoft/db-pgsql']['password'],\n" +" ),\n" +" ],\n" +" ],\n" +"];\n" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "And define parameters in `config/common/params.php`. For Docker that would be:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"use Yiisoft\\Db\\Pgsql\\Dsn;\n" +"\n" +"return [\n" +" // ...\n" +" 'yiisoft/db-pgsql' => [\n" +" 'dsn' => (new Dsn('pgsql', 'db', 'app', '5432'))->asString(),\n" +" 'username' => 'user',\n" +" 'password' => 'password',\n" +" ],\n" +"];\n" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "`db` host is resolved automatically within the Docker network." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "For local installation without Docker the host in Dsn would be `localhost`. You'll have to adjust the rest to match how you configured the database." +msgstr "" + #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "Creating and applying migrations" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "For the initial state of the application and for further database changes, it is a good idea to use migrations. These are files creating changes to be applied to the database. Which are applied is tracked in the same database so we always know which state is it now and what is to be applied." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "To use migrations we need another package installed:" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "And a directory to store migrations such as `migrations` right in the project root." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Now you can use `yii migrate:create user` to create a new migration. For our example we need a `page` table with some columns:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md #, no-wrap -msgid "Creating and applying migration" +msgid "" +"\n" +"public function up(MigrationBuilder $b): void\n" +"{\n" +" $b->createTable('page', [\n" +" 'id' => $b->primaryKey(),\n" +" 'title' => $b->string()->notNull(),\n" +" 'text' => $b->text()->notNull(),\n" +" 'created_at' => $b->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'),\n" +" 'updated_at' => $b->dateTime(),\n" +" 'deleted_at' => $b->dateTime(),\n" +" ]);\n" +"}\n" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Apply it with `yii migrate:up`." msgstr "" #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "Inserting" msgstr "" #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "Selecting" msgstr "" #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "Using data package" msgstr "" #. type: Title ### -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "Pagination" msgstr "" #. type: Plain text -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "" "> [!NOTE]\n" diff --git a/_translations/guide/po/id/README.md.po b/_translations/guide/po/id/README.md.po index f3d67d2..f85de26 100644 --- a/_translations/guide/po/id/README.md.po +++ b/_translations/guide/po/id/README.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" -"POT-Creation-Date: 2025-10-19 11:32+0000\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: 2025-09-05 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -27,618 +27,742 @@ msgstr "Panduan Definitif untuk Yii 3.0" msgid "We release this guide under the [Terms of Yii Documentation](https://www.yiiframework.com/license#docs)." msgstr "Panduan ini dirilis di bawah [Ketentuan Dokumentasi Yii](https://www.yiiframework.com/license#docs)." -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Introduction +" +#, fuzzy, no-wrap +#| msgid "Introduction +" +msgid "Introduction" msgstr "Pengenalan +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[About Yii](intro/what-is-yii.md) +" +#, fuzzy +#| msgid "[About Yii](intro/what-is-yii.md) +" +msgid "[About Yii](intro/what-is-yii.md)" msgstr "[Tentang Yii](intro/what-is-yii.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Upgrading from version 2.0](intro/upgrade-from-v2.md) +" +#, fuzzy +#| msgid "[Upgrading from version 2.0](intro/upgrade-from-v2.md) +" +msgid "[Upgrading from version 2.0](intro/upgrade-from-v2.md)" msgstr "[Memutakhirkan dari versi 2.0](intro/upgrade-from-v2.md) +" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Getting started -" +#, fuzzy, no-wrap +#| msgid "Getting started -" +msgid "Getting started" msgstr "Mulai -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[What do you need to know?](start/prerequisites.md) +" +#, fuzzy +#| msgid "[What do you need to know?](start/prerequisites.md) +" +msgid "[What do you need to know?](start/prerequisites.md)" msgstr "[Apa yang perlu kamu ketahui](start/prerequisites.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Creating a project](start/creating-project.md) +" +#, fuzzy +#| msgid "[Creating a project](start/creating-project.md) +" +msgid "[Creating a project](start/creating-project.md)" msgstr "[Membuat proyek](start/creating-project.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Running applications](start/workflow.md) +" +#, fuzzy +#| msgid "[Running applications](start/workflow.md) +" +msgid "[Running applications](start/workflow.md)" msgstr "[Menjalankan Aplikasi](start/workflow.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Saying hello](start/hello.md) +" +#, fuzzy +#| msgid "[Saying hello](start/hello.md) +" +msgid "[Saying hello](start/hello.md)" msgstr "[Mengucapkan halo](start/hello.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Working with forms](start/forms.md) +" +#, fuzzy +#| msgid "[Working with forms](start/forms.md) +" +msgid "[Working with forms](start/forms.md)" msgstr "[Bekerja Dengan Formulir](start/forms.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Working with databases](start/databases.md) !" +#, fuzzy +#| msgid "[Working with databases](start/databases.md) !" +msgid "[Working with databases](start/databases.md) TODO" msgstr "[Bekerja Dengan Basis Data](start/databases.md) !" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Generating code with Gii](start/gii.md) -" +#, fuzzy +#| msgid "[Generating code with Gii](start/gii.md) -" +msgid "[Generating code with Gii](start/gii.md) TODO" msgstr "[Menghasilkan Kode dengan Gii](start/gii.md) -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Looking ahead](start/looking-ahead.md) +" +#, fuzzy +#| msgid "[Looking ahead](start/looking-ahead.md) +" +msgid "[Looking ahead](start/looking-ahead.md)" msgstr "[Melihat ke depan](start/looking-ahead.md) +" -#. type: Plain text -#: ../../guide/en/README.md -msgid "Application structure +" -msgstr "Struktur Aplikasi +" +#. type: Title ### +#: ../../guide/en/README.md ../../guide/en/intro/upgrade-from-v2.md +#, no-wrap +msgid "Application structure" +msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Application structure overview](structure/overview.md) +" +#, fuzzy +#| msgid "[Application structure overview](structure/overview.md) +" +msgid "[Application structure overview](structure/overview.md)" msgstr "[Application Structure Overview](structure/overview.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Entry scripts](structure/entry-script.md) +" +#, fuzzy +#| msgid "[Entry scripts](structure/entry-script.md) +" +msgid "[Entry scripts](structure/entry-script.md)" msgstr "[Entry Scripts](structure/entry-script.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Application](structure/application.md) +" +#, fuzzy +#| msgid "[Application](structure/application.md) +" +msgid "[Application](structure/application.md)" msgstr "[Application](structure/application.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Service components](structure/service.md) +" +#, fuzzy +#| msgid "[Service components](structure/service.md) +" +msgid "[Service components](structure/service.md)" msgstr "[Service components](structure/service.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Actions](structure/action.md) +" +#, fuzzy +#| msgid "[Actions](structure/action.md) +" +msgid "[Actions](structure/action.md)" msgstr "[Actions](structure/action.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Domain](structure/domain.md) +" +#, fuzzy +#| msgid "[Domain](structure/domain.md) +" +msgid "[Domain](structure/domain.md)" msgstr "[Domain](structure/domain.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Middleware](structure/middleware.md) +" +#, fuzzy +#| msgid "[Middleware](structure/middleware.md) +" +msgid "[Middleware](structure/middleware.md)" msgstr "[Middleware](structure/middleware.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Packages](structure/package.md) +" +#, fuzzy +#| msgid "[Packages](structure/package.md) +" +msgid "[Packages](structure/package.md)" msgstr "[Packages](structure/package.md) +" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Key concepts +" +#, fuzzy, no-wrap +#| msgid "Key concepts +" +msgid "Key concepts" msgstr "Konsep Dasar -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Class autoloading](concept/autoloading.md) +" +#, fuzzy +#| msgid "[Class autoloading](concept/autoloading.md) +" +msgid "[Class autoloading](concept/autoloading.md)" msgstr "[Class autoloading](concept/autoloading.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Dependency injection container](concept/di-container.md) +" +#, fuzzy +#| msgid "[Dependency injection container](concept/di-container.md) +" +msgid "[Dependency injection container](concept/di-container.md)" msgstr "[Dependency Injection Container](concept/di-container.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Configuration](concept/configuration.md) +" +#, fuzzy +#| msgid "[Configuration](concept/configuration.md) +" +msgid "[Configuration](concept/configuration.md)" msgstr "[Configuration](concept/configuration.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Aliases](concept/aliases.md) +" +#, fuzzy +#| msgid "[Aliases](concept/aliases.md) +" +msgid "[Aliases](concept/aliases.md)" msgstr "[Aliases](concept/aliases.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Events](concept/events.md) +" +#, fuzzy +#| msgid "[Events](concept/events.md) +" +msgid "[Events](concept/events.md)" msgstr "[Events](concept/events.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Immutability](concept/immutability.md) +" +msgid "[Immutability](concept/immutability.md)" msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Handling requests +" +#, fuzzy, no-wrap +#| msgid "Handling requests +" +msgid "Handling requests" msgstr "Menangani Permintaan -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Routing and URL generation](runtime/routing.md) +" +#, fuzzy +#| msgid "[Routing and URL generation](runtime/routing.md) +" +msgid "[Routing and URL generation](runtime/routing.md)" msgstr "[Routing and URL generation](runtime/routing.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Request](runtime/request.md) +" +#, fuzzy +#| msgid "[Request](runtime/request.md) +" +msgid "[Request](runtime/request.md)" msgstr "[Request](runtime/request.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Response](runtime/response.md) +" +#, fuzzy +#| msgid "[Response](runtime/response.md) +" +msgid "[Response](runtime/response.md)" msgstr "[Response](runtime/response.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Sessions](runtime/sessions.md) +" +#, fuzzy +#| msgid "[Sessions](runtime/sessions.md) +" +msgid "[Sessions](runtime/sessions.md)" msgstr "[Sessions](runtime/sessions.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Cookies](runtime/cookies.md) +" +#, fuzzy +#| msgid "[Cookies](runtime/cookies.md) +" +msgid "[Cookies](runtime/cookies.md)" msgstr "[Cookies](runtime/cookies.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Handling errors](runtime/handling-errors.md) +" +#, fuzzy +#| msgid "[Handling errors](runtime/handling-errors.md) +" +msgid "[Handling errors](runtime/handling-errors.md)" msgstr "[Handling errors](runtime/handling-errors.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Logging](runtime/logging.md) +" +#, fuzzy +#| msgid "[Logging](runtime/logging.md) +" +msgid "[Logging](runtime/logging.md)" msgstr "[Logging](runtime/logging.md) +" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -#, fuzzy +#, fuzzy, no-wrap #| msgid "Views -" -msgid "Views +" +msgid "Views" msgstr "Tampilan -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md #, fuzzy #| msgid "[Views](views/view.md) -" -msgid "[View](views/view.md) +" +msgid "[View](views/view.md)" msgstr "[Views](views/view.md) -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md #, fuzzy #| msgid "[Template engines](views/template-engines.md) -" -msgid "[Template engines](views/template-engines.md) +- TODO: verify!" +msgid "[Template engines](views/template-engines.md) TODO: verify!" msgstr "[Template Engines](views/template-engines.md) -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[View injections](views/view-injections.md) +" -msgstr "" +#, fuzzy +#| msgid "[Views](views/view.md) -" +msgid "[View injections](views/view-injections.md)" +msgstr "[Views](views/view.md) -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Scripts, styles and metatags](views/script-style-meta.md) +- TODO: verify!" -msgstr "" +#, fuzzy +#| msgid "[Assets](views/asset.md) -" +msgid "[Scripts, styles and metatags](views/script-style-meta.md) TODO: verify!" +msgstr "[Assets](views/asset.md) -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md #, fuzzy #| msgid "[Assets](views/asset.md) -" -msgid "[Assets](views/asset.md) +- TODO: verify!" +msgid "[Assets](views/asset.md) TODO: verify!" msgstr "[Assets](views/asset.md) -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md #, fuzzy #| msgid "[Widgets](views/widget.md) -" -msgid "[Widgets](views/widget.md) +- TODO: verify!" +msgid "[Widgets](views/widget.md) TODO: verify!" msgstr "[Widgets](views/widget.md) -" -#. type: Plain text -#: ../../guide/en/README.md -msgid "Working with databases +-" -msgstr "Bekerja Dengan Basis Data +-" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Database access objects](db-dao.md): Connecting to a database, basic queries, transactions, and schema manipulation" -msgstr "[Database Access Objects](db-dao.md): Menghubungkan ke basis data, permintaan dasar,transaksi, dan manipulasi skema" +#. type: Title # +#: ../../guide/en/README.md ../../guide/en/start/databases.md +#, no-wrap +msgid "Working with databases" +msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Query builder](db-query-builder.md): Querying the database using a simple abstraction layer" -msgstr "[Query Builder](db-query-builder.md): Meminta basis data menggunakan lapisan abstraksi sederhana" +#, fuzzy +#| msgid "[Validating input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md) +" +msgid "[Yii DB](https://github.com/yiisoft/db/blob/master/docs/guide/en/README.md)" +msgstr "[Memvalidasi Input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Active record](db-active-record.md): The Active Record ORM, retrieving and manipulating records, and defining relations" -msgstr "[Active Record](db-active-record.md): Active Record ORM, mengambil dan memanipulasi catatan, dan mendefinisikan hubungan" +#, fuzzy +#| msgid "[Validating input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md) +" +msgid "[Active Record](https://github.com/yiisoft/active-record/blob/master/README.md)" +msgstr "[Memvalidasi Input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Migrations](databases/db-migrations.md): +" +#, fuzzy +#| msgid "[Migrations](databases/db-migrations.md): +" +msgid "[Migrations](databases/db-migrations.md) TODO: verify/update!" msgstr "[Migrations](db-migrations.md): +" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Getting data from users -" +#, fuzzy, no-wrap +#| msgid "Getting data from users -" +msgid "Getting data from users" msgstr "Mendapatkan Data dari Pengguna -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Creating forms](input/forms.md) -" +#, fuzzy +#| msgid "[Creating forms](input/forms.md) -" +msgid "[Creating forms](input/forms.md) TODO" msgstr "[Membuat Formulir](input/forms.md) -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Validating input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md) +" +#, fuzzy +#| msgid "[Validating input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md) +" +msgid "[Validating input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md)" msgstr "[Memvalidasi Input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Uploading files](input/file-upload.md) -" +#, fuzzy +#| msgid "[Uploading files](input/file-upload.md) -" +msgid "[Uploading files](input/file-upload.md) TODO" msgstr "[Mengunggah File](input/file-upload.md) -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Collecting tabular input](input/tabular-input.md) -" +#, fuzzy +#| msgid "[Collecting tabular input](input/tabular-input.md) -" +msgid "[Collecting tabular input](input/tabular-input.md) TODO" msgstr "[Mengumpulkan Input Tabular](input/tabular-input.md) -" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Displaying data -" +#, fuzzy, no-wrap +#| msgid "Displaying data -" +msgid "Displaying data" msgstr "Menampilkan Data -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Data formatting](output/formatting.md) -" +#, fuzzy +#| msgid "[Data formatting](output/formatting.md) -" +msgid "[Data formatting](output/formatting.md) TODO" msgstr "[Data Formatting](output/formatting.md) -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Pagination](output/pagination.md) -" +#, fuzzy +#| msgid "[Pagination](output/pagination.md) -" +msgid "[Pagination](output/pagination.md) TODO" msgstr "[Pagination](output/pagination.md) -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Sorting](output/sorting.md) -" +#, fuzzy +#| msgid "[Sorting](output/sorting.md) -" +msgid "[Sorting](output/sorting.md) TODO" msgstr "[Sorting](output/sorting.md) -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Data providers](output/data-providers.md) -" +#, fuzzy +#| msgid "[Data providers](output/data-providers.md) -" +msgid "[Data providers](output/data-providers.md) TODO" msgstr "[Data Providers](output/data-providers.md) -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Data widgets](output/data-widgets.md) -" +#, fuzzy +#| msgid "[Data widgets](output/data-widgets.md) -" +msgid "[Data widgets](output/data-widgets.md) TODO" msgstr "[Data Widgets](output/data-widgets.md) -" -#. type: Plain text -#: ../../guide/en/README.md -msgid "Security +-" -msgstr "Keamanan +-" +#. type: Title # +#: ../../guide/en/README.md ../../guide/en/security/overview.md +#, no-wrap +msgid "Security" +msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Security overview](security/overview.md) +" +#, fuzzy +#| msgid "[Security overview](security/overview.md) +" +msgid "[Security overview](security/overview.md)" msgstr "[Ikhtisar Overview](security/overview.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Authentication](security/authentication.md) +" +#, fuzzy +#| msgid "[Authentication](security/authentication.md) +" +msgid "[Authentication](security/authentication.md)" msgstr "[Autentikasi](security/authentication.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Authorization](security/authorization.md) +-" +#, fuzzy +#| msgid "[Authorization](security/authorization.md) +-" +msgid "[Authorization](security/authorization.md) TODO: verify and complete!" msgstr "[Otorisasi](security/authorization.md) +-" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Working with passwords](security/passwords.md) +" +#, fuzzy +#| msgid "[Working with passwords](security/passwords.md) +" +msgid "[Working with passwords](security/passwords.md)" msgstr "[Bekerja dengan Kata Sandi](security/passwords.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Cryptography](security/cryptography.md) +" +#, fuzzy +#| msgid "[Cryptography](security/cryptography.md) +" +msgid "[Cryptography](security/cryptography.md)" msgstr "[Kriptografi](security/cryptography.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Best practices](security/best-practices.md) +" +#, fuzzy +#| msgid "[Best practices](security/best-practices.md) +" +msgid "[Best practices](security/best-practices.md)" msgstr "[Praktik terbaik](security/best-practices.md) +" -#. type: Plain text -#: ../../guide/en/README.md -msgid "Caching +-" -msgstr "Caching +-" +#. type: Title # +#: ../../guide/en/README.md ../../guide/en/caching/overview.md +#, no-wrap +msgid "Caching" +msgstr "Caching" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Caching overview](caching/overview.md) +" +#, fuzzy +#| msgid "[Caching overview](caching/overview.md) +" +msgid "[Caching overview](caching/overview.md)" msgstr "[Ikhtisar Caching](caching/overview.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Data caching](caching/data.md) +" +#, fuzzy +#| msgid "[Data caching](caching/data.md) +" +msgid "[Data caching](caching/data.md)" msgstr "[Data Caching](caching/data.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Fragment caching](caching/fragment.md) -" +#, fuzzy +#| msgid "[Fragment caching](caching/fragment.md) -" +msgid "[Fragment caching](caching/fragment.md) TODO" msgstr "[Fragment Caching](caching/fragment.md) -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Page caching](caching/page.md) -" +#, fuzzy +#| msgid "[Page caching](caching/page.md) -" +msgid "[Page caching](caching/page.md) TODO" msgstr "[Page Caching](caching/page.md) -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[HTTP caching](caching/http.md) -" +#, fuzzy +#| msgid "[HTTP caching](caching/http.md) -" +msgid "[HTTP caching](caching/http.md) TODO" msgstr "[HTTP caching](caching/http.md) -" -#. type: Title - +#. type: Title ## #: ../../guide/en/README.md -#, no-wrap -msgid "REST APIs -" +#, fuzzy, no-wrap +#| msgid "REST APIs -" +msgid "REST APIs" msgstr "RESTful Web Services -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Quick start](rest/quick-start.md)" +#, fuzzy +#| msgid "[Quick start](rest/quick-start.md)" +msgid "[Quick start](rest/quick-start.md) TODO" msgstr "[Mulai cepat](rest/quick-start.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Resources](rest/resources.md)" +#, fuzzy +#| msgid "[Resources](rest/resources.md)" +msgid "[Resources](rest/resources.md) TODO" msgstr "[Resources](rest/resources.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Controllers](rest/controllers.md)" +#, fuzzy +#| msgid "[Controllers](rest/controllers.md)" +msgid "[Controllers](rest/controllers.md) TODO" msgstr "[Controllers](rest/controllers.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Routing](rest/routing.md)" +#, fuzzy +#| msgid "[Routing](rest/routing.md)" +msgid "[Routing](rest/routing.md) TODO" msgstr "[Routing](rest/routing.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Authentication](rest/authentication.md)" +#, fuzzy +#| msgid "[Authentication](rest/authentication.md)" +msgid "[Authentication](rest/authentication.md) TODO" msgstr "[Authentication](rest/authentication.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Rate limiting](rest/rate-limiting.md)" +#, fuzzy +#| msgid "[Rate limiting](rest/rate-limiting.md)" +msgid "[Rate limiting](rest/rate-limiting.md) TODO" msgstr "[Rate Limiting](rest/rate-limiting.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Versioning](rest/versioning.md)" +#, fuzzy +#| msgid "[Versioning](rest/versioning.md)" +msgid "[Versioning](rest/versioning.md) TODO" msgstr "[Versioning](rest/versioning.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Error handling](rest/error-handling.md)" +#, fuzzy +#| msgid "[Error handling](rest/error-handling.md)" +msgid "[Error handling](rest/error-handling.md) TODO" msgstr "[Error Handling](rest/error-handling.md)" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Development tools -" +#, fuzzy, no-wrap +#| msgid "Development tools -" +msgid "Development tools" msgstr "Alat Pengembangan -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "Debug toolbar and debugger" msgstr "Debug Toolbar and Debugger" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "Generating code using Gii" msgstr "Membuat Kode menggunakan Gii" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "Generating API documentation" msgstr "Membuat Dokumentasi API" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Testing -" +#, fuzzy, no-wrap +#| msgid "Testing -" +msgid "Testing" msgstr "Pengujian -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Testing overview](testing/overview.md)" +#, fuzzy +#| msgid "[Testing overview](testing/overview.md)" +msgid "[Testing overview](testing/overview.md) TODO" msgstr "[Ikhtisar Pengujian](testing/overview.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Testing environment setup](testing/environment-setup.md)" +#, fuzzy +#| msgid "[Testing environment setup](testing/environment-setup.md)" +msgid "[Testing environment setup](testing/environment-setup.md) TODO" msgstr "[Pengaturan lingkungan pengujian](testing/environment-setup.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Unit tests](testing/unit.md)" +#, fuzzy +#| msgid "[Unit tests](testing/unit.md)" +msgid "[Unit tests](testing/unit.md) TODO" msgstr "[Unit Tests](testing/unit.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Functional tests](testing/functional.md)" +#, fuzzy +#| msgid "[Functional tests](testing/functional.md)" +msgid "[Functional tests](testing/functional.md) TODO" msgstr "[Functional Tests](testing/functional.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Acceptance tests](testing/acceptance.md)" +#, fuzzy +#| msgid "[Acceptance tests](testing/acceptance.md)" +msgid "[Acceptance tests](testing/acceptance.md) TODO" msgstr "[Acceptance Tests](testing/acceptance.md)" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Fixtures](testing/fixtures.md)" +#, fuzzy +#| msgid "[Fixtures](testing/fixtures.md)" +msgid "[Fixtures](testing/fixtures.md) TODO" msgstr "[Fixtures](testing/fixtures.md)" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Special topics -" +#, fuzzy, no-wrap +#| msgid "Special topics -" +msgid "Special topics" msgstr "Topik Khusus -" -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Building application from scratch](tutorial/start-from-scratch.md) -" -msgstr "[Membangun Aplikasi dari Awal](tutorial/start-from-scratch.md) -" - -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Console applications](tutorial/console-applications.md) +" +#, fuzzy +#| msgid "[Console applications](tutorial/console-applications.md) +" +msgid "[Console applications](tutorial/console-applications.md)" msgstr "[Aplikasi Konsol](tutorial/console-applications.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Docker](tutorial/docker.md) -" -msgstr "[Docker](tutorial/docker.md) -" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Internationalization](tutorial/i18n.md) -" +#, fuzzy +#| msgid "[Internationalization](tutorial/i18n.md) -" +msgid "[Internationalization](tutorial/i18n.md) TODO" msgstr "[Penginternasionalan](tutorial/i18n.md) -" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Mailing](tutorial/mailing.md) +" +#, fuzzy +#| msgid "[Mailing](tutorial/mailing.md) +" +msgid "[Mailing](tutorial/mailing.md)" msgstr "[Mailing](tutorial/mailing.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Performance tuning](tutorial/performance-tuning.md) +" +#, fuzzy +#| msgid "[Performance tuning](tutorial/performance-tuning.md) +" +msgid "[Performance tuning](tutorial/performance-tuning.md)" msgstr "[Penyesuaian Kinerja](tutorial/performance-tuning.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Using Yii with event loop](tutorial/using-with-event-loop.md) +" +#, fuzzy +#| msgid "[Using Yii with event loop](tutorial/using-with-event-loop.md) +" +msgid "[Using Yii with event loop](tutorial/using-with-event-loop.md)" msgstr "[Menggunakan Yii dengan event loop](tutorial/using-with-event-loop.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Using Yii with RoadRunner](tutorial/using-yii-with-roadrunner.md) +" +#, fuzzy +#| msgid "[Using Yii with RoadRunner](tutorial/using-yii-with-roadrunner.md) +" +msgid "[Using Yii with RoadRunner](tutorial/using-yii-with-roadrunner.md)" msgstr "[Menggunakan Yii dengan RoadRunner](tutorial/using-yii-with-roadrunner.md) +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Using Yii with Swoole](tutorial/using-yii-with-swoole.md) +" +#, fuzzy +#| msgid "[Using Yii with Swoole](tutorial/using-yii-with-swoole.md) +" +msgid "[Using Yii with Swoole](tutorial/using-yii-with-swoole.md)" msgstr "[Menggunakan Yii dengan Swoole](using-yii-with-swoole.md) +" -#. type: Plain text -#: ../../guide/en/README.md -msgid "Widgets -" -msgstr "Widgets -" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[GridView](https://www.yiiframework.com/doc-2.0/yii-grid-gridview.html)" -msgstr "[GridView](https://www.yiiframework.com/doc-2.0/yii-grid-gridview.html)" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[ListView](https://www.yiiframework.com/doc-2.0/yii-widgets-listview.html)" -msgstr "[ListView](https://www.yiiframework.com/doc-2.0/yii-widgets-listview.html)" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[DetailView](https://www.yiiframework.com/doc-2.0/yii-widgets-detailview.html)" -msgstr "[DetailView](https://www.yiiframework.com/doc-2.0/yii-widgets-detailview.html)" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[ActiveForm](https://www.yiiframework.com/doc-2.0/guide-input-forms.html#activerecord-based-forms-activeform)" -msgstr "[ActiveForm](https://www.yiiframework.com/doc-2.0/guide-input-forms.html#activerecord-based-forms-activeform)" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Menu](https://www.yiiframework.com/doc-2.0/yii-widgets-menu.html)" -msgstr "[Menu](https://www.yiiframework.com/doc-2.0/yii-widgets-menu.html)" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[LinkPager](https://www.yiiframework.com/doc-2.0/yii-widgets-linkpager.html)" -msgstr "[LinkPager](https://www.yiiframework.com/doc-2.0/yii-widgets-linkpager.html)" - -#. type: Bullet: '* ' +#. type: Title ## #: ../../guide/en/README.md -msgid "[LinkSorter](https://www.yiiframework.com/doc-2.0/yii-widgets-linksorter.html)" -msgstr "[LinkSorter](https://www.yiiframework.com/doc-2.0/yii-widgets-linksorter.html)" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Bootstrap widgets](https://www.yiiframework.com/extension/yiisoft/yii2-bootstrap/doc/guide)" -msgstr "[Bootstrap Widgets](https://www.yiiframework.com/extension/yiisoft/yii2-bootstrap/doc/guide)" - -#. type: Plain text -#: ../../guide/en/README.md -msgid "Helpers +" +#, fuzzy, no-wrap +#| msgid "Helpers +" +msgid "Helpers" msgstr "Helpers +" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Arrays](https://github.com/yiisoft/arrays/)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Files](https://github.com/yiisoft/files/)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Html](https://github.com/yiisoft/html/)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Json](https://github.com/yiisoft/json)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Network utilities](https://github.com/yiisoft/network-utilities/)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[VarDumper](https://github.com/yiisoft/var-dumper)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Strings](https://github.com/yiisoft/strings)" msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Extras +" +#, fuzzy, no-wrap +#| msgid "Extras +" +msgid "Extras" msgstr "Lainnya+" -#. type: Bullet: '* ' +#. type: Bullet: '- ' +#: ../../guide/en/README.md +msgid "[Cookbook](../../cookbook/en/README.md)" +msgstr "" + +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Glossary](glossary.md)" msgstr "[Glosarium](glossary.md)" diff --git a/_translations/guide/po/id/databases_db-migrations.md.po b/_translations/guide/po/id/databases_db-migrations.md.po index ec9935e..144e6e8 100644 --- a/_translations/guide/po/id/databases_db-migrations.md.po +++ b/_translations/guide/po/id/databases_db-migrations.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-11 10:15+0500\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -26,8 +26,8 @@ msgstr "" msgid "To use migrations, install [yiisoft/db-migration](https://github.com/yiisoft/db-migration/) package:" msgstr "" -#. type: Fenced code block (shell) -#: ../../guide/en/databases/db-migrations.md +#. type: Fenced code block (sh) +#: ../../guide/en/databases/db-migrations.md ../../guide/en/start/databases.md #, no-wrap msgid "composer require yiisoft/db-migration\n" msgstr "" diff --git a/_translations/guide/po/id/glossary.md.po b/_translations/guide/po/id/glossary.md.po index 250ad38..1bf7bc6 100644 --- a/_translations/guide/po/id/glossary.md.po +++ b/_translations/guide/po/id/glossary.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-11 10:15+0500\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: 2025-09-11 10:15+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -41,7 +41,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "Asset refers to a resource file. Typically, it contains JavaScript or CSS code but can be any static content accessed via HTTP." +msgid "Asset refers to a resource file. Typically, it contains JavaScript or CSS code but can be any static content accessed via HTTP. Read more in [\"Assets\"](views/asset.md)." msgstr "" #. type: Title # @@ -58,7 +58,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "The Configuration may refer either to the process of setting properties of an object or to a configuration file that stores settings for an object, or a class of objects. Read more in [\"Configuration\"](concept/configuration.md)." +msgid "The Configuration may refer either to the process of setting properties of an object or to a configuration file that stores settings for an object, or a class of objects. Read more in [\"Configuration\"](concept/configuration.md)." msgstr "" #. type: Title # @@ -75,7 +75,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "Dependency Injection is a programming technique where an object injects a dependent object. [\"DI\"](concept/di-container.md)" +msgid "Dependency Injection is a programming technique where an object injects a dependent object. Read more in [\"Dependency injection and container\"](concept/di-container.md)." msgstr "" #. type: Title # @@ -109,7 +109,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "Middleware is a processor in the request processing stack. Given a request, it may either produce a response or do some action and pass processing to the next middleware. Read more in [\"Middleware\"](structure/middleware.md)." +msgid "Middleware is a processor in the request processing stack. Given a request, it may either produce a response or do some action and pass processing to the next middleware. Read more in [\"Middleware\"](structure/middleware.md)." msgstr "" #. type: Title ## @@ -120,7 +120,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "The module is a sub-application that groups some code based on a use-case. It's typically used within the main application and may contain URL handlers or console commands." +msgid "The module is a namespace that groups some code based on a use-case. It's typically used within the main application and may contain any source code, define additional URL handlers or console commands." msgstr "" #. type: Title # @@ -137,7 +137,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "Namespace refers to a [PHP language feature](https://www.php.net/manual/en/language.namespaces.php)." +msgid "Namespace refers to a [PHP language feature](https://www.php.net/manual/en/language.namespaces.php) to group multiple classes under a certain name." msgstr "" #. type: Title # @@ -188,7 +188,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "A queue is similar to a stack. Queue follows First-In-First-Out methodology." +msgid "A queue is similar to a stack. Queue follows First-In-First-Out methodology. Yii has a [yiisoft/queue](https://github.com/yiisoft/queue) package." msgstr "" #. type: Title # @@ -205,5 +205,5 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "A Vendor is an organization or individual developer providing code in the form of packages. It also may refer to [Composer's `vendor` directory](https://getcomposer.org/doc/)." +msgid "A Vendor is an organization or individual developer providing code in the form of packages. It also may refer to [Composer's `vendor` directory](https://getcomposer.org/doc/)." msgstr "" diff --git a/_translations/guide/po/id/intro_upgrade-from-v2.md.po b/_translations/guide/po/id/intro_upgrade-from-v2.md.po index bab77a7..445713e 100644 --- a/_translations/guide/po/id/intro_upgrade-from-v2.md.po +++ b/_translations/guide/po/id/intro_upgrade-from-v2.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-04 11:19+0500\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -15,14 +15,20 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#. type: Title ### +#: ../../guide/en/README.md ../../guide/en/intro/upgrade-from-v2.md +#, no-wrap +msgid "Application structure" +msgstr "" + #. type: Title # -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Upgrading from Version 2.0" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "" "> If you haven't used Yii2, you can skip this section and get directly to \"[getting started](../start/installation.md)\"\n" @@ -30,100 +36,100 @@ msgid "" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "While sharing some common ideas and values, Yii 3 is conceptually different from Yii 2. There is no easy upgrade path, so first [check maintenance policy and end-of-life dates for Yii 2](https://www.yiiframework.com/release-cycle) and consider starting new projects on Yii 3 while keeping existing ones on Yii 2." msgstr "" #. type: Title ## -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "PHP requirements" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Yii3 requires PHP 8.2 or above. As a result, there are language features used that weren't used in Yii 2:" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Type declarations](https://www.php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Return type declarations](https://www.php.net/manual/en/functions.returning-values.php#functions.returning-values.type-declaration)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Class constant visibility](https://www.php.net/manual/en/language.oop5.constants.php)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Named arguments](https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Anonymous classes](https://www.php.net/manual/en/language.oop5.anonymous.php)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[::class](https://www.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Generators](https://www.php.net/manual/en/language.generators.php)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Variadic functions](https://www.php.net/manual/en/functions.arguments.php#functions.variable-arg-list)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Readonly properties](https://www.php.net/manual/en/language.oop5.properties.php#language.oop5.properties.readonly-properties)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Readonly classes](https://www.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.readonly)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Constructor property promotion](https://www.php.net/manual/en/language.oop5.decon.php#language.oop5.decon.constructor.promotion)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Attributes](https://www.php.net/manual/en/language.attributes.php)" msgstr "" #. type: Title ## -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Preliminary refactoring" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "It's a good idea to refactor your Yii 2 project before porting it to Yii 3. That would both make porting easier and benefit the project in question while it's not moved to Yii 3 yet." msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Use DI instead of the service locator" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "" "Since Yii 3 is forcing you to inject dependencies, it's a good idea to prepare and switch from using\n" @@ -131,7 +137,7 @@ msgid "" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "" "If usage of DI container is problematic for whatever reason, consider moving all calls to `Yii::$app->` to controller\n" @@ -139,23 +145,23 @@ msgid "" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "See [Dependency injection and container](../concept/di-container.md) for an explanation of the idea." msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Introduce repositories for getting data" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Since Active Record isn't the only way to work with a database in Yii 3, consider introducing repositories that would hide details of getting data and gather them in a single place. You can later redo it:" msgstr "" #. type: Fenced code block (php) -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "" "final readonly class PostRepository\n" @@ -174,93 +180,88 @@ msgid "" msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Separate domain layer from infrastructure" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "In case you have a rich complicated domain, it's a good idea to separate it from infrastructure provided by a framework that's all the business logic has to go to framework-independent classes." msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Move more into components" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Yii 3 services are conceptually similar to Yii 2 components, so it's a good idea to move reusable parts of your application into components." msgstr "" #. type: Title ## -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Things to learn" msgstr "" #. type: Title ## -#: en/intro/upgrade-from-v2.md en/start/prerequisites.md +#: ../../guide/en/intro/upgrade-from-v2.md +#: ../../guide/en/start/prerequisites.md #, no-wrap msgid "Docker" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Default application templates are using [Docker](https://www.docker.com/get-started/) to run application. It's a good idea to learn how to use it and use it for your own projects since it provides a lot of benefits:" msgstr "" #. type: Bullet: '1. ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Exactly the same environment as in production." msgstr "" #. type: Bullet: '2. ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "No need to install anything except Docker itself." msgstr "" #. type: Bullet: '3. ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Environment is per application, not per server." msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Environment variables" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Yii3 application templates are using [environment variables](https://en.wikipedia.org/wiki/Environment_variable) to configure pars of the application. The concept is [very handy for Dockerized applications](https://12factor.net/) but might be alien to users of Yii 1.1 and Yii 2." msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Handlers" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Unlike Yii2, Yii3 doesn't have controllers per se. Instead, it uses [handlers](../structure/handler.md) which are similar to controllers but different." msgstr "" -#. type: Title ### -#: en/intro/upgrade-from-v2.md -#, no-wrap -msgid "Application structure" -msgstr "" - #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Suggested Yii3 application structure is different from Yii 2. It's described in [application structure](../structure/overview.md)." msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Despite that, Yii3 is flexible, so it's still possible to use a structure similar to Yii 2 with Yii 3." msgstr "" diff --git a/_translations/guide/po/id/start_databases.md.po b/_translations/guide/po/id/start_databases.md.po index 070b58e..dccfb7f 100644 --- a/_translations/guide/po/id/start_databases.md.po +++ b/_translations/guide/po/id/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-04 11:19+0500\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -16,104 +16,302 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #. type: Title # -#: en/start/databases.md +#: ../../guide/en/README.md ../../guide/en/start/databases.md #, no-wrap msgid "Working with databases" msgstr "" +#. type: Fenced code block (sh) +#: ../../guide/en/databases/db-migrations.md ../../guide/en/start/databases.md +#, no-wrap +msgid "composer require yiisoft/db-migration\n" +msgstr "" + #. type: Plain text -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "Yii doesn't dictate using a particular database or storage for your application. There are many ways you can work with relational databases:" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[Yii DB](https://github.com/yiisoft/db)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[Yii Active Record](https://github.com/yiisoft/active-record)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[Cycle](https://github.com/cycle) via [Yii Cycle package](https://github.com/yiisoft/yii-cycle)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[PDO](https://www.php.net/manual/en/book.pdo.php)" msgstr "" #. type: Plain text -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "For non-relational ones, there are usually official libraries available:" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[ElasticSearch](https://github.com/elastic/elasticsearch-php)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[Redis](https://redis.io/docs/clients/#php)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "..." msgstr "" #. type: Plain text -#: en/start/databases.md -msgid "In this guide, we will focus on working with relational databases using Yii DB." +#: ../../guide/en/start/databases.md +msgid "In this guide, we will focus on working with relational databases using Yii DB. We'll use PostgreSQL to implement a simple CRUD (create read update delete)." msgstr "" #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "Installing PostgreSQL" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "You need to install PostgreSQL. If you prefer not to use Docker, [get the installer from official website](https://www.postgresql.org/download/), install it and create a database." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "If you use Docker, it is a bit simpler. Modify `docker/dev/compose.yml`:" +msgstr "" + +#. type: Fenced code block (yaml) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"services:\n" +" app:\n" +" build:\n" +" dockerfile: docker/Dockerfile\n" +" context: ..\n" +" target: dev\n" +" args:\n" +" USER_ID: ${UID}\n" +" GROUP_ID: ${GID}\n" +" env_file:\n" +" - path: ./dev/.env\n" +" - path: ./dev/override.env\n" +" required: false\n" +" ports:\n" +" - \"${DEV_PORT:-80}:80\"\n" +" volumes:\n" +" - ../:/app\n" +" - ../runtime:/app/runtime\n" +" - caddy_data:/data\n" +" - caddy_config:/config\n" +" tty: true\n" +" depends_on:\n" +" db:\n" +" condition: service_healthy\n" +"\n" +" db:\n" +" image: postgres:${POSTGRES_VERSION:-15}-alpine\n" +" environment:\n" +" POSTGRES_DB: app\n" +" POSTGRES_PASSWORD: password\n" +" POSTGRES_USER: user\n" +" volumes:\n" +" - ./runtime/db:/var/lib/postgresql/data:rw\n" +" ports:\n" +" - \"${DEV_DB_PORT:-5432}:5432\"\n" +" healthcheck:\n" +" test: [ \"CMD-SHELL\", \"pg_isready -U user -d app\" ]\n" +" interval: 5s\n" +" timeout: 5s\n" +" retries: 5\n" +"\n" +"volumes:\n" +" db:\n" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Note that we add `depends_on` so application waits for database to be up." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Also, we'll need a `pdo_pgsql` extension to communicate with PostgreSQL. You can enable it locally in `php.ini`. If you use Docker, check `docker/Dockerfile` and add `pdo_pgsql` in `install-php-extensions` list. Then rebuild PHP image with `make build && make down && make up`." +msgstr "" + +#. type: Title ## +#: ../../guide/en/start/databases.md #, no-wrap msgid "Configuring connection" msgstr "" +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Now that we have the database, it's time to define the connection. We need a package to be installed first:" +msgstr "" + +#. type: Fenced code block (sh) +#: ../../guide/en/start/databases.md +#, fuzzy, no-wrap +#| msgid "composer require yiisoft/cache\n" +msgid "composer require yiisoft/db-pgsql\n" +msgstr "composer require yiisoft/cache\n" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Now create `config/common/di/db-pgsql.php`:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +" [\n" +" 'class' => Connection::class,\n" +" '__construct()' => [\n" +" 'driver' => new Driver(\n" +" $params['yiisoft/db-pgsql']['dsn'],\n" +" $params['yiisoft/db-pgsql']['username'],\n" +" $params['yiisoft/db-pgsql']['password'],\n" +" ),\n" +" ],\n" +" ],\n" +"];\n" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "And define parameters in `config/common/params.php`. For Docker that would be:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"use Yiisoft\\Db\\Pgsql\\Dsn;\n" +"\n" +"return [\n" +" // ...\n" +" 'yiisoft/db-pgsql' => [\n" +" 'dsn' => (new Dsn('pgsql', 'db', 'app', '5432'))->asString(),\n" +" 'username' => 'user',\n" +" 'password' => 'password',\n" +" ],\n" +"];\n" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "`db` host is resolved automatically within the Docker network." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "For local installation without Docker the host in Dsn would be `localhost`. You'll have to adjust the rest to match how you configured the database." +msgstr "" + #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap -msgid "Creating and applying migration" +msgid "Creating and applying migrations" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "For the initial state of the application and for further database changes, it is a good idea to use migrations. These are files creating changes to be applied to the database. Which are applied is tracked in the same database so we always know which state is it now and what is to be applied." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "To use migrations we need another package installed:" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "And a directory to store migrations such as `migrations` right in the project root." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Now you can use `yii migrate:create user` to create a new migration. For our example we need a `page` table with some columns:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"\n" +"public function up(MigrationBuilder $b): void\n" +"{\n" +" $b->createTable('page', [\n" +" 'id' => $b->primaryKey(),\n" +" 'title' => $b->string()->notNull(),\n" +" 'text' => $b->text()->notNull(),\n" +" 'created_at' => $b->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'),\n" +" 'updated_at' => $b->dateTime(),\n" +" 'deleted_at' => $b->dateTime(),\n" +" ]);\n" +"}\n" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Apply it with `yii migrate:up`." msgstr "" #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "Inserting" msgstr "" #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "Selecting" msgstr "" #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "Using data package" msgstr "" #. type: Title ### -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "Pagination" msgstr "" #. type: Plain text -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "" "> [!NOTE]\n" diff --git a/_translations/guide/po/ru/README.md.po b/_translations/guide/po/ru/README.md.po index 92bc67f..dea4ca2 100644 --- a/_translations/guide/po/ru/README.md.po +++ b/_translations/guide/po/ru/README.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-10-19 11:32+0000\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: 2025-09-03 17:50+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -27,608 +27,577 @@ msgstr "" msgid "We release this guide under the [Terms of Yii Documentation](https://www.yiiframework.com/license#docs)." msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Introduction +" +#, no-wrap +msgid "Introduction" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[About Yii](intro/what-is-yii.md) +" +msgid "[About Yii](intro/what-is-yii.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Upgrading from version 2.0](intro/upgrade-from-v2.md) +" +msgid "[Upgrading from version 2.0](intro/upgrade-from-v2.md)" msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Getting started -" +#, no-wrap +msgid "Getting started" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[What do you need to know?](start/prerequisites.md) +" +msgid "[What do you need to know?](start/prerequisites.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Creating a project](start/creating-project.md) +" +msgid "[Creating a project](start/creating-project.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Running applications](start/workflow.md) +" +msgid "[Running applications](start/workflow.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Saying hello](start/hello.md) +" +msgid "[Saying hello](start/hello.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Working with forms](start/forms.md) +" +msgid "[Working with forms](start/forms.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Working with databases](start/databases.md) !" +msgid "[Working with databases](start/databases.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Generating code with Gii](start/gii.md) -" -msgstr "" +#, fuzzy +#| msgid "Generating random data" +msgid "[Generating code with Gii](start/gii.md) TODO" +msgstr "Генерация случайных данных" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Looking ahead](start/looking-ahead.md) +" +msgid "[Looking ahead](start/looking-ahead.md)" msgstr "" -#. type: Plain text -#: ../../guide/en/README.md -msgid "Application structure +" +#. type: Title ### +#: ../../guide/en/README.md ../../guide/en/intro/upgrade-from-v2.md +#, no-wrap +msgid "Application structure" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Application structure overview](structure/overview.md) +" +msgid "[Application structure overview](structure/overview.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Entry scripts](structure/entry-script.md) +" +msgid "[Entry scripts](structure/entry-script.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Application](structure/application.md) +" +msgid "[Application](structure/application.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Service components](structure/service.md) +" +msgid "[Service components](structure/service.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Actions](structure/action.md) +" +msgid "[Actions](structure/action.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Domain](structure/domain.md) +" +msgid "[Domain](structure/domain.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Middleware](structure/middleware.md) +" +msgid "[Middleware](structure/middleware.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Packages](structure/package.md) +" +msgid "[Packages](structure/package.md)" msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Key concepts +" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Class autoloading](concept/autoloading.md) +" +#, no-wrap +msgid "Key concepts" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Dependency injection container](concept/di-container.md) +" +msgid "[Class autoloading](concept/autoloading.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Configuration](concept/configuration.md) +" -msgstr "" +#, fuzzy +#| msgid "Dependency injection and container" +msgid "[Dependency injection container](concept/di-container.md)" +msgstr "Внедрение зависимостей и контейнер внедрения зависимостей" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Aliases](concept/aliases.md) +" -msgstr "" +#, fuzzy +#| msgid "Secure server configuration" +msgid "[Configuration](concept/configuration.md)" +msgstr "Безопасная конфигурация сервера" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Events](concept/events.md) +" +msgid "[Aliases](concept/aliases.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Immutability](concept/immutability.md) +" +msgid "[Events](concept/events.md)" msgstr "" -#. type: Plain text +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "Handling requests +" +msgid "[Immutability](concept/immutability.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Title ## #: ../../guide/en/README.md -msgid "[Routing and URL generation](runtime/routing.md) +" +#, no-wrap +msgid "Handling requests" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Request](runtime/request.md) +" +msgid "[Routing and URL generation](runtime/routing.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Response](runtime/response.md) +" +msgid "[Request](runtime/request.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Sessions](runtime/sessions.md) +" +msgid "[Response](runtime/response.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Cookies](runtime/cookies.md) +" +msgid "[Sessions](runtime/sessions.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Handling errors](runtime/handling-errors.md) +" +msgid "[Cookies](runtime/cookies.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Logging](runtime/logging.md) +" +msgid "[Handling errors](runtime/handling-errors.md)" msgstr "" -#. type: Plain text +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "Views +" +msgid "[Logging](runtime/logging.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Title ## #: ../../guide/en/README.md -msgid "[View](views/view.md) +" +#, no-wrap +msgid "Views" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Template engines](views/template-engines.md) +- TODO: verify!" +msgid "[View](views/view.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[View injections](views/view-injections.md) +" +msgid "[Template engines](views/template-engines.md) TODO: verify!" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Scripts, styles and metatags](views/script-style-meta.md) +- TODO: verify!" +msgid "[View injections](views/view-injections.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Assets](views/asset.md) +- TODO: verify!" +msgid "[Scripts, styles and metatags](views/script-style-meta.md) TODO: verify!" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Widgets](views/widget.md) +- TODO: verify!" +msgid "[Assets](views/asset.md) TODO: verify!" msgstr "" -#. type: Plain text +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "Working with databases +-" +msgid "[Widgets](views/widget.md) TODO: verify!" msgstr "" -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Database access objects](db-dao.md): Connecting to a database, basic queries, transactions, and schema manipulation" +#. type: Title # +#: ../../guide/en/README.md ../../guide/en/start/databases.md +#, no-wrap +msgid "Working with databases" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Query builder](db-query-builder.md): Querying the database using a simple abstraction layer" +msgid "[Yii DB](https://github.com/yiisoft/db/blob/master/docs/guide/en/README.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Active record](db-active-record.md): The Active Record ORM, retrieving and manipulating records, and defining relations" +msgid "[Active Record](https://github.com/yiisoft/active-record/blob/master/README.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Migrations](databases/db-migrations.md): +" +msgid "[Migrations](databases/db-migrations.md) TODO: verify/update!" msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Getting data from users -" +#, no-wrap +msgid "Getting data from users" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Creating forms](input/forms.md) -" +msgid "[Creating forms](input/forms.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Validating input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md) +" +msgid "[Validating input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Uploading files](input/file-upload.md) -" +msgid "[Uploading files](input/file-upload.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Collecting tabular input](input/tabular-input.md) -" +msgid "[Collecting tabular input](input/tabular-input.md) TODO" msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Displaying data -" +#, no-wrap +msgid "Displaying data" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Data formatting](output/formatting.md) -" +msgid "[Data formatting](output/formatting.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Pagination](output/pagination.md) -" +msgid "[Pagination](output/pagination.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Sorting](output/sorting.md) -" +msgid "[Sorting](output/sorting.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Data providers](output/data-providers.md) -" +msgid "[Data providers](output/data-providers.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Data widgets](output/data-widgets.md) -" +msgid "[Data widgets](output/data-widgets.md) TODO" msgstr "" -#. type: Plain text -#: ../../guide/en/README.md -msgid "Security +-" +#. type: Title # +#: ../../guide/en/README.md ../../guide/en/security/overview.md +#, no-wrap +msgid "Security" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Security overview](security/overview.md) +" +msgid "[Security overview](security/overview.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Authentication](security/authentication.md) +" +msgid "[Authentication](security/authentication.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Authorization](security/authorization.md) +-" +msgid "[Authorization](security/authorization.md) TODO: verify and complete!" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Working with passwords](security/passwords.md) +" +msgid "[Working with passwords](security/passwords.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Cryptography](security/cryptography.md) +" +msgid "[Cryptography](security/cryptography.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Best practices](security/best-practices.md) +" +msgid "[Best practices](security/best-practices.md)" msgstr "" -#. type: Plain text -#: ../../guide/en/README.md -msgid "Caching +-" +#. type: Title # +#: ../../guide/en/README.md ../../guide/en/caching/overview.md +#, no-wrap +msgid "Caching" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Caching overview](caching/overview.md) +" +msgid "[Caching overview](caching/overview.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Data caching](caching/data.md) +" +msgid "[Data caching](caching/data.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Fragment caching](caching/fragment.md) -" +msgid "[Fragment caching](caching/fragment.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Page caching](caching/page.md) -" +msgid "[Page caching](caching/page.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[HTTP caching](caching/http.md) -" +msgid "[HTTP caching](caching/http.md) TODO" msgstr "" -#. type: Title - +#. type: Title ## #: ../../guide/en/README.md #, no-wrap -msgid "REST APIs -" +msgid "REST APIs" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Quick start](rest/quick-start.md)" +msgid "[Quick start](rest/quick-start.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Resources](rest/resources.md)" +msgid "[Resources](rest/resources.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Controllers](rest/controllers.md)" +msgid "[Controllers](rest/controllers.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Routing](rest/routing.md)" +msgid "[Routing](rest/routing.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Authentication](rest/authentication.md)" +msgid "[Authentication](rest/authentication.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Rate limiting](rest/rate-limiting.md)" +msgid "[Rate limiting](rest/rate-limiting.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Versioning](rest/versioning.md)" +msgid "[Versioning](rest/versioning.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Error handling](rest/error-handling.md)" +msgid "[Error handling](rest/error-handling.md) TODO" msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Development tools -" +#, no-wrap +msgid "Development tools" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "Debug toolbar and debugger" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "Generating code using Gii" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "Generating API documentation" msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Testing -" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Testing overview](testing/overview.md)" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Testing environment setup](testing/environment-setup.md)" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Unit tests](testing/unit.md)" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Functional tests](testing/functional.md)" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Acceptance tests](testing/acceptance.md)" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Fixtures](testing/fixtures.md)" -msgstr "" - -#. type: Plain text -#: ../../guide/en/README.md -msgid "Special topics -" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Building application from scratch](tutorial/start-from-scratch.md) -" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Console applications](tutorial/console-applications.md) +" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Docker](tutorial/docker.md) -" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Internationalization](tutorial/i18n.md) -" +#, no-wrap +msgid "Testing" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Mailing](tutorial/mailing.md) +" +msgid "[Testing overview](testing/overview.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Performance tuning](tutorial/performance-tuning.md) +" +msgid "[Testing environment setup](testing/environment-setup.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Using Yii with event loop](tutorial/using-with-event-loop.md) +" +msgid "[Unit tests](testing/unit.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Using Yii with RoadRunner](tutorial/using-yii-with-roadrunner.md) +" +msgid "[Functional tests](testing/functional.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Using Yii with Swoole](tutorial/using-yii-with-swoole.md) +" +msgid "[Acceptance tests](testing/acceptance.md) TODO" msgstr "" -#. type: Plain text +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "Widgets -" +msgid "[Fixtures](testing/fixtures.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Title ## #: ../../guide/en/README.md -msgid "[GridView](https://www.yiiframework.com/doc-2.0/yii-grid-gridview.html)" +#, no-wrap +msgid "Special topics" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[ListView](https://www.yiiframework.com/doc-2.0/yii-widgets-listview.html)" -msgstr "" +#, fuzzy +#| msgid "Resolving aliases " +msgid "[Console applications](tutorial/console-applications.md)" +msgstr "Разрешение псевдонимов " -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[DetailView](https://www.yiiframework.com/doc-2.0/yii-widgets-detailview.html)" +msgid "[Internationalization](tutorial/i18n.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[ActiveForm](https://www.yiiframework.com/doc-2.0/guide-input-forms.html#activerecord-based-forms-activeform)" +msgid "[Mailing](tutorial/mailing.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Menu](https://www.yiiframework.com/doc-2.0/yii-widgets-menu.html)" +msgid "[Performance tuning](tutorial/performance-tuning.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[LinkPager](https://www.yiiframework.com/doc-2.0/yii-widgets-linkpager.html)" +msgid "[Using Yii with event loop](tutorial/using-with-event-loop.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[LinkSorter](https://www.yiiframework.com/doc-2.0/yii-widgets-linksorter.html)" +msgid "[Using Yii with RoadRunner](tutorial/using-yii-with-roadrunner.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Bootstrap widgets](https://www.yiiframework.com/extension/yiisoft/yii2-bootstrap/doc/guide)" +msgid "[Using Yii with Swoole](tutorial/using-yii-with-swoole.md)" msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Helpers +" +#, no-wrap +msgid "Helpers" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Arrays](https://github.com/yiisoft/arrays/)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Files](https://github.com/yiisoft/files/)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Html](https://github.com/yiisoft/html/)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Json](https://github.com/yiisoft/json)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Network utilities](https://github.com/yiisoft/network-utilities/)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[VarDumper](https://github.com/yiisoft/var-dumper)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Strings](https://github.com/yiisoft/strings)" msgstr "" -#. type: Plain text +#. type: Title ## +#: ../../guide/en/README.md +#, no-wrap +msgid "Extras" +msgstr "" + +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "Extras +" +msgid "[Cookbook](../../cookbook/en/README.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Glossary](glossary.md)" msgstr "" diff --git a/_translations/guide/po/ru/databases_db-migrations.md.po b/_translations/guide/po/ru/databases_db-migrations.md.po index 5c4091b..9d3335f 100644 --- a/_translations/guide/po/ru/databases_db-migrations.md.po +++ b/_translations/guide/po/ru/databases_db-migrations.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-11 10:15+0500\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -27,8 +27,8 @@ msgstr "" msgid "To use migrations, install [yiisoft/db-migration](https://github.com/yiisoft/db-migration/) package:" msgstr "" -#. type: Fenced code block (shell) -#: ../../guide/en/databases/db-migrations.md +#. type: Fenced code block (sh) +#: ../../guide/en/databases/db-migrations.md ../../guide/en/start/databases.md #, fuzzy, no-wrap #| msgid "composer install yiisoft/security\n" msgid "composer require yiisoft/db-migration\n" diff --git a/_translations/guide/po/ru/glossary.md.po b/_translations/guide/po/ru/glossary.md.po index 952e58b..faa9e00 100644 --- a/_translations/guide/po/ru/glossary.md.po +++ b/_translations/guide/po/ru/glossary.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-11 10:15+0500\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: 2025-09-11 10:15+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -42,7 +42,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "Asset refers to a resource file. Typically, it contains JavaScript or CSS code but can be any static content accessed via HTTP." +msgid "Asset refers to a resource file. Typically, it contains JavaScript or CSS code but can be any static content accessed via HTTP. Read more in [\"Assets\"](views/asset.md)." msgstr "" #. type: Title # @@ -59,7 +59,7 @@ msgstr "конфигурация может быть:" #. type: Plain text #: ../../guide/en/glossary.md -msgid "The Configuration may refer either to the process of setting properties of an object or to a configuration file that stores settings for an object, or a class of objects. Read more in [\"Configuration\"](concept/configuration.md)." +msgid "The Configuration may refer either to the process of setting properties of an object or to a configuration file that stores settings for an object, or a class of objects. Read more in [\"Configuration\"](concept/configuration.md)." msgstr "" #. type: Title # @@ -76,7 +76,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "Dependency Injection is a programming technique where an object injects a dependent object. [\"DI\"](concept/di-container.md)" +msgid "Dependency Injection is a programming technique where an object injects a dependent object. Read more in [\"Dependency injection and container\"](concept/di-container.md)." msgstr "" #. type: Title # @@ -110,7 +110,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "Middleware is a processor in the request processing stack. Given a request, it may either produce a response or do some action and pass processing to the next middleware. Read more in [\"Middleware\"](structure/middleware.md)." +msgid "Middleware is a processor in the request processing stack. Given a request, it may either produce a response or do some action and pass processing to the next middleware. Read more in [\"Middleware\"](structure/middleware.md)." msgstr "" #. type: Title ## @@ -121,7 +121,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "The module is a sub-application that groups some code based on a use-case. It's typically used within the main application and may contain URL handlers or console commands." +msgid "The module is a namespace that groups some code based on a use-case. It's typically used within the main application and may contain any source code, define additional URL handlers or console commands." msgstr "" #. type: Title # @@ -140,7 +140,7 @@ msgstr "" #: ../../guide/en/glossary.md #, fuzzy #| msgid "[PHP manual: security](https://www.php.net/manual/en/security.php)" -msgid "Namespace refers to a [PHP language feature](https://www.php.net/manual/en/language.namespaces.php)." +msgid "Namespace refers to a [PHP language feature](https://www.php.net/manual/en/language.namespaces.php) to group multiple classes under a certain name." msgstr "[Руководство по PHP: безопасность](https://www.php.net/manual/en/security.php)" #. type: Title # @@ -191,7 +191,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "A queue is similar to a stack. Queue follows First-In-First-Out methodology." +msgid "A queue is similar to a stack. Queue follows First-In-First-Out methodology. Yii has a [yiisoft/queue](https://github.com/yiisoft/queue) package." msgstr "" #. type: Title # @@ -208,5 +208,5 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md -msgid "A Vendor is an organization or individual developer providing code in the form of packages. It also may refer to [Composer's `vendor` directory](https://getcomposer.org/doc/)." +msgid "A Vendor is an organization or individual developer providing code in the form of packages. It also may refer to [Composer's `vendor` directory](https://getcomposer.org/doc/)." msgstr "" diff --git a/_translations/guide/po/ru/intro_upgrade-from-v2.md.po b/_translations/guide/po/ru/intro_upgrade-from-v2.md.po index 042c010..0f73fbd 100644 --- a/_translations/guide/po/ru/intro_upgrade-from-v2.md.po +++ b/_translations/guide/po/ru/intro_upgrade-from-v2.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-04 11:19+0500\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -16,14 +16,20 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +#. type: Title ### +#: ../../guide/en/README.md ../../guide/en/intro/upgrade-from-v2.md +#, no-wrap +msgid "Application structure" +msgstr "" + #. type: Title # -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Upgrading from Version 2.0" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "" "> If you haven't used Yii2, you can skip this section and get directly to \"[getting started](../start/installation.md)\"\n" @@ -31,108 +37,108 @@ msgid "" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "While sharing some common ideas and values, Yii 3 is conceptually different from Yii 2. There is no easy upgrade path, so first [check maintenance policy and end-of-life dates for Yii 2](https://www.yiiframework.com/release-cycle) and consider starting new projects on Yii 3 while keeping existing ones on Yii 2." msgstr "" #. type: Title ## -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "PHP requirements" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Yii3 requires PHP 8.2 or above. As a result, there are language features used that weren't used in Yii 2:" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Type declarations](https://www.php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Return type declarations](https://www.php.net/manual/en/functions.returning-values.php#functions.returning-values.type-declaration)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, fuzzy #| msgid "[PHP manual: security](https://www.php.net/manual/en/security.php)" msgid "[Class constant visibility](https://www.php.net/manual/en/language.oop5.constants.php)" msgstr "[Руководство по PHP: безопасность](https://www.php.net/manual/en/security.php)" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Named arguments](https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, fuzzy #| msgid "[PHP manual: security](https://www.php.net/manual/en/security.php)" msgid "[Anonymous classes](https://www.php.net/manual/en/language.oop5.anonymous.php)" msgstr "[Руководство по PHP: безопасность](https://www.php.net/manual/en/security.php)" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[::class](https://www.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, fuzzy #| msgid "[PHP manual: security](https://www.php.net/manual/en/security.php)" msgid "[Generators](https://www.php.net/manual/en/language.generators.php)" msgstr "[Руководство по PHP: безопасность](https://www.php.net/manual/en/security.php)" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Variadic functions](https://www.php.net/manual/en/functions.arguments.php#functions.variable-arg-list)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Readonly properties](https://www.php.net/manual/en/language.oop5.properties.php#language.oop5.properties.readonly-properties)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Readonly classes](https://www.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.readonly)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Constructor property promotion](https://www.php.net/manual/en/language.oop5.decon.php#language.oop5.decon.constructor.promotion)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, fuzzy #| msgid "[PHP manual: security](https://www.php.net/manual/en/security.php)" msgid "[Attributes](https://www.php.net/manual/en/language.attributes.php)" msgstr "[Руководство по PHP: безопасность](https://www.php.net/manual/en/security.php)" #. type: Title ## -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Preliminary refactoring" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "It's a good idea to refactor your Yii 2 project before porting it to Yii 3. That would both make porting easier and benefit the project in question while it's not moved to Yii 3 yet." msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Use DI instead of the service locator" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "" "Since Yii 3 is forcing you to inject dependencies, it's a good idea to prepare and switch from using\n" @@ -140,7 +146,7 @@ msgid "" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "" "If usage of DI container is problematic for whatever reason, consider moving all calls to `Yii::$app->` to controller\n" @@ -148,23 +154,23 @@ msgid "" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "See [Dependency injection and container](../concept/di-container.md) for an explanation of the idea." msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Introduce repositories for getting data" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Since Active Record isn't the only way to work with a database in Yii 3, consider introducing repositories that would hide details of getting data and gather them in a single place. You can later redo it:" msgstr "" #. type: Fenced code block (php) -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "" "final readonly class PostRepository\n" @@ -183,93 +189,88 @@ msgid "" msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Separate domain layer from infrastructure" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "In case you have a rich complicated domain, it's a good idea to separate it from infrastructure provided by a framework that's all the business logic has to go to framework-independent classes." msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Move more into components" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Yii 3 services are conceptually similar to Yii 2 components, so it's a good idea to move reusable parts of your application into components." msgstr "" #. type: Title ## -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Things to learn" msgstr "" #. type: Title ## -#: en/intro/upgrade-from-v2.md en/start/prerequisites.md +#: ../../guide/en/intro/upgrade-from-v2.md +#: ../../guide/en/start/prerequisites.md #, no-wrap msgid "Docker" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Default application templates are using [Docker](https://www.docker.com/get-started/) to run application. It's a good idea to learn how to use it and use it for your own projects since it provides a lot of benefits:" msgstr "" #. type: Bullet: '1. ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Exactly the same environment as in production." msgstr "" #. type: Bullet: '2. ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "No need to install anything except Docker itself." msgstr "" #. type: Bullet: '3. ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Environment is per application, not per server." msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Environment variables" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Yii3 application templates are using [environment variables](https://en.wikipedia.org/wiki/Environment_variable) to configure pars of the application. The concept is [very handy for Dockerized applications](https://12factor.net/) but might be alien to users of Yii 1.1 and Yii 2." msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Handlers" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Unlike Yii2, Yii3 doesn't have controllers per se. Instead, it uses [handlers](../structure/handler.md) which are similar to controllers but different." msgstr "" -#. type: Title ### -#: en/intro/upgrade-from-v2.md -#, no-wrap -msgid "Application structure" -msgstr "" - #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Suggested Yii3 application structure is different from Yii 2. It's described in [application structure](../structure/overview.md)." msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Despite that, Yii3 is flexible, so it's still possible to use a structure similar to Yii 2 with Yii 3." msgstr "" diff --git a/_translations/guide/po/ru/start_databases.md.po b/_translations/guide/po/ru/start_databases.md.po index 920857d..0842e16 100644 --- a/_translations/guide/po/ru/start_databases.md.po +++ b/_translations/guide/po/ru/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-04 11:19+0500\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -17,107 +17,306 @@ msgstr "" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #. type: Title # -#: en/start/databases.md +#: ../../guide/en/README.md ../../guide/en/start/databases.md #, no-wrap msgid "Working with databases" msgstr "" +#. type: Fenced code block (sh) +#: ../../guide/en/databases/db-migrations.md ../../guide/en/start/databases.md +#, fuzzy, no-wrap +#| msgid "composer install yiisoft/security\n" +msgid "composer require yiisoft/db-migration\n" +msgstr "composer install yiisoft/security\n" + #. type: Plain text -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "Yii doesn't dictate using a particular database or storage for your application. There are many ways you can work with relational databases:" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[Yii DB](https://github.com/yiisoft/db)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[Yii Active Record](https://github.com/yiisoft/active-record)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[Cycle](https://github.com/cycle) via [Yii Cycle package](https://github.com/yiisoft/yii-cycle)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, fuzzy #| msgid "[PHP manual: security](https://www.php.net/manual/en/security.php)" msgid "[PDO](https://www.php.net/manual/en/book.pdo.php)" msgstr "[Руководство по PHP: безопасность](https://www.php.net/manual/en/security.php)" #. type: Plain text -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "For non-relational ones, there are usually official libraries available:" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[ElasticSearch](https://github.com/elastic/elasticsearch-php)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[Redis](https://redis.io/docs/clients/#php)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "..." msgstr "" #. type: Plain text -#: en/start/databases.md -msgid "In this guide, we will focus on working with relational databases using Yii DB." +#: ../../guide/en/start/databases.md +msgid "In this guide, we will focus on working with relational databases using Yii DB. We'll use PostgreSQL to implement a simple CRUD (create read update delete)." msgstr "" #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "Installing PostgreSQL" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "You need to install PostgreSQL. If you prefer not to use Docker, [get the installer from official website](https://www.postgresql.org/download/), install it and create a database." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "If you use Docker, it is a bit simpler. Modify `docker/dev/compose.yml`:" +msgstr "" + +#. type: Fenced code block (yaml) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"services:\n" +" app:\n" +" build:\n" +" dockerfile: docker/Dockerfile\n" +" context: ..\n" +" target: dev\n" +" args:\n" +" USER_ID: ${UID}\n" +" GROUP_ID: ${GID}\n" +" env_file:\n" +" - path: ./dev/.env\n" +" - path: ./dev/override.env\n" +" required: false\n" +" ports:\n" +" - \"${DEV_PORT:-80}:80\"\n" +" volumes:\n" +" - ../:/app\n" +" - ../runtime:/app/runtime\n" +" - caddy_data:/data\n" +" - caddy_config:/config\n" +" tty: true\n" +" depends_on:\n" +" db:\n" +" condition: service_healthy\n" +"\n" +" db:\n" +" image: postgres:${POSTGRES_VERSION:-15}-alpine\n" +" environment:\n" +" POSTGRES_DB: app\n" +" POSTGRES_PASSWORD: password\n" +" POSTGRES_USER: user\n" +" volumes:\n" +" - ./runtime/db:/var/lib/postgresql/data:rw\n" +" ports:\n" +" - \"${DEV_DB_PORT:-5432}:5432\"\n" +" healthcheck:\n" +" test: [ \"CMD-SHELL\", \"pg_isready -U user -d app\" ]\n" +" interval: 5s\n" +" timeout: 5s\n" +" retries: 5\n" +"\n" +"volumes:\n" +" db:\n" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Note that we add `depends_on` so application waits for database to be up." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Also, we'll need a `pdo_pgsql` extension to communicate with PostgreSQL. You can enable it locally in `php.ini`. If you use Docker, check `docker/Dockerfile` and add `pdo_pgsql` in `install-php-extensions` list. Then rebuild PHP image with `make build && make down && make up`." +msgstr "" + +#. type: Title ## +#: ../../guide/en/start/databases.md #, fuzzy, no-wrap #| msgid "Configuring SSL peer validation" msgid "Configuring connection" msgstr "Настройка проверки SSL-сертификата" +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Now that we have the database, it's time to define the connection. We need a package to be installed first:" +msgstr "" + +#. type: Fenced code block (sh) +#: ../../guide/en/start/databases.md +#, fuzzy, no-wrap +#| msgid "composer install yiisoft/security\n" +msgid "composer require yiisoft/db-pgsql\n" +msgstr "composer install yiisoft/security\n" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Now create `config/common/di/db-pgsql.php`:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +" [\n" +" 'class' => Connection::class,\n" +" '__construct()' => [\n" +" 'driver' => new Driver(\n" +" $params['yiisoft/db-pgsql']['dsn'],\n" +" $params['yiisoft/db-pgsql']['username'],\n" +" $params['yiisoft/db-pgsql']['password'],\n" +" ),\n" +" ],\n" +" ],\n" +"];\n" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "And define parameters in `config/common/params.php`. For Docker that would be:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"use Yiisoft\\Db\\Pgsql\\Dsn;\n" +"\n" +"return [\n" +" // ...\n" +" 'yiisoft/db-pgsql' => [\n" +" 'dsn' => (new Dsn('pgsql', 'db', 'app', '5432'))->asString(),\n" +" 'username' => 'user',\n" +" 'password' => 'password',\n" +" ],\n" +"];\n" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "`db` host is resolved automatically within the Docker network." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "For local installation without Docker the host in Dsn would be `localhost`. You'll have to adjust the rest to match how you configured the database." +msgstr "" + #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap -msgid "Creating and applying migration" +msgid "Creating and applying migrations" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "For the initial state of the application and for further database changes, it is a good idea to use migrations. These are files creating changes to be applied to the database. Which are applied is tracked in the same database so we always know which state is it now and what is to be applied." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "To use migrations we need another package installed:" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "And a directory to store migrations such as `migrations` right in the project root." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Now you can use `yii migrate:create user` to create a new migration. For our example we need a `page` table with some columns:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"\n" +"public function up(MigrationBuilder $b): void\n" +"{\n" +" $b->createTable('page', [\n" +" 'id' => $b->primaryKey(),\n" +" 'title' => $b->string()->notNull(),\n" +" 'text' => $b->text()->notNull(),\n" +" 'created_at' => $b->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'),\n" +" 'updated_at' => $b->dateTime(),\n" +" 'deleted_at' => $b->dateTime(),\n" +" ]);\n" +"}\n" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Apply it with `yii migrate:up`." msgstr "" #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "Inserting" msgstr "" #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "Selecting" msgstr "" #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "Using data package" msgstr "" #. type: Title ### -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "Pagination" msgstr "" #. type: Plain text -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "" "> [!NOTE]\n" diff --git a/_translations/guide/pot/README.md.pot b/_translations/guide/pot/README.md.pot index 810648c..9a05b2e 100644 --- a/_translations/guide/pot/README.md.pot +++ b/_translations/guide/pot/README.md.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-10-19 11:32+0000\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -29,627 +29,575 @@ msgid "" "yiiframework.com/license#docs)." msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Introduction +" +#, no-wrap +msgid "Introduction" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[About Yii](intro/what-is-yii.md) +" +msgid "[About Yii](intro/what-is-yii.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Upgrading from version 2.0](intro/upgrade-from-v2.md) +" +msgid "[Upgrading from version 2.0](intro/upgrade-from-v2.md)" msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Getting started -" +#, no-wrap +msgid "Getting started" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[What do you need to know?](start/prerequisites.md) +" +msgid "[What do you need to know?](start/prerequisites.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Creating a project](start/creating-project.md) +" +msgid "[Creating a project](start/creating-project.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Running applications](start/workflow.md) +" +msgid "[Running applications](start/workflow.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Saying hello](start/hello.md) +" +msgid "[Saying hello](start/hello.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Working with forms](start/forms.md) +" +msgid "[Working with forms](start/forms.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Working with databases](start/databases.md) !" +msgid "[Working with databases](start/databases.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Generating code with Gii](start/gii.md) -" +msgid "[Generating code with Gii](start/gii.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Looking ahead](start/looking-ahead.md) +" +msgid "[Looking ahead](start/looking-ahead.md)" msgstr "" -#. type: Plain text -#: ../../guide/en/README.md -msgid "Application structure +" +#. type: Title ### +#: ../../guide/en/README.md ../../guide/en/intro/upgrade-from-v2.md +#, no-wrap +msgid "Application structure" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Application structure overview](structure/overview.md) +" +msgid "[Application structure overview](structure/overview.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Entry scripts](structure/entry-script.md) +" +msgid "[Entry scripts](structure/entry-script.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Application](structure/application.md) +" +msgid "[Application](structure/application.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Service components](structure/service.md) +" +msgid "[Service components](structure/service.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Actions](structure/action.md) +" +msgid "[Actions](structure/action.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Domain](structure/domain.md) +" +msgid "[Domain](structure/domain.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Middleware](structure/middleware.md) +" +msgid "[Middleware](structure/middleware.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Packages](structure/package.md) +" +msgid "[Packages](structure/package.md)" msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Key concepts +" +#, no-wrap +msgid "Key concepts" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Class autoloading](concept/autoloading.md) +" +msgid "[Class autoloading](concept/autoloading.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Dependency injection container](concept/di-container.md) +" +msgid "[Dependency injection container](concept/di-container.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Configuration](concept/configuration.md) +" +msgid "[Configuration](concept/configuration.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Aliases](concept/aliases.md) +" +msgid "[Aliases](concept/aliases.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Events](concept/events.md) +" +msgid "[Events](concept/events.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Immutability](concept/immutability.md) +" +msgid "[Immutability](concept/immutability.md)" msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Handling requests +" +#, no-wrap +msgid "Handling requests" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Routing and URL generation](runtime/routing.md) +" +msgid "[Routing and URL generation](runtime/routing.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Request](runtime/request.md) +" +msgid "[Request](runtime/request.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Response](runtime/response.md) +" +msgid "[Response](runtime/response.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Sessions](runtime/sessions.md) +" +msgid "[Sessions](runtime/sessions.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Cookies](runtime/cookies.md) +" +msgid "[Cookies](runtime/cookies.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Handling errors](runtime/handling-errors.md) +" +msgid "[Handling errors](runtime/handling-errors.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Logging](runtime/logging.md) +" +msgid "[Logging](runtime/logging.md)" msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Views +" +#, no-wrap +msgid "Views" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[View](views/view.md) +" +msgid "[View](views/view.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Template engines](views/template-engines.md) +- TODO: verify!" +msgid "[Template engines](views/template-engines.md) TODO: verify!" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[View injections](views/view-injections.md) +" +msgid "[View injections](views/view-injections.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "" -"[Scripts, styles and metatags](views/script-style-meta.md) +- TODO: verify!" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Assets](views/asset.md) +- TODO: verify!" +"[Scripts, styles and metatags](views/script-style-meta.md) TODO: verify!" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Widgets](views/widget.md) +- TODO: verify!" +msgid "[Assets](views/asset.md) TODO: verify!" msgstr "" -#. type: Plain text +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "Working with databases +-" +msgid "[Widgets](views/widget.md) TODO: verify!" msgstr "" -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "" -"[Database access objects](db-dao.md): Connecting to a database, basic " -"queries, transactions, and schema manipulation" +#. type: Title # +#: ../../guide/en/README.md ../../guide/en/start/databases.md +#, no-wrap +msgid "Working with databases" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "" -"[Query builder](db-query-builder.md): Querying the database using a simple " -"abstraction layer" +"[Yii DB](https://github.com/yiisoft/db/blob/master/docs/guide/en/README.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "" -"[Active record](db-active-record.md): The Active Record ORM, retrieving and " -"manipulating records, and defining relations" +"[Active Record](https://github.com/yiisoft/active-record/blob/master/README." +"md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Migrations](databases/db-migrations.md): +" +msgid "[Migrations](databases/db-migrations.md) TODO: verify/update!" msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Getting data from users -" +#, no-wrap +msgid "Getting data from users" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Creating forms](input/forms.md) -" +msgid "[Creating forms](input/forms.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "" "[Validating input](https://github.com/yiisoft/validator/blob/master/docs/" -"guide/en/README.md) +" +"guide/en/README.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Uploading files](input/file-upload.md) -" +msgid "[Uploading files](input/file-upload.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Collecting tabular input](input/tabular-input.md) -" +msgid "[Collecting tabular input](input/tabular-input.md) TODO" msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Displaying data -" +#, no-wrap +msgid "Displaying data" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Data formatting](output/formatting.md) -" +msgid "[Data formatting](output/formatting.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Pagination](output/pagination.md) -" +msgid "[Pagination](output/pagination.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Sorting](output/sorting.md) -" +msgid "[Sorting](output/sorting.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Data providers](output/data-providers.md) -" +msgid "[Data providers](output/data-providers.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Data widgets](output/data-widgets.md) -" +msgid "[Data widgets](output/data-widgets.md) TODO" msgstr "" -#. type: Plain text -#: ../../guide/en/README.md -msgid "Security +-" +#. type: Title # +#: ../../guide/en/README.md ../../guide/en/security/overview.md +#, no-wrap +msgid "Security" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Security overview](security/overview.md) +" +msgid "[Security overview](security/overview.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Authentication](security/authentication.md) +" +msgid "[Authentication](security/authentication.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Authorization](security/authorization.md) +-" +msgid "[Authorization](security/authorization.md) TODO: verify and complete!" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Working with passwords](security/passwords.md) +" +msgid "[Working with passwords](security/passwords.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Cryptography](security/cryptography.md) +" +msgid "[Cryptography](security/cryptography.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Best practices](security/best-practices.md) +" +msgid "[Best practices](security/best-practices.md)" msgstr "" -#. type: Plain text -#: ../../guide/en/README.md -msgid "Caching +-" +#. type: Title # +#: ../../guide/en/README.md ../../guide/en/caching/overview.md +#, no-wrap +msgid "Caching" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Caching overview](caching/overview.md) +" +msgid "[Caching overview](caching/overview.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Data caching](caching/data.md) +" +msgid "[Data caching](caching/data.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Fragment caching](caching/fragment.md) -" +msgid "[Fragment caching](caching/fragment.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Page caching](caching/page.md) -" +msgid "[Page caching](caching/page.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[HTTP caching](caching/http.md) -" +msgid "[HTTP caching](caching/http.md) TODO" msgstr "" -#. type: Title - +#. type: Title ## #: ../../guide/en/README.md #, no-wrap -msgid "REST APIs -" +msgid "REST APIs" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Quick start](rest/quick-start.md)" +msgid "[Quick start](rest/quick-start.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Resources](rest/resources.md)" +msgid "[Resources](rest/resources.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Controllers](rest/controllers.md)" +msgid "[Controllers](rest/controllers.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Routing](rest/routing.md)" +msgid "[Routing](rest/routing.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Authentication](rest/authentication.md)" +msgid "[Authentication](rest/authentication.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Rate limiting](rest/rate-limiting.md)" +msgid "[Rate limiting](rest/rate-limiting.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Versioning](rest/versioning.md)" +msgid "[Versioning](rest/versioning.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Error handling](rest/error-handling.md)" +msgid "[Error handling](rest/error-handling.md) TODO" msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Development tools -" +#, no-wrap +msgid "Development tools" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "Debug toolbar and debugger" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "Generating code using Gii" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "Generating API documentation" msgstr "" -#. type: Plain text -#: ../../guide/en/README.md -msgid "Testing -" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Testing overview](testing/overview.md)" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Testing environment setup](testing/environment-setup.md)" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Unit tests](testing/unit.md)" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Functional tests](testing/functional.md)" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Acceptance tests](testing/acceptance.md)" -msgstr "" - -#. type: Bullet: '* ' +#. type: Title ## #: ../../guide/en/README.md -msgid "[Fixtures](testing/fixtures.md)" -msgstr "" - -#. type: Plain text -#: ../../guide/en/README.md -msgid "Special topics -" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Building application from scratch](tutorial/start-from-scratch.md) -" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Console applications](tutorial/console-applications.md) +" -msgstr "" - -#. type: Bullet: '* ' -#: ../../guide/en/README.md -msgid "[Docker](tutorial/docker.md) -" +#, no-wrap +msgid "Testing" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Internationalization](tutorial/i18n.md) -" +msgid "[Testing overview](testing/overview.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Mailing](tutorial/mailing.md) +" +msgid "[Testing environment setup](testing/environment-setup.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Performance tuning](tutorial/performance-tuning.md) +" +msgid "[Unit tests](testing/unit.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Using Yii with event loop](tutorial/using-with-event-loop.md) +" +msgid "[Functional tests](testing/functional.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Using Yii with RoadRunner](tutorial/using-yii-with-roadrunner.md) +" +msgid "[Acceptance tests](testing/acceptance.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Using Yii with Swoole](tutorial/using-yii-with-swoole.md) +" +msgid "[Fixtures](testing/fixtures.md) TODO" msgstr "" -#. type: Plain text +#. type: Title ## #: ../../guide/en/README.md -msgid "Widgets -" +#, no-wrap +msgid "Special topics" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[GridView](https://www.yiiframework.com/doc-2.0/yii-grid-gridview.html)" +msgid "[Console applications](tutorial/console-applications.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "" -"[ListView](https://www.yiiframework.com/doc-2.0/yii-widgets-listview.html)" +msgid "[Internationalization](tutorial/i18n.md) TODO" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "" -"[DetailView](https://www.yiiframework.com/doc-2.0/yii-widgets-detailview." -"html)" +msgid "[Mailing](tutorial/mailing.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "" -"[ActiveForm](https://www.yiiframework.com/doc-2.0/guide-input-forms." -"html#activerecord-based-forms-activeform)" +msgid "[Performance tuning](tutorial/performance-tuning.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "[Menu](https://www.yiiframework.com/doc-2.0/yii-widgets-menu.html)" +msgid "[Using Yii with event loop](tutorial/using-with-event-loop.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "" -"[LinkPager](https://www.yiiframework.com/doc-2.0/yii-widgets-linkpager.html)" +msgid "[Using Yii with RoadRunner](tutorial/using-yii-with-roadrunner.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "" -"[LinkSorter](https://www.yiiframework.com/doc-2.0/yii-widgets-linksorter." -"html)" +msgid "[Using Yii with Swoole](tutorial/using-yii-with-swoole.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Title ## #: ../../guide/en/README.md -msgid "" -"[Bootstrap widgets](https://www.yiiframework.com/extension/yiisoft/yii2-" -"bootstrap/doc/guide)" -msgstr "" - -#. type: Plain text -#: ../../guide/en/README.md -msgid "Helpers +" +#, no-wrap +msgid "Helpers" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Arrays](https://github.com/yiisoft/arrays/)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Files](https://github.com/yiisoft/files/)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Html](https://github.com/yiisoft/html/)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Json](https://github.com/yiisoft/json)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Network utilities](https://github.com/yiisoft/network-utilities/)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[VarDumper](https://github.com/yiisoft/var-dumper)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Strings](https://github.com/yiisoft/strings)" msgstr "" -#. type: Plain text +#. type: Title ## +#: ../../guide/en/README.md +#, no-wrap +msgid "Extras" +msgstr "" + +#. type: Bullet: '- ' #: ../../guide/en/README.md -msgid "Extras +" +msgid "[Cookbook](../../cookbook/en/README.md)" msgstr "" -#. type: Bullet: '* ' +#. type: Bullet: '- ' #: ../../guide/en/README.md msgid "[Glossary](glossary.md)" msgstr "" diff --git a/_translations/guide/pot/databases_db-migrations.md.pot b/_translations/guide/pot/databases_db-migrations.md.pot index 525c791..e71d6c2 100644 --- a/_translations/guide/pot/databases_db-migrations.md.pot +++ b/_translations/guide/pot/databases_db-migrations.md.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-11 10:15+0500\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -29,8 +29,8 @@ msgid "" "db-migration/) package:" msgstr "" -#. type: Fenced code block (shell) -#: ../../guide/en/databases/db-migrations.md +#. type: Fenced code block (sh) +#: ../../guide/en/databases/db-migrations.md ../../guide/en/start/databases.md #, no-wrap msgid "composer require yiisoft/db-migration\n" msgstr "" diff --git a/_translations/guide/pot/glossary.md.pot b/_translations/guide/pot/glossary.md.pot index 413f14f..701f727 100644 --- a/_translations/guide/pot/glossary.md.pot +++ b/_translations/guide/pot/glossary.md.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-11 10:15+0500\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -45,7 +45,8 @@ msgstr "" #: ../../guide/en/glossary.md msgid "" "Asset refers to a resource file. Typically, it contains JavaScript or CSS " -"code but can be any static content accessed via HTTP." +"code but can be any static content accessed via HTTP. Read more in " +"[\"Assets\"](views/asset.md)." msgstr "" #. type: Title # @@ -65,7 +66,7 @@ msgstr "" msgid "" "The Configuration may refer either to the process of setting properties of " "an object or to a configuration file that stores settings for an object, or " -"a class of objects. Read more in [\"Configuration\"](concept/configuration." +"a class of objects. Read more in [\"Configuration\"](concept/configuration." "md)." msgstr "" @@ -85,7 +86,8 @@ msgstr "" #: ../../guide/en/glossary.md msgid "" "Dependency Injection is a programming technique where an object injects a " -"dependent object. [\"DI\"](concept/di-container.md)" +"dependent object. Read more in [\"Dependency injection and container\"]" +"(concept/di-container.md)." msgstr "" #. type: Title # @@ -125,7 +127,7 @@ msgstr "" msgid "" "Middleware is a processor in the request processing stack. Given a request, " "it may either produce a response or do some action and pass processing to " -"the next middleware. Read more in [\"Middleware\"](structure/middleware.md)." +"the next middleware. Read more in [\"Middleware\"](structure/middleware.md)." msgstr "" #. type: Title ## @@ -137,9 +139,9 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md msgid "" -"The module is a sub-application that groups some code based on a use-case. " -"It's typically used within the main application and may contain URL handlers " -"or console commands." +"The module is a namespace that groups some code based on a use-case. It's " +"typically used within the main application and may contain any source code, " +"define additional URL handlers or console commands." msgstr "" #. type: Title # @@ -158,7 +160,7 @@ msgstr "" #: ../../guide/en/glossary.md msgid "" "Namespace refers to a [PHP language feature](https://www.php.net/manual/en/" -"language.namespaces.php)." +"language.namespaces.php) to group multiple classes under a certain name." msgstr "" #. type: Title # @@ -217,7 +219,9 @@ msgstr "" #. type: Plain text #: ../../guide/en/glossary.md msgid "" -"A queue is similar to a stack. Queue follows First-In-First-Out methodology." +"A queue is similar to a stack. Queue follows First-In-First-Out " +"methodology. Yii has a [yiisoft/queue](https://github.com/yiisoft/queue) " +"package." msgstr "" #. type: Title # @@ -236,6 +240,6 @@ msgstr "" #: ../../guide/en/glossary.md msgid "" "A Vendor is an organization or individual developer providing code in the " -"form of packages. It also may refer to [Composer's `vendor` directory]" +"form of packages. It also may refer to [Composer's `vendor` directory]" "(https://getcomposer.org/doc/)." msgstr "" diff --git a/_translations/guide/pot/intro_upgrade-from-v2.md.pot b/_translations/guide/pot/intro_upgrade-from-v2.md.pot index 3ed471a..2c88bc6 100644 --- a/_translations/guide/pot/intro_upgrade-from-v2.md.pot +++ b/_translations/guide/pot/intro_upgrade-from-v2.md.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-04 11:19+0500\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,14 +16,20 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#. type: Title ### +#: ../../guide/en/README.md ../../guide/en/intro/upgrade-from-v2.md +#, no-wrap +msgid "Application structure" +msgstr "" + #. type: Title # -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Upgrading from Version 2.0" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "" "> If you haven't used Yii2, you can skip this section and get directly to \"[getting started](../start/installation.md)\"\n" @@ -31,7 +37,7 @@ msgid "" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "While sharing some common ideas and values, Yii 3 is conceptually different " "from Yii 2. There is no easy upgrade path, so first [check maintenance " @@ -41,106 +47,106 @@ msgid "" msgstr "" #. type: Title ## -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "PHP requirements" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "Yii3 requires PHP 8.2 or above. As a result, there are language features " "used that weren't used in Yii 2:" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "[Type declarations](https://www.php.net/manual/en/functions.arguments." "php#functions.arguments.type-declaration)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "[Return type declarations](https://www.php.net/manual/en/functions.returning-" "values.php#functions.returning-values.type-declaration)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "[Class constant visibility](https://www.php.net/manual/en/language.oop5." "constants.php)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "[Named arguments](https://www.php.net/manual/en/functions.arguments." "php#functions.named-arguments)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "[Anonymous classes](https://www.php.net/manual/en/language.oop5.anonymous." "php)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "[::class](https://www.php.net/manual/en/language.oop5.basic.php#language." "oop5.basic.class.class)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Generators](https://www.php.net/manual/en/language.generators.php)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "[Variadic functions](https://www.php.net/manual/en/functions.arguments." "php#functions.variable-arg-list)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "[Readonly properties](https://www.php.net/manual/en/language.oop5.properties." "php#language.oop5.properties.readonly-properties)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "[Readonly classes](https://www.php.net/manual/en/language.oop5.basic." "php#language.oop5.basic.class.readonly)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "[Constructor property promotion](https://www.php.net/manual/en/language.oop5." "decon.php#language.oop5.decon.constructor.promotion)" msgstr "" #. type: Bullet: '- ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "[Attributes](https://www.php.net/manual/en/language.attributes.php)" msgstr "" #. type: Title ## -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Preliminary refactoring" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "It's a good idea to refactor your Yii 2 project before porting it to Yii 3. " "That would both make porting easier and benefit the project in question " @@ -148,13 +154,13 @@ msgid "" msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Use DI instead of the service locator" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "" "Since Yii 3 is forcing you to inject dependencies, it's a good idea to prepare and switch from using\n" @@ -162,7 +168,7 @@ msgid "" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "" "If usage of DI container is problematic for whatever reason, consider moving all calls to `Yii::$app->` to controller\n" @@ -170,20 +176,20 @@ msgid "" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "See [Dependency injection and container](../concept/di-container.md) for an " "explanation of the idea." msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Introduce repositories for getting data" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "Since Active Record isn't the only way to work with a database in Yii 3, " "consider introducing repositories that would hide details of getting data " @@ -191,7 +197,7 @@ msgid "" msgstr "" #. type: Fenced code block (php) -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "" "final readonly class PostRepository\n" @@ -210,13 +216,13 @@ msgid "" msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Separate domain layer from infrastructure" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "In case you have a rich complicated domain, it's a good idea to separate it " "from infrastructure provided by a framework that's all the business logic " @@ -224,32 +230,33 @@ msgid "" msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Move more into components" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "Yii 3 services are conceptually similar to Yii 2 components, so it's a good " "idea to move reusable parts of your application into components." msgstr "" #. type: Title ## -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Things to learn" msgstr "" #. type: Title ## -#: en/intro/upgrade-from-v2.md en/start/prerequisites.md +#: ../../guide/en/intro/upgrade-from-v2.md +#: ../../guide/en/start/prerequisites.md #, no-wrap msgid "Docker" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "Default application templates are using [Docker](https://www.docker.com/get-" "started/) to run application. It's a good idea to learn how to use it and " @@ -257,28 +264,28 @@ msgid "" msgstr "" #. type: Bullet: '1. ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Exactly the same environment as in production." msgstr "" #. type: Bullet: '2. ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "No need to install anything except Docker itself." msgstr "" #. type: Bullet: '3. ' -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "Environment is per application, not per server." msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Environment variables" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "Yii3 application templates are using [environment variables](https://en." "wikipedia.org/wiki/Environment_variable) to configure pars of the " @@ -287,34 +294,28 @@ msgid "" msgstr "" #. type: Title ### -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md #, no-wrap msgid "Handlers" msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "Unlike Yii2, Yii3 doesn't have controllers per se. Instead, it uses " "[handlers](../structure/handler.md) which are similar to controllers but " "different." msgstr "" -#. type: Title ### -#: en/intro/upgrade-from-v2.md -#, no-wrap -msgid "Application structure" -msgstr "" - #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "Suggested Yii3 application structure is different from Yii 2. It's " "described in [application structure](../structure/overview.md)." msgstr "" #. type: Plain text -#: en/intro/upgrade-from-v2.md +#: ../../guide/en/intro/upgrade-from-v2.md msgid "" "Despite that, Yii3 is flexible, so it's still possible to use a structure " "similar to Yii 2 with Yii 3." diff --git a/_translations/guide/pot/start_databases.md.pot b/_translations/guide/pot/start_databases.md.pot index d51e7af..b5d35f0 100644 --- a/_translations/guide/pot/start_databases.md.pot +++ b/_translations/guide/pot/start_databases.md.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-04 11:19+0500\n" +"POT-Creation-Date: 2025-10-22 11:35+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,113 +17,334 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #. type: Title # -#: en/start/databases.md +#: ../../guide/en/README.md ../../guide/en/start/databases.md #, no-wrap msgid "Working with databases" msgstr "" +#. type: Fenced code block (sh) +#: ../../guide/en/databases/db-migrations.md ../../guide/en/start/databases.md +#, no-wrap +msgid "composer require yiisoft/db-migration\n" +msgstr "" + #. type: Plain text -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "" "Yii doesn't dictate using a particular database or storage for your " "application. There are many ways you can work with relational databases:" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[Yii DB](https://github.com/yiisoft/db)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[Yii Active Record](https://github.com/yiisoft/active-record)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "" "[Cycle](https://github.com/cycle) via [Yii Cycle package](https://github.com/" "yiisoft/yii-cycle)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "" "[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package]" "(https://github.com/stargazer-team/yii-doctrine)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[PDO](https://www.php.net/manual/en/book.pdo.php)" msgstr "" #. type: Plain text -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "" "For non-relational ones, there are usually official libraries available:" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[ElasticSearch](https://github.com/elastic/elasticsearch-php)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "[Redis](https://redis.io/docs/clients/#php)" msgstr "" #. type: Bullet: '- ' -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "..." msgstr "" #. type: Plain text -#: en/start/databases.md +#: ../../guide/en/start/databases.md msgid "" "In this guide, we will focus on working with relational databases using Yii " -"DB." +"DB. We'll use PostgreSQL to implement a simple CRUD (create read update " +"delete)." msgstr "" #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "Installing PostgreSQL" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "" +"You need to install PostgreSQL. If you prefer not to use Docker, [get the " +"installer from official website](https://www.postgresql.org/download/), " +"install it and create a database." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "" +"If you use Docker, it is a bit simpler. Modify `docker/dev/compose.yml`:" +msgstr "" + +#. type: Fenced code block (yaml) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"services:\n" +" app:\n" +" build:\n" +" dockerfile: docker/Dockerfile\n" +" context: ..\n" +" target: dev\n" +" args:\n" +" USER_ID: ${UID}\n" +" GROUP_ID: ${GID}\n" +" env_file:\n" +" - path: ./dev/.env\n" +" - path: ./dev/override.env\n" +" required: false\n" +" ports:\n" +" - \"${DEV_PORT:-80}:80\"\n" +" volumes:\n" +" - ../:/app\n" +" - ../runtime:/app/runtime\n" +" - caddy_data:/data\n" +" - caddy_config:/config\n" +" tty: true\n" +" depends_on:\n" +" db:\n" +" condition: service_healthy\n" +"\n" +" db:\n" +" image: postgres:${POSTGRES_VERSION:-15}-alpine\n" +" environment:\n" +" POSTGRES_DB: app\n" +" POSTGRES_PASSWORD: password\n" +" POSTGRES_USER: user\n" +" volumes:\n" +" - ./runtime/db:/var/lib/postgresql/data:rw\n" +" ports:\n" +" - \"${DEV_DB_PORT:-5432}:5432\"\n" +" healthcheck:\n" +" test: [ \"CMD-SHELL\", \"pg_isready -U user -d app\" ]\n" +" interval: 5s\n" +" timeout: 5s\n" +" retries: 5\n" +"\n" +"volumes:\n" +" db:\n" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "" +"Note that we add `depends_on` so application waits for database to be up." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "" +"Also, we'll need a `pdo_pgsql` extension to communicate with PostgreSQL. You " +"can enable it locally in `php.ini`. If you use Docker, check `docker/" +"Dockerfile` and add `pdo_pgsql` in `install-php-extensions` list. Then " +"rebuild PHP image with `make build && make down && make up`." +msgstr "" + +#. type: Title ## +#: ../../guide/en/start/databases.md #, no-wrap msgid "Configuring connection" msgstr "" +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "" +"Now that we have the database, it's time to define the connection. We need a " +"package to be installed first:" +msgstr "" + +#. type: Fenced code block (sh) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "composer require yiisoft/db-pgsql\n" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Now create `config/common/di/db-pgsql.php`:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +" [\n" +" 'class' => Connection::class,\n" +" '__construct()' => [\n" +" 'driver' => new Driver(\n" +" $params['yiisoft/db-pgsql']['dsn'],\n" +" $params['yiisoft/db-pgsql']['username'],\n" +" $params['yiisoft/db-pgsql']['password'],\n" +" ),\n" +" ],\n" +" ],\n" +"];\n" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "" +"And define parameters in `config/common/params.php`. For Docker that would " +"be:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"use Yiisoft\\Db\\Pgsql\\Dsn;\n" +"\n" +"return [\n" +" // ...\n" +" 'yiisoft/db-pgsql' => [\n" +" 'dsn' => (new Dsn('pgsql', 'db', 'app', '5432'))->asString(),\n" +" 'username' => 'user',\n" +" 'password' => 'password',\n" +" ],\n" +"];\n" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "`db` host is resolved automatically within the Docker network." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "" +"For local installation without Docker the host in Dsn would be `localhost`. " +"You'll have to adjust the rest to match how you configured the database." +msgstr "" + #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap -msgid "Creating and applying migration" +msgid "Creating and applying migrations" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "" +"For the initial state of the application and for further database changes, " +"it is a good idea to use migrations. These are files creating changes to be " +"applied to the database. Which are applied is tracked in the same database " +"so we always know which state is it now and what is to be applied." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "To use migrations we need another package installed:" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "" +"And a directory to store migrations such as `migrations` right in the " +"project root." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "" +"Now you can use `yii migrate:create user` to create a new migration. For our " +"example we need a `page` table with some columns:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"\n" +"public function up(MigrationBuilder $b): void\n" +"{\n" +" $b->createTable('page', [\n" +" 'id' => $b->primaryKey(),\n" +" 'title' => $b->string()->notNull(),\n" +" 'text' => $b->text()->notNull(),\n" +" 'created_at' => $b->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'),\n" +" 'updated_at' => $b->dateTime(),\n" +" 'deleted_at' => $b->dateTime(),\n" +" ]);\n" +"}\n" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Apply it with `yii migrate:up`." msgstr "" #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "Inserting" msgstr "" #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "Selecting" msgstr "" #. type: Title ## -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "Using data package" msgstr "" #. type: Title ### -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "Pagination" msgstr "" #. type: Plain text -#: en/start/databases.md +#: ../../guide/en/start/databases.md #, no-wrap msgid "" "> [!NOTE]\n" diff --git a/guide/es/README.md b/guide/es/README.md index ae67f21..359d3d2 100644 --- a/guide/es/README.md +++ b/guide/es/README.md @@ -3,193 +3,153 @@ Esta guía se publica bajo los [Términos de documentación de Yii](https://www.yiiframework.com/license#docs)). -Introducción ------------- - -* [Acerca de Yii](intro/what-is-yii.md) -* [Actualizar desde la Version 2.0](intro/upgrade-from-v2.md) - - -Primeros Pasos ---------------- - -* [Qué Necesitas Saber](start/prerequisites.md) -* [Creating a project](start/creating-project.md) + -* [Ejecutando Aplicaciones](start/workflow.md) -* [Hola Mundo](start/hello.md) -* [Trabajar con Formularios](start/forms.md) -* [Trabajar con Bases de Datos](start/databases.md) -* [Generación de Código con Gii](start/gii.md) -* [Adentrarse en Yii](start/looking-ahead.md) - - -Estructura De Una Aplicación ---------------------- - -* [Información General de Estructura de Una - Aplicación](structure/overview.md) -* [Scripts de Entrada](structure/entry-script.md) -* [Applicación](structure/application.md) -* [Componentes de Servicios](structure/service.md) -* [Acciones](structure/action.md) -* [Dominio](structure/domain.md) -* [Lógica de Intercambio (middleware)](structure/middleware.md) -* [Paquetes](structure/package.md) - -Conceptos Clave ------------- - -* [Autocarga de Clases (Autoloading)](concept/autoloading.md) -* [Contenedor de Inyección de Dependencia](concept/di-container.md) -* [Configuración](concept/configuration.md) -* [Alias](concept/aliases.md) -* [Eventos](concept/events.md) -* [Immutability](concept/immutability.md) + - -Gestión de las Peticiones ------------------ - -* [Enrutamiento y Creación de las URL](runtime/routing.md) -* [Peticiones (Requests)](runtime/request.md) -* [Respuestas (Responses)](runtime/response.md) -* [Sesiones (Sessions)](runtime/sessions.md) -* [Cookies](runtime/cookies.md) -* [Manejo de Errores](runtime/handling-errors.md) -* [Registros (logs)](runtime/logging.md) - -Views + ------ - -* [View](views/view.md) + -* [Template engines](views/template-engines.md) +- TODO: verify! -* [View injections](views/view-injections.md) + -* [Scripts, styles and metatags](views/script-style-meta.md) +- TODO: - verify! -* [Assets](views/asset.md) +- TODO: verify! -* [Widgets](views/widget.md) +- TODO: verify! - -Trabajar con Bases de Datos ----------------------- - -* [Objeto de Acceso a Datos](db-dao.md): Conexión a una base de datos, - consultas básicas, transacciones y manipulación de esquemas -* [Constructor de Consultas](db-query-builder.md): Consulta de la base de - datos utilizando una capa simple de abstracción -* [Active Record](db-active-record.md): ORM Active Record, recuperación y - manipulación de registros y definición de relaciones -* [Migraciones](db-migrations.md) - -Obtener Datos de los Usuarios ------------------------ - -* [Crear Formularios](input/forms.md) -* [Validar - Datos](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md) -* [Carga de Archivos](input/file-upload.md) -* [Obtener Datos de Formularios Tabulados (Tabular - Input)](input/tabular-input.md) - - -Visualizar Datos ---------------- - -* [Formato de Datos](output/formatting.md) -* [Paginación](output/pagination.md) -* [Ordenamiento](output/sorting.md) -* [Proveedores de Datos](output/data-providers.md) -* [Widgets de Datos](output/data-widgets.md) - -Seguridad --------- - -* [Información General de Seguridad](security/overview.md) -* [Autenticación](security/authentication.md) -* [Autorización](security/authorization.md) -* [Trabajar con Contraseñas](security/passwords.md) -* [Criptografía](security/cryptography.md) -* [Buenas Prácticas](security/best-practices.md) - - -Caché -------- - -* [Información General de Caché](caching/overview.md) -* [Caché de Datos](caching/data.md) -* [Caché de Fragmentos](caching/fragment.md) -* [Caché de Páginas](caching/page.md) -* [Caché HTTP](caching/http.md) - - -REST APIs - ------------ - -* [Inicio Rápido](rest/quick-start.md) -* [Recursos](rest/resources.md) -* [Controladores](rest/controllers.md) -* [Enrutamiento](rest/routing.md) -* [Autentificación](rest/authentication.md) -* [Límite de Solicitudes por Cliente (Rate Limiting)](rest/rate-limiting.md) -* [Gestión de Versiones](rest/versioning.md) -* [Manejo de Errores](rest/error-handling.md) - -Herramientas de Desarrollo ------------------ - -* Depurador y Barra de Herramientas de Depuración -* Generación de Código con Gii -* Generación de Documentación de API - - -Pruebas (Testing) -------- - -* [Información General de Pruebas](testing/overview.md) -* [Configuración del Entorno de Pruebas](testing/environment-setup.md) -* [Pruebas Unitarias](testing/unit.md) -* [Pruebas Funcionales](testing/functional.md) -* [Pruebas de Aceptación](testing/acceptance.md) -* [Datos de Prueba (Fixtures)](testing/fixtures.md) - - -Temas Especiales --------------- - -* [Creación de una Aplicación Desde Cero](tutorial/start-from-scratch.md) -* [Comandos de Consola](tutorial/console-applications.md) -* [Docker](tutorial/docker.md) -* [Internacionalización](tutorial/i18n.md) -* [Envío de Correos Electrónicos](tutorial/mailing.md) -* [Ajustes de Rendimiento](tutorial/performance-tuning.md) -* [Utilizar Yii con Bucle de Eventos](tutorial/using-with-event-loop.md) -* [Utilizar Yii con RoadRunner](tutorial/using-yii-with-roadrunner.md) -* [Using Yii with Swoole](tutorial/using-yii-with-swoole.md) + - -Widgets -------- - -* [GridView](https://www.yiiframework.com/doc-2.0/yii-grid-gridview.html) -* [ListView](https://www.yiiframework.com/doc-2.0/yii-widgets-listview.html) -* [DetailView](https://www.yiiframework.com/doc-2.0/yii-widgets-detailview.html) -* [ActiveForm](https://www.yiiframework.com/doc-2.0/guide-input-forms.html#activerecord-based-forms-activeform) -* [Menu](https://www.yiiframework.com/doc-2.0/yii-widgets-menu.html) -* [LinkPager](https://www.yiiframework.com/doc-2.0/yii-widgets-linkpager.html) -* [LinkSorter](https://www.yiiframework.com/doc-2.0/yii-widgets-linksorter.html) -* [Bootstrap - widgets](https://www.yiiframework.com/extension/yiisoft/yii2-bootstrap/doc/guide) - - -Clases Auxiliares -------- - -* [Arrays](https://github.com/yiisoft/arrays/) -* [Files](https://github.com/yiisoft/files/) -* [Html](https://github.com/yiisoft/html/) -* [Json](https://github.com/yiisoft/json) -* [Network utilities](https://github.com/yiisoft/network-utilities/) -* [VarDumper](https://github.com/yiisoft/var-dumper) -* [Strings](https://github.com/yiisoft/strings) +## Introduction -Extras + ------- - -* [Glossary](glossary.md) +- [About Yii](intro/what-is-yii.md) +- [Upgrading from version 2.0](intro/upgrade-from-v2.md) + +## Getting started + +- [What do you need to know?](start/prerequisites.md) +- [Creating a project](start/creating-project.md) +- [Running applications](start/workflow.md) +- [Saying hello](start/hello.md) +- [Working with forms](start/forms.md) +- [Working with databases](start/databases.md) TODO +- [Generating code with Gii](start/gii.md) TODO +- [Looking ahead](start/looking-ahead.md) + +## Application structure + +- [Application structure overview](structure/overview.md) +- [Entry scripts](structure/entry-script.md) +- [Application](structure/application.md) +- [Service components](structure/service.md) +- [Actions](structure/action.md) +- [Domain](structure/domain.md) +- [Middleware](structure/middleware.md) +- [Packages](structure/package.md) + +## Key concepts + +- [Class autoloading](concept/autoloading.md) +- [Dependency injection container](concept/di-container.md) +- [Configuration](concept/configuration.md) +- [Aliases](concept/aliases.md) +- [Events](concept/events.md) +- [Immutability](concept/immutability.md) + +## Handling requests + +- [Routing and URL generation](runtime/routing.md) +- [Request](runtime/request.md) +- [Response](runtime/response.md) +- [Sessions](runtime/sessions.md) +- [Cookies](runtime/cookies.md) +- [Handling errors](runtime/handling-errors.md) +- [Logging](runtime/logging.md) + +## Views + +- [View](views/view.md) +- [Template engines](views/template-engines.md) TODO: verify! +- [View injections](views/view-injections.md) +- [Scripts, styles and metatags](views/script-style-meta.md) TODO: verify! +- [Assets](views/asset.md) TODO: verify! +- [Widgets](views/widget.md) TODO: verify! + +## Working with databases + +- [Yii + DB](https://github.com/yiisoft/db/blob/master/docs/guide/en/README.md) +- [Active + Record](https://github.com/yiisoft/active-record/blob/master/README.md) +- [Migrations](databases/db-migrations.md) TODO: verify/update! + +## Getting data from users + +- [Creating forms](input/forms.md) TODO +- [Validating + input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md) +- [Uploading files](input/file-upload.md) TODO +- [Collecting tabular input](input/tabular-input.md) TODO + +## Displaying data + +- [Data formatting](output/formatting.md) TODO +- [Pagination](output/pagination.md) TODO +- [Sorting](output/sorting.md) TODO +- [Data providers](output/data-providers.md) TODO +- [Data widgets](output/data-widgets.md) TODO + +## Security + +- [Security overview](security/overview.md) +- [Authentication](security/authentication.md) +- [Authorization](security/authorization.md) TODO: verify and complete! +- [Working with passwords](security/passwords.md) +- [Cryptography](security/cryptography.md) +- [Best practices](security/best-practices.md) + + +## Caching + +- [Caching overview](caching/overview.md) +- [Data caching](caching/data.md) +- [Fragment caching](caching/fragment.md) TODO +- [Page caching](caching/page.md) TODO +- [HTTP caching](caching/http.md) TODO + + +## REST APIs + +- [Quick start](rest/quick-start.md) TODO +- [Resources](rest/resources.md) TODO +- [Controllers](rest/controllers.md) TODO +- [Routing](rest/routing.md) TODO +- [Authentication](rest/authentication.md) TODO +- [Rate limiting](rest/rate-limiting.md) TODO +- [Versioning](rest/versioning.md) TODO +- [Error handling](rest/error-handling.md) TODO + +## Development tools + +- Depurador y Barra de Herramientas de Depuración +- Generación de Código con Gii +- Generación de Documentación de API + + +## Testing + +- [Testing overview](testing/overview.md) TODO +- [Testing environment setup](testing/environment-setup.md) TODO +- [Unit tests](testing/unit.md) TODO +- [Functional tests](testing/functional.md) TODO +- [Acceptance tests](testing/acceptance.md) TODO +- [Fixtures](testing/fixtures.md) TODO + + +## Special topics + +- [Console applications](tutorial/console-applications.md) +- [Internationalization](tutorial/i18n.md) TODO +- [Mailing](tutorial/mailing.md) +- [Performance tuning](tutorial/performance-tuning.md) +- [Using Yii with event loop](tutorial/using-with-event-loop.md) +- [Using Yii with RoadRunner](tutorial/using-yii-with-roadrunner.md) +- [Using Yii with Swoole](tutorial/using-yii-with-swoole.md) + +## Helpers + +- [Arrays](https://github.com/yiisoft/arrays/) +- [Files](https://github.com/yiisoft/files/) +- [Html](https://github.com/yiisoft/html/) +- [Json](https://github.com/yiisoft/json) +- [Network utilities](https://github.com/yiisoft/network-utilities/) +- [VarDumper](https://github.com/yiisoft/var-dumper) +- [Strings](https://github.com/yiisoft/strings) + +## Extras + +- [Cookbook](../../cookbook/en/README.md) +- [Glossary](glossary.md) diff --git a/guide/es/glossary.md b/guide/es/glossary.md index 1cfcde9..cb8f973 100644 --- a/guide/es/glossary.md +++ b/guide/es/glossary.md @@ -8,7 +8,8 @@ Alias is a string used by Yii to refer to the class or directory such as ## asset Asset refers to a resource file. Typically, it contains JavaScript or CSS -code but can be any static content accessed via HTTP. +code but can be any static content accessed via HTTP. Read more in +["Assets"](views/asset.md). # C @@ -16,7 +17,7 @@ code but can be any static content accessed via HTTP. The Configuration may refer either to the process of setting properties of an object or to a configuration file that stores settings for an object, or -a class of objects. Read more in +a class of objects. Read more in ["Configuration"](concept/configuration.md). # D @@ -24,7 +25,8 @@ a class of objects. Read more in ## DI Dependency Injection is a programming technique where an object injects a -dependent object. ["DI"](concept/di-container.md) +dependent object. Read more in ["Dependency injection and +container"](concept/di-container.md). # I @@ -40,20 +42,21 @@ Yii, it's setting permissions and fulfilling software requirements. Middleware is a processor in the request processing stack. Given a request, it may either produce a response or do some action and pass processing to -the next middleware. Read more in ["Middleware"](structure/middleware.md). +the next middleware. Read more in ["Middleware"](structure/middleware.md). ## module -The module is a sub-application that groups some code based on a -use-case. It's typically used within the main application and may contain -URL handlers or console commands. +The module is a namespace that groups some code based on a use-case. It's +typically used within the main application and may contain any source code, +define additional URL handlers or console commands. # N ## namespace Namespace refers to a [PHP language -feature](https://www.php.net/manual/en/language.namespaces.php). +feature](https://www.php.net/manual/en/language.namespaces.php) to group +multiple classes under a certain name. # P @@ -76,12 +79,14 @@ does the actual processing. ## queue -A queue is similar to a stack. Queue follows First-In-First-Out methodology. +A queue is similar to a stack. Queue follows First-In-First-Out +methodology. Yii has a [yiisoft/queue](https://github.com/yiisoft/queue) +package. # V ## vendor A Vendor is an organization or individual developer providing code in the -form of packages. It also may refer to [Composer's `vendor` +form of packages. It also may refer to [Composer's `vendor` directory](https://getcomposer.org/doc/). diff --git a/guide/es/start/databases.md b/guide/es/start/databases.md index 4347813..19728c7 100644 --- a/guide/es/start/databases.md +++ b/guide/es/start/databases.md @@ -18,11 +18,162 @@ For non-relational ones, there are usually official libraries available: - ... In this guide, we will focus on working with relational databases using Yii -DB. +DB. We'll use PostgreSQL to implement a simple CRUD (create read update +delete). + +## Installing PostgreSQL + +You need to install PostgreSQL. If you prefer not to use Docker, [get the +installer from official website](https://www.postgresql.org/download/), +install it and create a database. + +If you use Docker, it is a bit simpler. Modify `docker/dev/compose.yml`: + + +```yaml +services: + app: + build: + dockerfile: docker/Dockerfile + context: .. + target: dev + args: + USER_ID: ${UID} + GROUP_ID: ${GID} + env_file: + - path: ./dev/.env + - path: ./dev/override.env + required: false + ports: + - "${DEV_PORT:-80}:80" + volumes: + - ../:/app + - ../runtime:/app/runtime + - caddy_data:/data + - caddy_config:/config + tty: true + depends_on: + db: + condition: service_healthy + + db: + image: postgres:${POSTGRES_VERSION:-15}-alpine + environment: + POSTGRES_DB: app + POSTGRES_PASSWORD: password + POSTGRES_USER: user + volumes: + - ./runtime/db:/var/lib/postgresql/data:rw + ports: + - "${DEV_DB_PORT:-5432}:5432" + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U user -d app" ] + interval: 5s + timeout: 5s + retries: 5 + +volumes: + db: +``` + +Note that we add `depends_on` so application waits for database to be up. + +Also, we'll need a `pdo_pgsql` extension to communicate with PostgreSQL. You +can enable it locally in `php.ini`. If you use Docker, check +`docker/Dockerfile` and add `pdo_pgsql` in `install-php-extensions` +list. Then rebuild PHP image with `make build && make down && make up`. ## Configuring connection -## Creating and applying migration +Now that we have the database, it's time to define the connection. We need a +package to be installed first: + +```sh +composer require yiisoft/db-pgsql +``` + +Now create `config/common/di/db-pgsql.php`: + +```php + [ + 'class' => Connection::class, + '__construct()' => [ + 'driver' => new Driver( + $params['yiisoft/db-pgsql']['dsn'], + $params['yiisoft/db-pgsql']['username'], + $params['yiisoft/db-pgsql']['password'], + ), + ], + ], +]; +``` + +And define parameters in `config/common/params.php`. For Docker that would +be: + +```php +use Yiisoft\Db\Pgsql\Dsn; + +return [ + // ... + 'yiisoft/db-pgsql' => [ + 'dsn' => (new Dsn('pgsql', 'db', 'app', '5432'))->asString(), + 'username' => 'user', + 'password' => 'password', + ], +]; +``` + +`db` host is resolved automatically within the Docker network. + +For local installation without Docker the host in Dsn would be +`localhost`. You'll have to adjust the rest to match how you configured the +database. + +## Creating and applying migrations + +For the initial state of the application and for further database changes, +it is a good idea to use migrations. These are files creating changes to be +applied to the database. Which are applied is tracked in the same database +so we always know which state is it now and what is to be applied. + +To use migrations we need another package installed: + +```sh +composer require yiisoft/db-migration +``` + +And a directory to store migrations such as `migrations` right in the +project root. + +Now you can use `yii migrate:create user` to create a new migration. For our +example we need a `page` table with some columns: + +```php + +public function up(MigrationBuilder $b): void +{ + $b->createTable('page', [ + 'id' => $b->primaryKey(), + 'title' => $b->string()->notNull(), + 'text' => $b->text()->notNull(), + 'created_at' => $b->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'), + 'updated_at' => $b->dateTime(), + 'deleted_at' => $b->dateTime(), + ]); +} +``` + +Apply it with `yii migrate:up`. ## Inserting diff --git a/guide/id/README.md b/guide/id/README.md index 8a0a3ee..0575a1c 100644 --- a/guide/id/README.md +++ b/guide/id/README.md @@ -3,193 +3,153 @@ Panduan ini dirilis di bawah [Ketentuan Dokumentasi Yii](https://www.yiiframework.com/license#docs). -Pengenalan + ------------- - -* [Tentang Yii](intro/what-is-yii.md) + -* [Memutakhirkan dari versi 2.0](intro/upgrade-from-v2.md) + - - -Mulai - ---------------- - -* [Apa yang perlu kamu ketahui](start/prerequisites.md) + -* [Membuat proyek](start/creating-project.md) + -* [Menjalankan Aplikasi](start/workflow.md) + -* [Mengucapkan halo](start/hello.md) + -* [Bekerja Dengan Formulir](start/forms.md) + -* [Bekerja Dengan Basis Data](start/databases.md) ! -* [Menghasilkan Kode dengan Gii](start/gii.md) - -* [Melihat ke depan](start/looking-ahead.md) + - - -Struktur Aplikasi + ---------------------- - -* [Application Structure Overview](structure/overview.md) + -* [Entry Scripts](structure/entry-script.md) + -* [Application](structure/application.md) + -* [Service components](structure/service.md) + -* [Actions](structure/action.md) + -* [Domain](structure/domain.md) + -* [Middleware](structure/middleware.md) + -* [Packages](structure/package.md) + - -Konsep Dasar - ------------- - -* [Class autoloading](concept/autoloading.md) + -* [Dependency Injection Container](concept/di-container.md) + -* [Configuration](concept/configuration.md) + -* [Aliases](concept/aliases.md) + -* [Events](concept/events.md) + -* [Immutability](concept/immutability.md) + - -Menangani Permintaan - ------------------ - -* [Routing and URL generation](runtime/routing.md) + -* [Request](runtime/request.md) + -* [Response](runtime/response.md) + -* [Sessions](runtime/sessions.md) + -* [Cookies](runtime/cookies.md) + -* [Handling errors](runtime/handling-errors.md) + -* [Logging](runtime/logging.md) + - -Views + ------ - -* [View](views/view.md) + -* [Template engines](views/template-engines.md) +- TODO: verify! -* [View injections](views/view-injections.md) + -* [Scripts, styles and metatags](views/script-style-meta.md) +- TODO: - verify! -* [Assets](views/asset.md) +- TODO: verify! -* [Widgets](views/widget.md) +- TODO: verify! - -Bekerja Dengan Basis Data +- ----------------------- - -* [Database Access Objects](db-dao.md): Menghubungkan ke basis data, - permintaan dasar,transaksi, dan manipulasi skema -* [Query Builder](db-query-builder.md): Meminta basis data menggunakan - lapisan abstraksi sederhana -* [Active Record](db-active-record.md): Active Record ORM, mengambil dan - memanipulasi catatan, dan mendefinisikan hubungan -* [Migrations](db-migrations.md): + - -Mendapatkan Data dari Pengguna - ------------------------ - -* [Membuat Formulir](input/forms.md) - -* [Memvalidasi - Input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md) - + -* [Mengunggah File](input/file-upload.md) - -* [Mengumpulkan Input Tabular](input/tabular-input.md) - - - -Menampilkan Data - ---------------- - -* [Data Formatting](output/formatting.md) - -* [Pagination](output/pagination.md) - -* [Sorting](output/sorting.md) - -* [Data Providers](output/data-providers.md) - -* [Data Widgets](output/data-widgets.md) - - -Keamanan +- --------- - -* [Ikhtisar Overview](security/overview.md) + -* [Autentikasi](security/authentication.md) + -* [Otorisasi](security/authorization.md) +- -* [Bekerja dengan Kata Sandi](security/passwords.md) + -* [Kriptografi](security/cryptography.md) + -* [Praktik terbaik](security/best-practices.md) + - - -Caching +- -------- - -* [Ikhtisar Caching](caching/overview.md) + -* [Data Caching](caching/data.md) + -* [Fragment Caching](caching/fragment.md) - -* [Page Caching](caching/page.md) - -* [HTTP caching](caching/http.md) - - - -RESTful Web Services - ----------------------- - -* [Mulai cepat](rest/quick-start.md) -* [Resources](rest/resources.md) -* [Controllers](rest/controllers.md) -* [Routing](rest/routing.md) -* [Authentication](rest/authentication.md) -* [Rate Limiting](rest/rate-limiting.md) -* [Versioning](rest/versioning.md) -* [Error Handling](rest/error-handling.md) - -Alat Pengembangan - ------------------ - -* Debug Toolbar and Debugger -* Membuat Kode menggunakan Gii -* Membuat Dokumentasi API - - -Pengujian - -------- - -* [Ikhtisar Pengujian](testing/overview.md) -* [Pengaturan lingkungan pengujian](testing/environment-setup.md) -* [Unit Tests](testing/unit.md) -* [Functional Tests](testing/functional.md) -* [Acceptance Tests](testing/acceptance.md) -* [Fixtures](testing/fixtures.md) - - -Topik Khusus - --------------- - -* [Membangun Aplikasi dari Awal](tutorial/start-from-scratch.md) - -* [Aplikasi Konsol](tutorial/console-applications.md) + -* [Docker](tutorial/docker.md) - -* [Penginternasionalan](tutorial/i18n.md) - -* [Mailing](tutorial/mailing.md) + -* [Penyesuaian Kinerja](tutorial/performance-tuning.md) + -* [Menggunakan Yii dengan event loop](tutorial/using-with-event-loop.md) + -* [Menggunakan Yii dengan RoadRunner](tutorial/using-yii-with-roadrunner.md) - + -* [Menggunakan Yii dengan Swoole](using-yii-with-swoole.md) + - -Widgets - -------- - -* [GridView](https://www.yiiframework.com/doc-2.0/yii-grid-gridview.html) -* [ListView](https://www.yiiframework.com/doc-2.0/yii-widgets-listview.html) -* [DetailView](https://www.yiiframework.com/doc-2.0/yii-widgets-detailview.html) -* [ActiveForm](https://www.yiiframework.com/doc-2.0/guide-input-forms.html#activerecord-based-forms-activeform) -* [Menu](https://www.yiiframework.com/doc-2.0/yii-widgets-menu.html) -* [LinkPager](https://www.yiiframework.com/doc-2.0/yii-widgets-linkpager.html) -* [LinkSorter](https://www.yiiframework.com/doc-2.0/yii-widgets-linksorter.html) -* [Bootstrap - Widgets](https://www.yiiframework.com/extension/yiisoft/yii2-bootstrap/doc/guide) - - -Helpers + -------- - -* [Arrays](https://github.com/yiisoft/arrays/) -* [Files](https://github.com/yiisoft/files/) -* [Html](https://github.com/yiisoft/html/) -* [Json](https://github.com/yiisoft/json) -* [Network utilities](https://github.com/yiisoft/network-utilities/) -* [VarDumper](https://github.com/yiisoft/var-dumper) -* [Strings](https://github.com/yiisoft/strings) - -Lainnya+ ------- - -* [Glosarium](glossary.md) +## Introduction + +- [About Yii](intro/what-is-yii.md) +- [Upgrading from version 2.0](intro/upgrade-from-v2.md) + +## Getting started + +- [What do you need to know?](start/prerequisites.md) +- [Creating a project](start/creating-project.md) +- [Running applications](start/workflow.md) +- [Saying hello](start/hello.md) +- [Working with forms](start/forms.md) +- [Working with databases](start/databases.md) TODO +- [Generating code with Gii](start/gii.md) TODO +- [Looking ahead](start/looking-ahead.md) + +## Application structure + +- [Application structure overview](structure/overview.md) +- [Entry scripts](structure/entry-script.md) +- [Application](structure/application.md) +- [Service components](structure/service.md) +- [Actions](structure/action.md) +- [Domain](structure/domain.md) +- [Middleware](structure/middleware.md) +- [Packages](structure/package.md) + +## Key concepts + +- [Class autoloading](concept/autoloading.md) +- [Dependency injection container](concept/di-container.md) +- [Configuration](concept/configuration.md) +- [Aliases](concept/aliases.md) +- [Events](concept/events.md) +- [Immutability](concept/immutability.md) + +## Handling requests + +- [Routing and URL generation](runtime/routing.md) +- [Request](runtime/request.md) +- [Response](runtime/response.md) +- [Sessions](runtime/sessions.md) +- [Cookies](runtime/cookies.md) +- [Handling errors](runtime/handling-errors.md) +- [Logging](runtime/logging.md) + +## Views + +- [View](views/view.md) +- [Template engines](views/template-engines.md) TODO: verify! +- [View injections](views/view-injections.md) +- [Scripts, styles and metatags](views/script-style-meta.md) TODO: verify! +- [Assets](views/asset.md) TODO: verify! +- [Widgets](views/widget.md) TODO: verify! + +## Working with databases + +- [Yii + DB](https://github.com/yiisoft/db/blob/master/docs/guide/en/README.md) +- [Active + Record](https://github.com/yiisoft/active-record/blob/master/README.md) +- [Migrations](databases/db-migrations.md) TODO: verify/update! + +## Getting data from users + +- [Creating forms](input/forms.md) TODO +- [Validating + input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md) +- [Uploading files](input/file-upload.md) TODO +- [Collecting tabular input](input/tabular-input.md) TODO + +## Displaying data + +- [Data formatting](output/formatting.md) TODO +- [Pagination](output/pagination.md) TODO +- [Sorting](output/sorting.md) TODO +- [Data providers](output/data-providers.md) TODO +- [Data widgets](output/data-widgets.md) TODO + +## Security + +- [Security overview](security/overview.md) +- [Authentication](security/authentication.md) +- [Authorization](security/authorization.md) TODO: verify and complete! +- [Working with passwords](security/passwords.md) +- [Cryptography](security/cryptography.md) +- [Best practices](security/best-practices.md) + + +## Caching + +- [Caching overview](caching/overview.md) +- [Data caching](caching/data.md) +- [Fragment caching](caching/fragment.md) TODO +- [Page caching](caching/page.md) TODO +- [HTTP caching](caching/http.md) TODO + + +## REST APIs + +- [Quick start](rest/quick-start.md) TODO +- [Resources](rest/resources.md) TODO +- [Controllers](rest/controllers.md) TODO +- [Routing](rest/routing.md) TODO +- [Authentication](rest/authentication.md) TODO +- [Rate limiting](rest/rate-limiting.md) TODO +- [Versioning](rest/versioning.md) TODO +- [Error handling](rest/error-handling.md) TODO + +## Development tools + +- Debug Toolbar and Debugger +- Membuat Kode menggunakan Gii +- Membuat Dokumentasi API + + +## Testing + +- [Testing overview](testing/overview.md) TODO +- [Testing environment setup](testing/environment-setup.md) TODO +- [Unit tests](testing/unit.md) TODO +- [Functional tests](testing/functional.md) TODO +- [Acceptance tests](testing/acceptance.md) TODO +- [Fixtures](testing/fixtures.md) TODO + + +## Special topics + +- [Console applications](tutorial/console-applications.md) +- [Internationalization](tutorial/i18n.md) TODO +- [Mailing](tutorial/mailing.md) +- [Performance tuning](tutorial/performance-tuning.md) +- [Using Yii with event loop](tutorial/using-with-event-loop.md) +- [Using Yii with RoadRunner](tutorial/using-yii-with-roadrunner.md) +- [Using Yii with Swoole](tutorial/using-yii-with-swoole.md) + +## Helpers + +- [Arrays](https://github.com/yiisoft/arrays/) +- [Files](https://github.com/yiisoft/files/) +- [Html](https://github.com/yiisoft/html/) +- [Json](https://github.com/yiisoft/json) +- [Network utilities](https://github.com/yiisoft/network-utilities/) +- [VarDumper](https://github.com/yiisoft/var-dumper) +- [Strings](https://github.com/yiisoft/strings) + +## Extras + +- [Cookbook](../../cookbook/en/README.md) +- [Glosarium](glossary.md) diff --git a/guide/id/glossary.md b/guide/id/glossary.md index 1cfcde9..cb8f973 100644 --- a/guide/id/glossary.md +++ b/guide/id/glossary.md @@ -8,7 +8,8 @@ Alias is a string used by Yii to refer to the class or directory such as ## asset Asset refers to a resource file. Typically, it contains JavaScript or CSS -code but can be any static content accessed via HTTP. +code but can be any static content accessed via HTTP. Read more in +["Assets"](views/asset.md). # C @@ -16,7 +17,7 @@ code but can be any static content accessed via HTTP. The Configuration may refer either to the process of setting properties of an object or to a configuration file that stores settings for an object, or -a class of objects. Read more in +a class of objects. Read more in ["Configuration"](concept/configuration.md). # D @@ -24,7 +25,8 @@ a class of objects. Read more in ## DI Dependency Injection is a programming technique where an object injects a -dependent object. ["DI"](concept/di-container.md) +dependent object. Read more in ["Dependency injection and +container"](concept/di-container.md). # I @@ -40,20 +42,21 @@ Yii, it's setting permissions and fulfilling software requirements. Middleware is a processor in the request processing stack. Given a request, it may either produce a response or do some action and pass processing to -the next middleware. Read more in ["Middleware"](structure/middleware.md). +the next middleware. Read more in ["Middleware"](structure/middleware.md). ## module -The module is a sub-application that groups some code based on a -use-case. It's typically used within the main application and may contain -URL handlers or console commands. +The module is a namespace that groups some code based on a use-case. It's +typically used within the main application and may contain any source code, +define additional URL handlers or console commands. # N ## namespace Namespace refers to a [PHP language -feature](https://www.php.net/manual/en/language.namespaces.php). +feature](https://www.php.net/manual/en/language.namespaces.php) to group +multiple classes under a certain name. # P @@ -76,12 +79,14 @@ does the actual processing. ## queue -A queue is similar to a stack. Queue follows First-In-First-Out methodology. +A queue is similar to a stack. Queue follows First-In-First-Out +methodology. Yii has a [yiisoft/queue](https://github.com/yiisoft/queue) +package. # V ## vendor A Vendor is an organization or individual developer providing code in the -form of packages. It also may refer to [Composer's `vendor` +form of packages. It also may refer to [Composer's `vendor` directory](https://getcomposer.org/doc/). diff --git a/guide/id/start/databases.md b/guide/id/start/databases.md index 4347813..19728c7 100644 --- a/guide/id/start/databases.md +++ b/guide/id/start/databases.md @@ -18,11 +18,162 @@ For non-relational ones, there are usually official libraries available: - ... In this guide, we will focus on working with relational databases using Yii -DB. +DB. We'll use PostgreSQL to implement a simple CRUD (create read update +delete). + +## Installing PostgreSQL + +You need to install PostgreSQL. If you prefer not to use Docker, [get the +installer from official website](https://www.postgresql.org/download/), +install it and create a database. + +If you use Docker, it is a bit simpler. Modify `docker/dev/compose.yml`: + + +```yaml +services: + app: + build: + dockerfile: docker/Dockerfile + context: .. + target: dev + args: + USER_ID: ${UID} + GROUP_ID: ${GID} + env_file: + - path: ./dev/.env + - path: ./dev/override.env + required: false + ports: + - "${DEV_PORT:-80}:80" + volumes: + - ../:/app + - ../runtime:/app/runtime + - caddy_data:/data + - caddy_config:/config + tty: true + depends_on: + db: + condition: service_healthy + + db: + image: postgres:${POSTGRES_VERSION:-15}-alpine + environment: + POSTGRES_DB: app + POSTGRES_PASSWORD: password + POSTGRES_USER: user + volumes: + - ./runtime/db:/var/lib/postgresql/data:rw + ports: + - "${DEV_DB_PORT:-5432}:5432" + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U user -d app" ] + interval: 5s + timeout: 5s + retries: 5 + +volumes: + db: +``` + +Note that we add `depends_on` so application waits for database to be up. + +Also, we'll need a `pdo_pgsql` extension to communicate with PostgreSQL. You +can enable it locally in `php.ini`. If you use Docker, check +`docker/Dockerfile` and add `pdo_pgsql` in `install-php-extensions` +list. Then rebuild PHP image with `make build && make down && make up`. ## Configuring connection -## Creating and applying migration +Now that we have the database, it's time to define the connection. We need a +package to be installed first: + +```sh +composer require yiisoft/db-pgsql +``` + +Now create `config/common/di/db-pgsql.php`: + +```php + [ + 'class' => Connection::class, + '__construct()' => [ + 'driver' => new Driver( + $params['yiisoft/db-pgsql']['dsn'], + $params['yiisoft/db-pgsql']['username'], + $params['yiisoft/db-pgsql']['password'], + ), + ], + ], +]; +``` + +And define parameters in `config/common/params.php`. For Docker that would +be: + +```php +use Yiisoft\Db\Pgsql\Dsn; + +return [ + // ... + 'yiisoft/db-pgsql' => [ + 'dsn' => (new Dsn('pgsql', 'db', 'app', '5432'))->asString(), + 'username' => 'user', + 'password' => 'password', + ], +]; +``` + +`db` host is resolved automatically within the Docker network. + +For local installation without Docker the host in Dsn would be +`localhost`. You'll have to adjust the rest to match how you configured the +database. + +## Creating and applying migrations + +For the initial state of the application and for further database changes, +it is a good idea to use migrations. These are files creating changes to be +applied to the database. Which are applied is tracked in the same database +so we always know which state is it now and what is to be applied. + +To use migrations we need another package installed: + +```sh +composer require yiisoft/db-migration +``` + +And a directory to store migrations such as `migrations` right in the +project root. + +Now you can use `yii migrate:create user` to create a new migration. For our +example we need a `page` table with some columns: + +```php + +public function up(MigrationBuilder $b): void +{ + $b->createTable('page', [ + 'id' => $b->primaryKey(), + 'title' => $b->string()->notNull(), + 'text' => $b->text()->notNull(), + 'created_at' => $b->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'), + 'updated_at' => $b->dateTime(), + 'deleted_at' => $b->dateTime(), + ]); +} +``` + +Apply it with `yii migrate:up`. ## Inserting diff --git a/guide/ru/README.md b/guide/ru/README.md index efcd412..48e7f12 100644 --- a/guide/ru/README.md +++ b/guide/ru/README.md @@ -3,192 +3,153 @@ We release this guide under the [Terms of Yii Documentation](https://www.yiiframework.com/license#docs). -Introduction + ------------- - -* [About Yii](intro/what-is-yii.md) + -* [Upgrading from version 2.0](intro/upgrade-from-v2.md) + - - -Getting started - ---------------- - -* [What do you need to know?](start/prerequisites.md) + -* [Creating a project](start/creating-project.md) + -* [Running applications](start/workflow.md) + -* [Saying hello](start/hello.md) + -* [Working with forms](start/forms.md) + -* [Working with databases](start/databases.md) ! -* [Generating code with Gii](start/gii.md) - -* [Looking ahead](start/looking-ahead.md) + - - -Application structure + ---------------------- - -* [Application structure overview](structure/overview.md) + -* [Entry scripts](structure/entry-script.md) + -* [Application](structure/application.md) + -* [Service components](structure/service.md) + -* [Actions](structure/action.md) + -* [Domain](structure/domain.md) + -* [Middleware](structure/middleware.md) + -* [Packages](structure/package.md) + - -Key concepts + ------------- - -* [Class autoloading](concept/autoloading.md) + -* [Dependency injection container](concept/di-container.md) + -* [Configuration](concept/configuration.md) + -* [Aliases](concept/aliases.md) + -* [Events](concept/events.md) + -* [Immutability](concept/immutability.md) + - -Handling requests + ------------------ - -* [Routing and URL generation](runtime/routing.md) + -* [Request](runtime/request.md) + -* [Response](runtime/response.md) + -* [Sessions](runtime/sessions.md) + -* [Cookies](runtime/cookies.md) + -* [Handling errors](runtime/handling-errors.md) + -* [Logging](runtime/logging.md) + - -Views + ------ - -* [View](views/view.md) + -* [Template engines](views/template-engines.md) +- TODO: verify! -* [View injections](views/view-injections.md) + -* [Scripts, styles and metatags](views/script-style-meta.md) +- TODO: - verify! -* [Assets](views/asset.md) +- TODO: verify! -* [Widgets](views/widget.md) +- TODO: verify! - -Working with databases +- ----------------------- - -* [Database access objects](db-dao.md): Connecting to a database, basic - queries, transactions, and schema manipulation -* [Query builder](db-query-builder.md): Querying the database using a simple - abstraction layer -* [Active record](db-active-record.md): The Active Record ORM, retrieving - and manipulating records, and defining relations -* [Migrations](databases/db-migrations.md): + - -Getting data from users - ------------------------ - -* [Creating forms](input/forms.md) - -* [Validating +## Introduction + +- [About Yii](intro/what-is-yii.md) +- [Upgrading from version 2.0](intro/upgrade-from-v2.md) + +## Getting started + +- [What do you need to know?](start/prerequisites.md) +- [Creating a project](start/creating-project.md) +- [Running applications](start/workflow.md) +- [Saying hello](start/hello.md) +- [Working with forms](start/forms.md) +- [Working with databases](start/databases.md) TODO +- [Generating code with Gii](start/gii.md) TODO +- [Looking ahead](start/looking-ahead.md) + +## Application structure + +- [Application structure overview](structure/overview.md) +- [Entry scripts](structure/entry-script.md) +- [Application](structure/application.md) +- [Service components](structure/service.md) +- [Actions](structure/action.md) +- [Domain](structure/domain.md) +- [Middleware](structure/middleware.md) +- [Packages](structure/package.md) + +## Key concepts + +- [Class autoloading](concept/autoloading.md) +- [Dependency injection container](concept/di-container.md) +- [Configuration](concept/configuration.md) +- [Aliases](concept/aliases.md) +- [Events](concept/events.md) +- [Immutability](concept/immutability.md) + +## Handling requests + +- [Routing and URL generation](runtime/routing.md) +- [Request](runtime/request.md) +- [Response](runtime/response.md) +- [Sessions](runtime/sessions.md) +- [Cookies](runtime/cookies.md) +- [Handling errors](runtime/handling-errors.md) +- [Logging](runtime/logging.md) + +## Views + +- [View](views/view.md) +- [Template engines](views/template-engines.md) TODO: verify! +- [View injections](views/view-injections.md) +- [Scripts, styles and metatags](views/script-style-meta.md) TODO: verify! +- [Assets](views/asset.md) TODO: verify! +- [Widgets](views/widget.md) TODO: verify! + +## Working with databases + +- [Yii + DB](https://github.com/yiisoft/db/blob/master/docs/guide/en/README.md) +- [Active + Record](https://github.com/yiisoft/active-record/blob/master/README.md) +- [Migrations](databases/db-migrations.md) TODO: verify/update! + +## Getting data from users + +- [Creating forms](input/forms.md) TODO +- [Validating input](https://github.com/yiisoft/validator/blob/master/docs/guide/en/README.md) - + -* [Uploading files](input/file-upload.md) - -* [Collecting tabular input](input/tabular-input.md) - - - -Displaying data - ---------------- - -* [Data formatting](output/formatting.md) - -* [Pagination](output/pagination.md) - -* [Sorting](output/sorting.md) - -* [Data providers](output/data-providers.md) - -* [Data widgets](output/data-widgets.md) - - -Security +- --------- - -* [Security overview](security/overview.md) + -* [Authentication](security/authentication.md) + -* [Authorization](security/authorization.md) +- -* [Working with passwords](security/passwords.md) + -* [Cryptography](security/cryptography.md) + -* [Best practices](security/best-practices.md) + - - -Caching +- -------- - -* [Caching overview](caching/overview.md) + -* [Data caching](caching/data.md) + -* [Fragment caching](caching/fragment.md) - -* [Page caching](caching/page.md) - -* [HTTP caching](caching/http.md) - - - -REST APIs - ------------ - -* [Quick start](rest/quick-start.md) -* [Resources](rest/resources.md) -* [Controllers](rest/controllers.md) -* [Routing](rest/routing.md) -* [Authentication](rest/authentication.md) -* [Rate limiting](rest/rate-limiting.md) -* [Versioning](rest/versioning.md) -* [Error handling](rest/error-handling.md) - -Development tools - ------------------ - -* Debug toolbar and debugger -* Generating code using Gii -* Generating API documentation - - -Testing - -------- - -* [Testing overview](testing/overview.md) -* [Testing environment setup](testing/environment-setup.md) -* [Unit tests](testing/unit.md) -* [Functional tests](testing/functional.md) -* [Acceptance tests](testing/acceptance.md) -* [Fixtures](testing/fixtures.md) - - -Special topics - --------------- - -* [Building application from scratch](tutorial/start-from-scratch.md) - -* [Console applications](tutorial/console-applications.md) + -* [Docker](tutorial/docker.md) - -* [Internationalization](tutorial/i18n.md) - -* [Mailing](tutorial/mailing.md) + -* [Performance tuning](tutorial/performance-tuning.md) + -* [Using Yii with event loop](tutorial/using-with-event-loop.md) + -* [Using Yii with RoadRunner](tutorial/using-yii-with-roadrunner.md) + -* [Using Yii with Swoole](tutorial/using-yii-with-swoole.md) + - -Widgets - -------- - -* [GridView](https://www.yiiframework.com/doc-2.0/yii-grid-gridview.html) -* [ListView](https://www.yiiframework.com/doc-2.0/yii-widgets-listview.html) -* [DetailView](https://www.yiiframework.com/doc-2.0/yii-widgets-detailview.html) -* [ActiveForm](https://www.yiiframework.com/doc-2.0/guide-input-forms.html#activerecord-based-forms-activeform) -* [Menu](https://www.yiiframework.com/doc-2.0/yii-widgets-menu.html) -* [LinkPager](https://www.yiiframework.com/doc-2.0/yii-widgets-linkpager.html) -* [LinkSorter](https://www.yiiframework.com/doc-2.0/yii-widgets-linksorter.html) -* [Bootstrap - widgets](https://www.yiiframework.com/extension/yiisoft/yii2-bootstrap/doc/guide) - - -Helpers + -------- - -* [Arrays](https://github.com/yiisoft/arrays/) -* [Files](https://github.com/yiisoft/files/) -* [Html](https://github.com/yiisoft/html/) -* [Json](https://github.com/yiisoft/json) -* [Network utilities](https://github.com/yiisoft/network-utilities/) -* [VarDumper](https://github.com/yiisoft/var-dumper) -* [Strings](https://github.com/yiisoft/strings) +- [Uploading files](input/file-upload.md) TODO +- [Collecting tabular input](input/tabular-input.md) TODO -Extras + ------- - -* [Glossary](glossary.md) +## Displaying data + +- [Data formatting](output/formatting.md) TODO +- [Pagination](output/pagination.md) TODO +- [Sorting](output/sorting.md) TODO +- [Data providers](output/data-providers.md) TODO +- [Data widgets](output/data-widgets.md) TODO + +## Security + +- [Security overview](security/overview.md) +- [Authentication](security/authentication.md) +- [Authorization](security/authorization.md) TODO: verify and complete! +- [Working with passwords](security/passwords.md) +- [Cryptography](security/cryptography.md) +- [Best practices](security/best-practices.md) + + +## Caching + +- [Caching overview](caching/overview.md) +- [Data caching](caching/data.md) +- [Fragment caching](caching/fragment.md) TODO +- [Page caching](caching/page.md) TODO +- [HTTP caching](caching/http.md) TODO + + +## REST APIs + +- [Quick start](rest/quick-start.md) TODO +- [Resources](rest/resources.md) TODO +- [Controllers](rest/controllers.md) TODO +- [Routing](rest/routing.md) TODO +- [Authentication](rest/authentication.md) TODO +- [Rate limiting](rest/rate-limiting.md) TODO +- [Versioning](rest/versioning.md) TODO +- [Error handling](rest/error-handling.md) TODO + +## Development tools + +- Debug toolbar and debugger +- Generating code using Gii +- Generating API documentation + + +## Testing + +- [Testing overview](testing/overview.md) TODO +- [Testing environment setup](testing/environment-setup.md) TODO +- [Unit tests](testing/unit.md) TODO +- [Functional tests](testing/functional.md) TODO +- [Acceptance tests](testing/acceptance.md) TODO +- [Fixtures](testing/fixtures.md) TODO + + +## Special topics + +- [Console applications](tutorial/console-applications.md) +- [Internationalization](tutorial/i18n.md) TODO +- [Mailing](tutorial/mailing.md) +- [Performance tuning](tutorial/performance-tuning.md) +- [Using Yii with event loop](tutorial/using-with-event-loop.md) +- [Using Yii with RoadRunner](tutorial/using-yii-with-roadrunner.md) +- [Using Yii with Swoole](tutorial/using-yii-with-swoole.md) + +## Helpers + +- [Arrays](https://github.com/yiisoft/arrays/) +- [Files](https://github.com/yiisoft/files/) +- [Html](https://github.com/yiisoft/html/) +- [Json](https://github.com/yiisoft/json) +- [Network utilities](https://github.com/yiisoft/network-utilities/) +- [VarDumper](https://github.com/yiisoft/var-dumper) +- [Strings](https://github.com/yiisoft/strings) + +## Extras + +- [Cookbook](../../cookbook/en/README.md) +- [Glossary](glossary.md) diff --git a/guide/ru/glossary.md b/guide/ru/glossary.md index 1cfcde9..cb8f973 100644 --- a/guide/ru/glossary.md +++ b/guide/ru/glossary.md @@ -8,7 +8,8 @@ Alias is a string used by Yii to refer to the class or directory such as ## asset Asset refers to a resource file. Typically, it contains JavaScript or CSS -code but can be any static content accessed via HTTP. +code but can be any static content accessed via HTTP. Read more in +["Assets"](views/asset.md). # C @@ -16,7 +17,7 @@ code but can be any static content accessed via HTTP. The Configuration may refer either to the process of setting properties of an object or to a configuration file that stores settings for an object, or -a class of objects. Read more in +a class of objects. Read more in ["Configuration"](concept/configuration.md). # D @@ -24,7 +25,8 @@ a class of objects. Read more in ## DI Dependency Injection is a programming technique where an object injects a -dependent object. ["DI"](concept/di-container.md) +dependent object. Read more in ["Dependency injection and +container"](concept/di-container.md). # I @@ -40,20 +42,21 @@ Yii, it's setting permissions and fulfilling software requirements. Middleware is a processor in the request processing stack. Given a request, it may either produce a response or do some action and pass processing to -the next middleware. Read more in ["Middleware"](structure/middleware.md). +the next middleware. Read more in ["Middleware"](structure/middleware.md). ## module -The module is a sub-application that groups some code based on a -use-case. It's typically used within the main application and may contain -URL handlers or console commands. +The module is a namespace that groups some code based on a use-case. It's +typically used within the main application and may contain any source code, +define additional URL handlers or console commands. # N ## namespace Namespace refers to a [PHP language -feature](https://www.php.net/manual/en/language.namespaces.php). +feature](https://www.php.net/manual/en/language.namespaces.php) to group +multiple classes under a certain name. # P @@ -76,12 +79,14 @@ does the actual processing. ## queue -A queue is similar to a stack. Queue follows First-In-First-Out methodology. +A queue is similar to a stack. Queue follows First-In-First-Out +methodology. Yii has a [yiisoft/queue](https://github.com/yiisoft/queue) +package. # V ## vendor A Vendor is an organization or individual developer providing code in the -form of packages. It also may refer to [Composer's `vendor` +form of packages. It also may refer to [Composer's `vendor` directory](https://getcomposer.org/doc/). diff --git a/guide/ru/start/databases.md b/guide/ru/start/databases.md index 4347813..19728c7 100644 --- a/guide/ru/start/databases.md +++ b/guide/ru/start/databases.md @@ -18,11 +18,162 @@ For non-relational ones, there are usually official libraries available: - ... In this guide, we will focus on working with relational databases using Yii -DB. +DB. We'll use PostgreSQL to implement a simple CRUD (create read update +delete). + +## Installing PostgreSQL + +You need to install PostgreSQL. If you prefer not to use Docker, [get the +installer from official website](https://www.postgresql.org/download/), +install it and create a database. + +If you use Docker, it is a bit simpler. Modify `docker/dev/compose.yml`: + + +```yaml +services: + app: + build: + dockerfile: docker/Dockerfile + context: .. + target: dev + args: + USER_ID: ${UID} + GROUP_ID: ${GID} + env_file: + - path: ./dev/.env + - path: ./dev/override.env + required: false + ports: + - "${DEV_PORT:-80}:80" + volumes: + - ../:/app + - ../runtime:/app/runtime + - caddy_data:/data + - caddy_config:/config + tty: true + depends_on: + db: + condition: service_healthy + + db: + image: postgres:${POSTGRES_VERSION:-15}-alpine + environment: + POSTGRES_DB: app + POSTGRES_PASSWORD: password + POSTGRES_USER: user + volumes: + - ./runtime/db:/var/lib/postgresql/data:rw + ports: + - "${DEV_DB_PORT:-5432}:5432" + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U user -d app" ] + interval: 5s + timeout: 5s + retries: 5 + +volumes: + db: +``` + +Note that we add `depends_on` so application waits for database to be up. + +Also, we'll need a `pdo_pgsql` extension to communicate with PostgreSQL. You +can enable it locally in `php.ini`. If you use Docker, check +`docker/Dockerfile` and add `pdo_pgsql` in `install-php-extensions` +list. Then rebuild PHP image with `make build && make down && make up`. ## Configuring connection -## Creating and applying migration +Now that we have the database, it's time to define the connection. We need a +package to be installed first: + +```sh +composer require yiisoft/db-pgsql +``` + +Now create `config/common/di/db-pgsql.php`: + +```php + [ + 'class' => Connection::class, + '__construct()' => [ + 'driver' => new Driver( + $params['yiisoft/db-pgsql']['dsn'], + $params['yiisoft/db-pgsql']['username'], + $params['yiisoft/db-pgsql']['password'], + ), + ], + ], +]; +``` + +And define parameters in `config/common/params.php`. For Docker that would +be: + +```php +use Yiisoft\Db\Pgsql\Dsn; + +return [ + // ... + 'yiisoft/db-pgsql' => [ + 'dsn' => (new Dsn('pgsql', 'db', 'app', '5432'))->asString(), + 'username' => 'user', + 'password' => 'password', + ], +]; +``` + +`db` host is resolved automatically within the Docker network. + +For local installation without Docker the host in Dsn would be +`localhost`. You'll have to adjust the rest to match how you configured the +database. + +## Creating and applying migrations + +For the initial state of the application and for further database changes, +it is a good idea to use migrations. These are files creating changes to be +applied to the database. Which are applied is tracked in the same database +so we always know which state is it now and what is to be applied. + +To use migrations we need another package installed: + +```sh +composer require yiisoft/db-migration +``` + +And a directory to store migrations such as `migrations` right in the +project root. + +Now you can use `yii migrate:create user` to create a new migration. For our +example we need a `page` table with some columns: + +```php + +public function up(MigrationBuilder $b): void +{ + $b->createTable('page', [ + 'id' => $b->primaryKey(), + 'title' => $b->string()->notNull(), + 'text' => $b->text()->notNull(), + 'created_at' => $b->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'), + 'updated_at' => $b->dateTime(), + 'deleted_at' => $b->dateTime(), + ]); +} +``` + +Apply it with `yii migrate:up`. ## Inserting From 864313820eb444190edd940cfcfa2234d6716c07 Mon Sep 17 00:00:00 2001 From: samdark <47294+samdark@users.noreply.github.com> Date: Wed, 22 Oct 2025 11:36:37 +0000 Subject: [PATCH 03/16] Update translation --- _translations/guide/po/ru/databases_db-migrations.md.po | 1 - _translations/guide/po/ru/start_databases.md.po | 1 - 2 files changed, 2 deletions(-) diff --git a/_translations/guide/po/ru/databases_db-migrations.md.po b/_translations/guide/po/ru/databases_db-migrations.md.po index 9d3335f..952e080 100644 --- a/_translations/guide/po/ru/databases_db-migrations.md.po +++ b/_translations/guide/po/ru/databases_db-migrations.md.po @@ -30,7 +30,6 @@ msgstr "" #. type: Fenced code block (sh) #: ../../guide/en/databases/db-migrations.md ../../guide/en/start/databases.md #, fuzzy, no-wrap -#| msgid "composer install yiisoft/security\n" msgid "composer require yiisoft/db-migration\n" msgstr "composer install yiisoft/security\n" diff --git a/_translations/guide/po/ru/start_databases.md.po b/_translations/guide/po/ru/start_databases.md.po index 0842e16..d0da9f2 100644 --- a/_translations/guide/po/ru/start_databases.md.po +++ b/_translations/guide/po/ru/start_databases.md.po @@ -25,7 +25,6 @@ msgstr "" #. type: Fenced code block (sh) #: ../../guide/en/databases/db-migrations.md ../../guide/en/start/databases.md #, fuzzy, no-wrap -#| msgid "composer install yiisoft/security\n" msgid "composer require yiisoft/db-migration\n" msgstr "composer install yiisoft/security\n" From 77824ed657310e2d2f73d84555dea70e201087b9 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 22 Oct 2025 23:12:12 +0300 Subject: [PATCH 04/16] Minor fixes --- guide/en/start/databases.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/guide/en/start/databases.md b/guide/en/start/databases.md index 1d9ff3d..0800006 100644 --- a/guide/en/start/databases.md +++ b/guide/en/start/databases.md @@ -119,7 +119,7 @@ use Yiisoft\Db\Pgsql\Dsn; return [ // ... 'yiisoft/db-pgsql' => [ - 'dsn' => (new Dsn('pgsql', 'db', 'app', '5432'))->asString(), + 'dsn' => new Dsn('pgsql', 'db', 'app', '5432'), 'username' => 'user', 'password' => 'password', ], @@ -133,9 +133,9 @@ how you configured the database. ## Creating and applying migrations -For the initial state of the application and for further database changes, it is a good idea to use migrations. These -are files creating changes to be applied to the database. Which are applied is tracked in the same database so we always -know which state is it now and what is to be applied. +For the initial state of the application and for further database changes, it is a good idea to use migrations. +These are files that create database changes. Applied migrations are tracked in the database, allowing us to know +the current state and which migrations remain to be applied. To use migrations we need another package installed: @@ -145,20 +145,22 @@ composer require yiisoft/db-migration And a directory to store migrations such as `migrations` right in the project root. -Now you can use `yii migrate:create user` to create a new migration. For our example we need a `page` table with some +Now you can use `yii migrate:create page` to create a new migration. For our example we need a `page` table with some columns: ```php public function up(MigrationBuilder $b): void { + $cb = $b->columnBuilder(); + $b->createTable('page', [ - 'id' => $b->primaryKey(), - 'title' => $b->string()->notNull(), - 'text' => $b->text()->notNull(), - 'created_at' => $b->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'), - 'updated_at' => $b->dateTime(), - 'deleted_at' => $b->dateTime(), + 'id' => $cb->primaryKey(), + 'title' => $cb->string()->notNull(), + 'text' => $cb->text()->notNull(), + 'created_at' => $cb->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'), + 'updated_at' => $cb->dateTime(), + 'deleted_at' => $cb->dateTime(), ]); } ``` From f9bca285f527d2ac118a170f6508f5e1d36c5642 Mon Sep 17 00:00:00 2001 From: samdark <47294+samdark@users.noreply.github.com> Date: Wed, 22 Oct 2025 20:13:19 +0000 Subject: [PATCH 05/16] Update translation --- .../guide/po/es/start_databases.md.po | 22 +++++++++------- .../guide/po/id/start_databases.md.po | 22 +++++++++------- .../guide/po/ru/start_databases.md.po | 22 +++++++++------- .../guide/pot/start_databases.md.pot | 26 ++++++++++--------- guide/es/start/databases.md | 24 +++++++++-------- guide/id/start/databases.md | 24 +++++++++-------- guide/ru/start/databases.md | 24 +++++++++-------- 7 files changed, 89 insertions(+), 75 deletions(-) diff --git a/_translations/guide/po/es/start_databases.md.po b/_translations/guide/po/es/start_databases.md.po index 345140e..c826577 100644 --- a/_translations/guide/po/es/start_databases.md.po +++ b/_translations/guide/po/es/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-10-22 11:35+0000\n" +"POT-Creation-Date: 2025-10-22 20:13+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -220,7 +220,7 @@ msgid "" "return [\n" " // ...\n" " 'yiisoft/db-pgsql' => [\n" -" 'dsn' => (new Dsn('pgsql', 'db', 'app', '5432'))->asString(),\n" +" 'dsn' => new Dsn('pgsql', 'db', 'app', '5432'),\n" " 'username' => 'user',\n" " 'password' => 'password',\n" " ],\n" @@ -245,7 +245,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "For the initial state of the application and for further database changes, it is a good idea to use migrations. These are files creating changes to be applied to the database. Which are applied is tracked in the same database so we always know which state is it now and what is to be applied." +msgid "For the initial state of the application and for further database changes, it is a good idea to use migrations. These are files that create database changes. Applied migrations are tracked in the database, allowing us to know the current state and which migrations remain to be applied." msgstr "" #. type: Plain text @@ -260,7 +260,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "Now you can use `yii migrate:create user` to create a new migration. For our example we need a `page` table with some columns:" +msgid "Now you can use `yii migrate:create page` to create a new migration. For our example we need a `page` table with some columns:" msgstr "" #. type: Fenced code block (php) @@ -270,13 +270,15 @@ msgid "" "\n" "public function up(MigrationBuilder $b): void\n" "{\n" +" $cb = $b->columnBuilder();\n" +"\n" " $b->createTable('page', [\n" -" 'id' => $b->primaryKey(),\n" -" 'title' => $b->string()->notNull(),\n" -" 'text' => $b->text()->notNull(),\n" -" 'created_at' => $b->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'),\n" -" 'updated_at' => $b->dateTime(),\n" -" 'deleted_at' => $b->dateTime(),\n" +" 'id' => $cb->primaryKey(),\n" +" 'title' => $cb->string()->notNull(),\n" +" 'text' => $cb->text()->notNull(),\n" +" 'created_at' => $cb->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'),\n" +" 'updated_at' => $cb->dateTime(),\n" +" 'deleted_at' => $cb->dateTime(),\n" " ]);\n" "}\n" msgstr "" diff --git a/_translations/guide/po/id/start_databases.md.po b/_translations/guide/po/id/start_databases.md.po index dccfb7f..95e863a 100644 --- a/_translations/guide/po/id/start_databases.md.po +++ b/_translations/guide/po/id/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-10-22 11:35+0000\n" +"POT-Creation-Date: 2025-10-22 20:13+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -220,7 +220,7 @@ msgid "" "return [\n" " // ...\n" " 'yiisoft/db-pgsql' => [\n" -" 'dsn' => (new Dsn('pgsql', 'db', 'app', '5432'))->asString(),\n" +" 'dsn' => new Dsn('pgsql', 'db', 'app', '5432'),\n" " 'username' => 'user',\n" " 'password' => 'password',\n" " ],\n" @@ -245,7 +245,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "For the initial state of the application and for further database changes, it is a good idea to use migrations. These are files creating changes to be applied to the database. Which are applied is tracked in the same database so we always know which state is it now and what is to be applied." +msgid "For the initial state of the application and for further database changes, it is a good idea to use migrations. These are files that create database changes. Applied migrations are tracked in the database, allowing us to know the current state and which migrations remain to be applied." msgstr "" #. type: Plain text @@ -260,7 +260,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "Now you can use `yii migrate:create user` to create a new migration. For our example we need a `page` table with some columns:" +msgid "Now you can use `yii migrate:create page` to create a new migration. For our example we need a `page` table with some columns:" msgstr "" #. type: Fenced code block (php) @@ -270,13 +270,15 @@ msgid "" "\n" "public function up(MigrationBuilder $b): void\n" "{\n" +" $cb = $b->columnBuilder();\n" +"\n" " $b->createTable('page', [\n" -" 'id' => $b->primaryKey(),\n" -" 'title' => $b->string()->notNull(),\n" -" 'text' => $b->text()->notNull(),\n" -" 'created_at' => $b->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'),\n" -" 'updated_at' => $b->dateTime(),\n" -" 'deleted_at' => $b->dateTime(),\n" +" 'id' => $cb->primaryKey(),\n" +" 'title' => $cb->string()->notNull(),\n" +" 'text' => $cb->text()->notNull(),\n" +" 'created_at' => $cb->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'),\n" +" 'updated_at' => $cb->dateTime(),\n" +" 'deleted_at' => $cb->dateTime(),\n" " ]);\n" "}\n" msgstr "" diff --git a/_translations/guide/po/ru/start_databases.md.po b/_translations/guide/po/ru/start_databases.md.po index d0da9f2..79d8c5e 100644 --- a/_translations/guide/po/ru/start_databases.md.po +++ b/_translations/guide/po/ru/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-10-22 11:35+0000\n" +"POT-Creation-Date: 2025-10-22 20:13+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -224,7 +224,7 @@ msgid "" "return [\n" " // ...\n" " 'yiisoft/db-pgsql' => [\n" -" 'dsn' => (new Dsn('pgsql', 'db', 'app', '5432'))->asString(),\n" +" 'dsn' => new Dsn('pgsql', 'db', 'app', '5432'),\n" " 'username' => 'user',\n" " 'password' => 'password',\n" " ],\n" @@ -249,7 +249,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "For the initial state of the application and for further database changes, it is a good idea to use migrations. These are files creating changes to be applied to the database. Which are applied is tracked in the same database so we always know which state is it now and what is to be applied." +msgid "For the initial state of the application and for further database changes, it is a good idea to use migrations. These are files that create database changes. Applied migrations are tracked in the database, allowing us to know the current state and which migrations remain to be applied." msgstr "" #. type: Plain text @@ -264,7 +264,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "Now you can use `yii migrate:create user` to create a new migration. For our example we need a `page` table with some columns:" +msgid "Now you can use `yii migrate:create page` to create a new migration. For our example we need a `page` table with some columns:" msgstr "" #. type: Fenced code block (php) @@ -274,13 +274,15 @@ msgid "" "\n" "public function up(MigrationBuilder $b): void\n" "{\n" +" $cb = $b->columnBuilder();\n" +"\n" " $b->createTable('page', [\n" -" 'id' => $b->primaryKey(),\n" -" 'title' => $b->string()->notNull(),\n" -" 'text' => $b->text()->notNull(),\n" -" 'created_at' => $b->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'),\n" -" 'updated_at' => $b->dateTime(),\n" -" 'deleted_at' => $b->dateTime(),\n" +" 'id' => $cb->primaryKey(),\n" +" 'title' => $cb->string()->notNull(),\n" +" 'text' => $cb->text()->notNull(),\n" +" 'created_at' => $cb->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'),\n" +" 'updated_at' => $cb->dateTime(),\n" +" 'deleted_at' => $cb->dateTime(),\n" " ]);\n" "}\n" msgstr "" diff --git a/_translations/guide/pot/start_databases.md.pot b/_translations/guide/pot/start_databases.md.pot index b5d35f0..04d0923 100644 --- a/_translations/guide/pot/start_databases.md.pot +++ b/_translations/guide/pot/start_databases.md.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-10-22 11:35+0000\n" +"POT-Creation-Date: 2025-10-22 20:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -243,7 +243,7 @@ msgid "" "return [\n" " // ...\n" " 'yiisoft/db-pgsql' => [\n" -" 'dsn' => (new Dsn('pgsql', 'db', 'app', '5432'))->asString(),\n" +" 'dsn' => new Dsn('pgsql', 'db', 'app', '5432'),\n" " 'username' => 'user',\n" " 'password' => 'password',\n" " ],\n" @@ -272,9 +272,9 @@ msgstr "" #: ../../guide/en/start/databases.md msgid "" "For the initial state of the application and for further database changes, " -"it is a good idea to use migrations. These are files creating changes to be " -"applied to the database. Which are applied is tracked in the same database " -"so we always know which state is it now and what is to be applied." +"it is a good idea to use migrations. These are files that create database " +"changes. Applied migrations are tracked in the database, allowing us to know " +"the current state and which migrations remain to be applied." msgstr "" #. type: Plain text @@ -292,7 +292,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md msgid "" -"Now you can use `yii migrate:create user` to create a new migration. For our " +"Now you can use `yii migrate:create page` to create a new migration. For our " "example we need a `page` table with some columns:" msgstr "" @@ -303,13 +303,15 @@ msgid "" "\n" "public function up(MigrationBuilder $b): void\n" "{\n" +" $cb = $b->columnBuilder();\n" +"\n" " $b->createTable('page', [\n" -" 'id' => $b->primaryKey(),\n" -" 'title' => $b->string()->notNull(),\n" -" 'text' => $b->text()->notNull(),\n" -" 'created_at' => $b->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'),\n" -" 'updated_at' => $b->dateTime(),\n" -" 'deleted_at' => $b->dateTime(),\n" +" 'id' => $cb->primaryKey(),\n" +" 'title' => $cb->string()->notNull(),\n" +" 'text' => $cb->text()->notNull(),\n" +" 'created_at' => $cb->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'),\n" +" 'updated_at' => $cb->dateTime(),\n" +" 'deleted_at' => $cb->dateTime(),\n" " ]);\n" "}\n" msgstr "" diff --git a/guide/es/start/databases.md b/guide/es/start/databases.md index 19728c7..8ac018f 100644 --- a/guide/es/start/databases.md +++ b/guide/es/start/databases.md @@ -126,7 +126,7 @@ use Yiisoft\Db\Pgsql\Dsn; return [ // ... 'yiisoft/db-pgsql' => [ - 'dsn' => (new Dsn('pgsql', 'db', 'app', '5432'))->asString(), + 'dsn' => new Dsn('pgsql', 'db', 'app', '5432'), 'username' => 'user', 'password' => 'password', ], @@ -142,9 +142,9 @@ database. ## Creating and applying migrations For the initial state of the application and for further database changes, -it is a good idea to use migrations. These are files creating changes to be -applied to the database. Which are applied is tracked in the same database -so we always know which state is it now and what is to be applied. +it is a good idea to use migrations. These are files that create database +changes. Applied migrations are tracked in the database, allowing us to know +the current state and which migrations remain to be applied. To use migrations we need another package installed: @@ -155,20 +155,22 @@ composer require yiisoft/db-migration And a directory to store migrations such as `migrations` right in the project root. -Now you can use `yii migrate:create user` to create a new migration. For our +Now you can use `yii migrate:create page` to create a new migration. For our example we need a `page` table with some columns: ```php public function up(MigrationBuilder $b): void { + $cb = $b->columnBuilder(); + $b->createTable('page', [ - 'id' => $b->primaryKey(), - 'title' => $b->string()->notNull(), - 'text' => $b->text()->notNull(), - 'created_at' => $b->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'), - 'updated_at' => $b->dateTime(), - 'deleted_at' => $b->dateTime(), + 'id' => $cb->primaryKey(), + 'title' => $cb->string()->notNull(), + 'text' => $cb->text()->notNull(), + 'created_at' => $cb->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'), + 'updated_at' => $cb->dateTime(), + 'deleted_at' => $cb->dateTime(), ]); } ``` diff --git a/guide/id/start/databases.md b/guide/id/start/databases.md index 19728c7..8ac018f 100644 --- a/guide/id/start/databases.md +++ b/guide/id/start/databases.md @@ -126,7 +126,7 @@ use Yiisoft\Db\Pgsql\Dsn; return [ // ... 'yiisoft/db-pgsql' => [ - 'dsn' => (new Dsn('pgsql', 'db', 'app', '5432'))->asString(), + 'dsn' => new Dsn('pgsql', 'db', 'app', '5432'), 'username' => 'user', 'password' => 'password', ], @@ -142,9 +142,9 @@ database. ## Creating and applying migrations For the initial state of the application and for further database changes, -it is a good idea to use migrations. These are files creating changes to be -applied to the database. Which are applied is tracked in the same database -so we always know which state is it now and what is to be applied. +it is a good idea to use migrations. These are files that create database +changes. Applied migrations are tracked in the database, allowing us to know +the current state and which migrations remain to be applied. To use migrations we need another package installed: @@ -155,20 +155,22 @@ composer require yiisoft/db-migration And a directory to store migrations such as `migrations` right in the project root. -Now you can use `yii migrate:create user` to create a new migration. For our +Now you can use `yii migrate:create page` to create a new migration. For our example we need a `page` table with some columns: ```php public function up(MigrationBuilder $b): void { + $cb = $b->columnBuilder(); + $b->createTable('page', [ - 'id' => $b->primaryKey(), - 'title' => $b->string()->notNull(), - 'text' => $b->text()->notNull(), - 'created_at' => $b->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'), - 'updated_at' => $b->dateTime(), - 'deleted_at' => $b->dateTime(), + 'id' => $cb->primaryKey(), + 'title' => $cb->string()->notNull(), + 'text' => $cb->text()->notNull(), + 'created_at' => $cb->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'), + 'updated_at' => $cb->dateTime(), + 'deleted_at' => $cb->dateTime(), ]); } ``` diff --git a/guide/ru/start/databases.md b/guide/ru/start/databases.md index 19728c7..8ac018f 100644 --- a/guide/ru/start/databases.md +++ b/guide/ru/start/databases.md @@ -126,7 +126,7 @@ use Yiisoft\Db\Pgsql\Dsn; return [ // ... 'yiisoft/db-pgsql' => [ - 'dsn' => (new Dsn('pgsql', 'db', 'app', '5432'))->asString(), + 'dsn' => new Dsn('pgsql', 'db', 'app', '5432'), 'username' => 'user', 'password' => 'password', ], @@ -142,9 +142,9 @@ database. ## Creating and applying migrations For the initial state of the application and for further database changes, -it is a good idea to use migrations. These are files creating changes to be -applied to the database. Which are applied is tracked in the same database -so we always know which state is it now and what is to be applied. +it is a good idea to use migrations. These are files that create database +changes. Applied migrations are tracked in the database, allowing us to know +the current state and which migrations remain to be applied. To use migrations we need another package installed: @@ -155,20 +155,22 @@ composer require yiisoft/db-migration And a directory to store migrations such as `migrations` right in the project root. -Now you can use `yii migrate:create user` to create a new migration. For our +Now you can use `yii migrate:create page` to create a new migration. For our example we need a `page` table with some columns: ```php public function up(MigrationBuilder $b): void { + $cb = $b->columnBuilder(); + $b->createTable('page', [ - 'id' => $b->primaryKey(), - 'title' => $b->string()->notNull(), - 'text' => $b->text()->notNull(), - 'created_at' => $b->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'), - 'updated_at' => $b->dateTime(), - 'deleted_at' => $b->dateTime(), + 'id' => $cb->primaryKey(), + 'title' => $cb->string()->notNull(), + 'text' => $cb->text()->notNull(), + 'created_at' => $cb->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'), + 'updated_at' => $cb->dateTime(), + 'deleted_at' => $cb->dateTime(), ]); } ``` From 139a410781501e6f93415e1afc9765e98a77f142 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sun, 2 Nov 2025 19:24:30 +0300 Subject: [PATCH 06/16] Continue the guide --- guide/en/start/databases.md | 232 ++++++++++++++++++++++++++++++++---- 1 file changed, 212 insertions(+), 20 deletions(-) diff --git a/guide/en/start/databases.md b/guide/en/start/databases.md index 0800006..a1b7b07 100644 --- a/guide/en/start/databases.md +++ b/guide/en/start/databases.md @@ -83,7 +83,7 @@ PHP image with `make build && make down && make up`. Now that we have the database, it's time to define the connection. We need a package to be installed first: ```sh -composer require yiisoft/db-pgsql +make composer require yiisoft/db-pgsql ``` Now create `config/common/di/db-pgsql.php`: @@ -143,37 +143,229 @@ To use migrations we need another package installed: composer require yiisoft/db-migration ``` -And a directory to store migrations such as `migrations` right in the project root. +Create a directory to store migrations `src/Migration` right in the project root. Add the following configuration to +`config/common/params.php`: -Now you can use `yii migrate:create page` to create a new migration. For our example we need a `page` table with some -columns: +```php +'yiisoft/db-migration' => [ + 'newMigrationNamespace' => 'App\\Migration', + 'sourceNamespaces' => ['App\\Migration'], +], +``` + +Now you can use `make yii migrate:create page` to create a new migration. For our example we need a `page` table +with some columns: + +```php +createTable('page', [ + 'id' => $b->uuidPrimaryKey(), + 'title' => $b->string()->notNull(), + 'slug' => $b->string()->notNull(), + 'text' => $b->text()->notNull(), + 'created_at' => $b->dateTime()->notNull(), + 'updated_at' => $b->dateTime(), + 'deleted_at' => $b->dateTime(), + ]); + } + + public function down(MigrationBuilder $b): void + { + $b->dropTable('page'); + } +} +``` + +Note that we use UUID as the primary key. While the storage space is a bit bigger than using int, the workflow with +such IDs is beneficial. You generate the ID yourself so you can define a set of related data and save it in a single +transaction. The entities that define this set of data in the code are often called an "aggregate". + +Apply it with `make yii migrate:up`. + +## An entity + +Now that you have a table it is time to define an entity in the code. Create `src/Web/Page/Page.php`: + +```php +toSlug($this->title); + } + + public function isDeleted(): bool + { + return $this->deletedAt !== null; + } +} +``` + +## Collection + +You need to select both single pages and page collection. Let's make the collection typed. +Create `src/Web/Page/PageCollection.php`: + +```php +pages = $pages; + } + + public function add(Page $page): void + { + $this->pages[] = $page; + } + + /** + * @return Traversable + */ + public function getIterator(): Traversable + { + return new ArrayIterator($this->pages); + } +} +``` + +## Repository + +Now that we have entity and collection, we need a place for methods to save an entity, delete it and select either +a single page or page collection. + +Create `src/Web/Page/PageRepository.php`: ```php +columnBuilder(); - - $b->createTable('page', [ - 'id' => $cb->primaryKey(), - 'title' => $cb->string()->notNull(), - 'text' => $cb->text()->notNull(), - 'created_at' => $cb->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'), - 'updated_at' => $cb->dateTime(), - 'deleted_at' => $cb->dateTime(), - ]); + public function __construct( + private ConnectionInterface $connection, + ) {} + + public function save(Page $page): void + { + $this->connection->createCommand()->upsert('{{%page}}', [ + 'id' => $page->id, + 'title' => $page->title, + 'slug' => $page->getSlug(), + 'text' => $page->text, + 'created_at' => $page->createdAt, + 'updated_at' => $page->updatedAt, + 'deleted_at' => $page->deletedAt, + ])->execute(); + } + + public function findOneBySlug(string $slug): ?Page + { + $data = (new Query($this->connection)) + ->select('*') + ->from('{{%page}}') + ->where('slug = :slug') + ->one(); + + if ($data === null) { + return null; + } + + return $this->createPage($data); + } + + public function findAll(): PageCollection + { + $collection = new PageCollection(); + + $data = (new Query($this->connection)) + ->select('*') + ->from('{{%page}}') + ->all(); + + foreach ($data as $page) { + $collection->add($this->createPage($page)); + } + + return $collection; + } + + private function createPage(array $data): Page + { + return new Page( + id: $data['id'], + title: $data['title'], + text: $data['text'], + createdAt: new DateTimeImmutable($data['createdAt']), + updatedAt: new DateTimeImmutable($data['updatedAt']), + deletedAt: $data['deletedAt'] ? new DateTimeImmutable($data['deletedAt']) : null, + ); + } + + public function delete(string $id): void + { + $this->connection->createCommand()->delete('{{%page}}', ['id' => $id])->execute(); + } } ``` -Apply it with `yii migrate:up`. +## Actions and routes -## Inserting +You need actions to: -## Selecting +1. List all pages. +2. View a page. +3. Delete a page. +4. Create a page. +5. Edit a page. -## Using data package -### Pagination > [!NOTE] > [← Working with forms](forms.md) | From 96f78434c2e2a3e0bd0ad05538632795abe1a28d Mon Sep 17 00:00:00 2001 From: samdark <47294+samdark@users.noreply.github.com> Date: Sun, 2 Nov 2025 16:25:23 +0000 Subject: [PATCH 07/16] Update translation --- .../guide/po/es/start_databases.md.po | 279 +++++++++++++++-- .../guide/po/es/structure_domain.md.po | 74 ++--- .../guide/po/es/structure_service.md.po | 53 ++-- .../guide/po/id/start_databases.md.po | 279 +++++++++++++++-- .../guide/po/id/structure_domain.md.po | 74 ++--- .../guide/po/id/structure_service.md.po | 53 ++-- .../guide/po/ru/start_databases.md.po | 279 +++++++++++++++-- .../guide/po/ru/structure_domain.md.po | 74 ++--- .../guide/po/ru/structure_service.md.po | 53 ++-- .../guide/pot/start_databases.md.pot | 294 ++++++++++++++++-- .../guide/pot/structure_domain.md.pot | 74 ++--- .../guide/pot/structure_service.md.pot | 53 ++-- guide/es/start/databases.md | 236 ++++++++++++-- guide/id/start/databases.md | 236 ++++++++++++-- guide/ru/start/databases.md | 236 ++++++++++++-- 15 files changed, 1946 insertions(+), 401 deletions(-) diff --git a/_translations/guide/po/es/start_databases.md.po b/_translations/guide/po/es/start_databases.md.po index c826577..4c85cfc 100644 --- a/_translations/guide/po/es/start_databases.md.po +++ b/_translations/guide/po/es/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-10-22 20:13+0000\n" +"POT-Creation-Date: 2025-11-02 16:25+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -172,7 +172,7 @@ msgstr "" #. type: Fenced code block (sh) #: ../../guide/en/start/databases.md #, no-wrap -msgid "composer require yiisoft/db-pgsql\n" +msgid "make composer require yiisoft/db-pgsql\n" msgstr "" #. type: Plain text @@ -255,61 +255,296 @@ msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "And a directory to store migrations such as `migrations` right in the project root." +msgid "Create a directory to store migrations `src/Migration` right in the project root. Add the following configuration to `config/common/params.php`:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"'yiisoft/db-migration' => [\n" +" 'newMigrationNamespace' => 'App\\\\Migration',\n" +" 'sourceNamespaces' => ['App\\\\Migration'],\n" +"],\n" msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "Now you can use `yii migrate:create page` to create a new migration. For our example we need a `page` table with some columns:" +msgid "Now you can use `make yii migrate:create page` to create a new migration. For our example we need a `page` table with some columns:" msgstr "" #. type: Fenced code block (php) #: ../../guide/en/start/databases.md #, no-wrap msgid "" +"columnBuilder();\n" -"\n" -" $b->createTable('page', [\n" -" 'id' => $cb->primaryKey(),\n" -" 'title' => $cb->string()->notNull(),\n" -" 'text' => $cb->text()->notNull(),\n" -" 'created_at' => $cb->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'),\n" -" 'updated_at' => $cb->dateTime(),\n" -" 'deleted_at' => $cb->dateTime(),\n" -" ]);\n" +" public function up(MigrationBuilder $b): void\n" +" {\n" +" $b->createTable('page', [\n" +" 'id' => $b->uuidPrimaryKey(),\n" +" 'title' => $b->string()->notNull(),\n" +" 'slug' => $b->string()->notNull(),\n" +" 'text' => $b->text()->notNull(),\n" +" 'created_at' => $b->dateTime()->notNull(),\n" +" 'updated_at' => $b->dateTime(),\n" +" 'deleted_at' => $b->dateTime(),\n" +" ]);\n" +" }\n" +"\n" +" public function down(MigrationBuilder $b): void\n" +" {\n" +" $b->dropTable('page');\n" +" }\n" "}\n" msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "Apply it with `yii migrate:up`." +msgid "Note that we use UUID as the primary key. While the storage space is a bit bigger than using int, the workflow with such IDs is beneficial. You generate the ID yourself so you can define a set of related data and save it in a single transaction. The entities that define this set of data in the code are often called an \"aggregate\"." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Apply it with `make yii migrate:up`." msgstr "" #. type: Title ## #: ../../guide/en/start/databases.md #, no-wrap -msgid "Inserting" +msgid "An entity" msgstr "" -#. type: Title ## +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Now that you have a table it is time to define an entity in the code. Create `src/Web/Page/Page.php`:" +msgstr "" + +#. type: Fenced code block (php) #: ../../guide/en/start/databases.md #, no-wrap -msgid "Selecting" +msgid "" +"toSlug($this->title);\n" +" }\n" +"\n" +" public function isDeleted(): bool\n" +" {\n" +" return $this->deletedAt !== null;\n" +" }\n" +"}\n" msgstr "" #. type: Title ## #: ../../guide/en/start/databases.md #, no-wrap -msgid "Using data package" +msgid "Collection" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "You need to select both single pages and page collection. Let's make the collection typed. Create `src/Web/Page/PageCollection.php`:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"pages = $pages;\n" +" }\n" +"\n" +" public function add(Page $page): void\n" +" {\n" +" $this->pages[] = $page;\n" +" }\n" +"\n" +" /**\n" +" * @return Traversable\n" +" */\n" +" public function getIterator(): Traversable\n" +" {\n" +" return new ArrayIterator($this->pages);\n" +" }\n" +"}\n" +msgstr "" + +#. type: Bullet: '- ' +#: ../../guide/en/start/databases.md ../../guide/en/structure/domain.md +#: ../../guide/en/structure/service.md +#, no-wrap +msgid "Repository" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Now that we have entity and collection, we need a place for methods to save an entity, delete it and select either a single page or page collection." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Create `src/Web/Page/PageRepository.php`:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"connection->createCommand()->upsert('{{%page}}', [\n" +" 'id' => $page->id,\n" +" 'title' => $page->title,\n" +" 'slug' => $page->getSlug(),\n" +" 'text' => $page->text,\n" +" 'created_at' => $page->createdAt,\n" +" 'updated_at' => $page->updatedAt,\n" +" 'deleted_at' => $page->deletedAt,\n" +" ])->execute();\n" +" }\n" +"\n" +" public function findOneBySlug(string $slug): ?Page\n" +" {\n" +" $data = (new Query($this->connection))\n" +" ->select('*')\n" +" ->from('{{%page}}')\n" +" ->where('slug = :slug')\n" +" ->one();\n" +"\n" +" if ($data === null) {\n" +" return null;\n" +" }\n" +"\n" +" return $this->createPage($data);\n" +" }\n" +"\n" +" public function findAll(): PageCollection\n" +" {\n" +" $collection = new PageCollection();\n" +"\n" +" $data = (new Query($this->connection))\n" +" ->select('*')\n" +" ->from('{{%page}}')\n" +" ->all();\n" +"\n" +" foreach ($data as $page) {\n" +" $collection->add($this->createPage($page));\n" +" }\n" +"\n" +" return $collection;\n" +" }\n" +"\n" +" private function createPage(array $data): Page\n" +" {\n" +" return new Page(\n" +" id: $data['id'],\n" +" title: $data['title'],\n" +" text: $data['text'],\n" +" createdAt: new DateTimeImmutable($data['createdAt']),\n" +" updatedAt: new DateTimeImmutable($data['updatedAt']),\n" +" deletedAt: $data['deletedAt'] ? new DateTimeImmutable($data['deletedAt']) : null,\n" +" );\n" +" }\n" +"\n" +" public function delete(string $id): void\n" +" {\n" +" $this->connection->createCommand()->delete('{{%page}}', ['id' => $id])->execute();\n" +" }\n" +"}\n" msgstr "" -#. type: Title ### +#. type: Title ## #: ../../guide/en/start/databases.md #, no-wrap -msgid "Pagination" +msgid "Actions and routes" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "You need actions to:" +msgstr "" + +#. type: Bullet: '1. ' +#: ../../guide/en/start/databases.md +msgid "List all pages." +msgstr "" + +#. type: Bullet: '2. ' +#: ../../guide/en/start/databases.md +msgid "View a page." +msgstr "" + +#. type: Bullet: '3. ' +#: ../../guide/en/start/databases.md +msgid "Delete a page." +msgstr "" + +#. type: Bullet: '4. ' +#: ../../guide/en/start/databases.md +msgid "Create a page." +msgstr "" + +#. type: Bullet: '5. ' +#: ../../guide/en/start/databases.md +msgid "Edit a page." msgstr "" #. type: Plain text diff --git a/_translations/guide/po/es/structure_domain.md.po b/_translations/guide/po/es/structure_domain.md.po index e89bde8..0cf553b 100644 --- a/_translations/guide/po/es/structure_domain.md.po +++ b/_translations/guide/po/es/structure_domain.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-04 11:19+0500\n" +"POT-Creation-Date: 2025-11-02 16:25+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -17,20 +17,28 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. type: Title ## -#: en/concept/autoloading.md en/security/best-practices.md -#: en/structure/domain.md en/tutorial/console-applications.md +#: ../../guide/en/concept/autoloading.md +#: ../../guide/en/security/best-practices.md ../../guide/en/structure/domain.md +#: ../../guide/en/tutorial/console-applications.md #, no-wrap msgid "References" msgstr "Referencias" +#. type: Bullet: '- ' +#: ../../guide/en/start/databases.md ../../guide/en/structure/domain.md +#: ../../guide/en/structure/service.md +#, no-wrap +msgid "Repository" +msgstr "" + #. type: Title # -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Domain" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "" "The Domain or domain model is what makes the project unique. With requirements and terminology of the problem being solved\n" @@ -40,7 +48,7 @@ msgid "" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "" "> [!NOTE]\n" @@ -51,136 +59,130 @@ msgid "" msgstr "" #. type: Title ## -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Bounded context" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "It's nearly impossible to build a model that solves multiple problems that aren't too complicated by itself. Therefore, it's a good practice to divide the domain into several use-cases and have a separate model for each use-case. Such separated models are called \"bounded contexts.\"" msgstr "" #. type: Title ## -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Building blocks" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "There are various building blocks that are typically used when describing domain models. It isn't mandatory to use them all." msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md en/structure/service.md +#: ../../guide/en/structure/domain.md ../../guide/en/structure/service.md #, no-wrap msgid "Entity" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Entity is a uniquely identifiable object such as user, product, payment, etc. When comparing them, you're checking ID, not the attribute values. If there are two objects with different attributes but the same ID, they're considered being the same thing." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Value object" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Value object describes an object by its characteristics. For example, a price that consists of value and currency. When comparing such objects, you're checking actual values. If they match, an object is considered to be the same." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Aggregate" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Aggregate is a set of domain objects such as entities and value objects and additional data that could be treated as a single unit. It usually represents a compound object from a domain model such as shop order or HR person dossier." msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "One of the components of an aggregate is called a root. The root identifies an aggregate as a whole and should be used to access it." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Domain event" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "An aggregate, while processed, may raise events. For example, when order is confirmed, `OrderConfirmed` event would be risen so other parts of the system may react on these." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Data transfer object" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Data transfer object or DTO is an object whose only purpose is to hold data as it is. It's commonly used to pass data between different services." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Service" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Service is a class that contains a standalone operation within the context of your domain model. See \"[service components](service.md)\"." msgstr "" -#. type: Bullet: '- ' -#: en/structure/domain.md en/structure/service.md -#, no-wrap -msgid "Repository" -msgstr "" - #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "The repository task is to abstract away how domain objects are obtained. These are usually separated into two parts: an interface that stays in the domain layer and an implementation that's situated in the infrastructure layer. In such a way, domain doesn't care how data is obtained and saved and may be focused around the complicated business logic instead." msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Repository is usually implemented as a service." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Instantiating building blocks" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Entity, value object, aggregate, and domain events aren't services and shouldn't be instantiated through DI container. Using `new` is the way to go with these." msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "[BoundedContext by Martin Fowler](https://martinfowler.com/bliki/BoundedContext.html)" msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "[ValueObject by Martin Fowler](https://martinfowler.com/bliki/ValueObject.html)" msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "[Aggregate by Marting Fowler](https://martinfowler.com/bliki/DDD_Aggregate.html)" msgstr "" diff --git a/_translations/guide/po/es/structure_service.md.po b/_translations/guide/po/es/structure_service.md.po index fd3b204..e432690 100644 --- a/_translations/guide/po/es/structure_service.md.po +++ b/_translations/guide/po/es/structure_service.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-04 11:19+0500\n" +"POT-Creation-Date: 2025-11-02 16:25+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -17,30 +17,31 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. type: Bullet: '- ' -#: en/structure/domain.md en/structure/service.md +#: ../../guide/en/start/databases.md ../../guide/en/structure/domain.md +#: ../../guide/en/structure/service.md #, no-wrap -msgid "Entity" +msgid "Repository" msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md en/structure/service.md +#: ../../guide/en/structure/domain.md ../../guide/en/structure/service.md #, no-wrap -msgid "Repository" +msgid "Entity" msgstr "" #. type: Title # -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "Service components" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Application may get complicated, so it makes sense to extract focused parts of business logic or infrastructure into service components. They're typically injected into other components or action handlers. It's usually done via autowiring:" msgstr "" #. type: Fenced code block (php) -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "" "public function actionIndex(CurrentRoute $route, MyService $myService): ResponseInterface\n" @@ -55,12 +56,12 @@ msgid "" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Yii3 doesn't technically imply any limitations on how you build services. In general, there's no need to extend from a base class or implement a certain interface:" msgstr "" #. type: Fenced code block (php) -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "" "final readonly class MyService\n" @@ -79,43 +80,43 @@ msgid "" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Services either perform a task or return data. They're created once, put into a DI container and then could be used multiple times. Because of that, it's a good idea to keep your services stateless that's both service itself and any of its dependencies shouldn't hold state. You can ensure it by using `readonly` PHP keyword at class level." msgstr "" #. type: Title ## -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "Service dependencies and configuration" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Services should always define all their dependencies on other services via `__construct()`. It both allows you to use a service right away after it's created and serves as an indicator of a service doing too much if there are too many dependencies." msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "After the service is created, it shouldn't be re-configured in runtime." msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "DI container instance usually **shouldn't** be injected as a dependency. Prefer concrete interfaces." msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "In case of complicated or \"heavy\" initialization, try to postpone it until the service method is called." msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "The same is valid for configuration values. They should be provided as a constructor argument. Related values could be grouped together into value objects. For example, database connection usually requires DSN string, username and password. These three could be combined into Dsn class:" msgstr "" #. type: Fenced code block (php) -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "" "final readonly class Dsn\n" @@ -139,18 +140,18 @@ msgid "" msgstr "" #. type: Title ## -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "Service methods" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Service method usually does something. It could be a simple thing repeated exactly, but usually it depends on the context. For example:" msgstr "" #. type: Fenced code block (php) -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "" "final readonly class PostPersister\n" @@ -169,27 +170,27 @@ msgid "" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "There's a service that is saving posts into permanent storage such as a database. An object allowing communication with a concrete storage is always the same, so it's injected using constructor while the post saved could vary, so it's passed as a method argument." msgstr "" #. type: Title ## -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "Is everything a service?" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Often it makes sense to choose another class type to place your code into. Check:" msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Widget" msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "[Middleware](middleware.md)" msgstr "" diff --git a/_translations/guide/po/id/start_databases.md.po b/_translations/guide/po/id/start_databases.md.po index 95e863a..f833f34 100644 --- a/_translations/guide/po/id/start_databases.md.po +++ b/_translations/guide/po/id/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-10-22 20:13+0000\n" +"POT-Creation-Date: 2025-11-02 16:25+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -172,7 +172,7 @@ msgstr "" #: ../../guide/en/start/databases.md #, fuzzy, no-wrap #| msgid "composer require yiisoft/cache\n" -msgid "composer require yiisoft/db-pgsql\n" +msgid "make composer require yiisoft/db-pgsql\n" msgstr "composer require yiisoft/cache\n" #. type: Plain text @@ -255,61 +255,296 @@ msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "And a directory to store migrations such as `migrations` right in the project root." +msgid "Create a directory to store migrations `src/Migration` right in the project root. Add the following configuration to `config/common/params.php`:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"'yiisoft/db-migration' => [\n" +" 'newMigrationNamespace' => 'App\\\\Migration',\n" +" 'sourceNamespaces' => ['App\\\\Migration'],\n" +"],\n" msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "Now you can use `yii migrate:create page` to create a new migration. For our example we need a `page` table with some columns:" +msgid "Now you can use `make yii migrate:create page` to create a new migration. For our example we need a `page` table with some columns:" msgstr "" #. type: Fenced code block (php) #: ../../guide/en/start/databases.md #, no-wrap msgid "" +"columnBuilder();\n" -"\n" -" $b->createTable('page', [\n" -" 'id' => $cb->primaryKey(),\n" -" 'title' => $cb->string()->notNull(),\n" -" 'text' => $cb->text()->notNull(),\n" -" 'created_at' => $cb->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'),\n" -" 'updated_at' => $cb->dateTime(),\n" -" 'deleted_at' => $cb->dateTime(),\n" -" ]);\n" +" public function up(MigrationBuilder $b): void\n" +" {\n" +" $b->createTable('page', [\n" +" 'id' => $b->uuidPrimaryKey(),\n" +" 'title' => $b->string()->notNull(),\n" +" 'slug' => $b->string()->notNull(),\n" +" 'text' => $b->text()->notNull(),\n" +" 'created_at' => $b->dateTime()->notNull(),\n" +" 'updated_at' => $b->dateTime(),\n" +" 'deleted_at' => $b->dateTime(),\n" +" ]);\n" +" }\n" +"\n" +" public function down(MigrationBuilder $b): void\n" +" {\n" +" $b->dropTable('page');\n" +" }\n" "}\n" msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "Apply it with `yii migrate:up`." +msgid "Note that we use UUID as the primary key. While the storage space is a bit bigger than using int, the workflow with such IDs is beneficial. You generate the ID yourself so you can define a set of related data and save it in a single transaction. The entities that define this set of data in the code are often called an \"aggregate\"." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Apply it with `make yii migrate:up`." msgstr "" #. type: Title ## #: ../../guide/en/start/databases.md #, no-wrap -msgid "Inserting" +msgid "An entity" msgstr "" -#. type: Title ## +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Now that you have a table it is time to define an entity in the code. Create `src/Web/Page/Page.php`:" +msgstr "" + +#. type: Fenced code block (php) #: ../../guide/en/start/databases.md #, no-wrap -msgid "Selecting" +msgid "" +"toSlug($this->title);\n" +" }\n" +"\n" +" public function isDeleted(): bool\n" +" {\n" +" return $this->deletedAt !== null;\n" +" }\n" +"}\n" msgstr "" #. type: Title ## #: ../../guide/en/start/databases.md #, no-wrap -msgid "Using data package" +msgid "Collection" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "You need to select both single pages and page collection. Let's make the collection typed. Create `src/Web/Page/PageCollection.php`:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"pages = $pages;\n" +" }\n" +"\n" +" public function add(Page $page): void\n" +" {\n" +" $this->pages[] = $page;\n" +" }\n" +"\n" +" /**\n" +" * @return Traversable\n" +" */\n" +" public function getIterator(): Traversable\n" +" {\n" +" return new ArrayIterator($this->pages);\n" +" }\n" +"}\n" +msgstr "" + +#. type: Bullet: '- ' +#: ../../guide/en/start/databases.md ../../guide/en/structure/domain.md +#: ../../guide/en/structure/service.md +#, no-wrap +msgid "Repository" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Now that we have entity and collection, we need a place for methods to save an entity, delete it and select either a single page or page collection." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Create `src/Web/Page/PageRepository.php`:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"connection->createCommand()->upsert('{{%page}}', [\n" +" 'id' => $page->id,\n" +" 'title' => $page->title,\n" +" 'slug' => $page->getSlug(),\n" +" 'text' => $page->text,\n" +" 'created_at' => $page->createdAt,\n" +" 'updated_at' => $page->updatedAt,\n" +" 'deleted_at' => $page->deletedAt,\n" +" ])->execute();\n" +" }\n" +"\n" +" public function findOneBySlug(string $slug): ?Page\n" +" {\n" +" $data = (new Query($this->connection))\n" +" ->select('*')\n" +" ->from('{{%page}}')\n" +" ->where('slug = :slug')\n" +" ->one();\n" +"\n" +" if ($data === null) {\n" +" return null;\n" +" }\n" +"\n" +" return $this->createPage($data);\n" +" }\n" +"\n" +" public function findAll(): PageCollection\n" +" {\n" +" $collection = new PageCollection();\n" +"\n" +" $data = (new Query($this->connection))\n" +" ->select('*')\n" +" ->from('{{%page}}')\n" +" ->all();\n" +"\n" +" foreach ($data as $page) {\n" +" $collection->add($this->createPage($page));\n" +" }\n" +"\n" +" return $collection;\n" +" }\n" +"\n" +" private function createPage(array $data): Page\n" +" {\n" +" return new Page(\n" +" id: $data['id'],\n" +" title: $data['title'],\n" +" text: $data['text'],\n" +" createdAt: new DateTimeImmutable($data['createdAt']),\n" +" updatedAt: new DateTimeImmutable($data['updatedAt']),\n" +" deletedAt: $data['deletedAt'] ? new DateTimeImmutable($data['deletedAt']) : null,\n" +" );\n" +" }\n" +"\n" +" public function delete(string $id): void\n" +" {\n" +" $this->connection->createCommand()->delete('{{%page}}', ['id' => $id])->execute();\n" +" }\n" +"}\n" msgstr "" -#. type: Title ### +#. type: Title ## #: ../../guide/en/start/databases.md #, no-wrap -msgid "Pagination" +msgid "Actions and routes" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "You need actions to:" +msgstr "" + +#. type: Bullet: '1. ' +#: ../../guide/en/start/databases.md +msgid "List all pages." +msgstr "" + +#. type: Bullet: '2. ' +#: ../../guide/en/start/databases.md +msgid "View a page." +msgstr "" + +#. type: Bullet: '3. ' +#: ../../guide/en/start/databases.md +msgid "Delete a page." +msgstr "" + +#. type: Bullet: '4. ' +#: ../../guide/en/start/databases.md +msgid "Create a page." +msgstr "" + +#. type: Bullet: '5. ' +#: ../../guide/en/start/databases.md +msgid "Edit a page." msgstr "" #. type: Plain text diff --git a/_translations/guide/po/id/structure_domain.md.po b/_translations/guide/po/id/structure_domain.md.po index f01ca09..1d8688f 100644 --- a/_translations/guide/po/id/structure_domain.md.po +++ b/_translations/guide/po/id/structure_domain.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-04 11:19+0500\n" +"POT-Creation-Date: 2025-11-02 16:25+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -16,20 +16,28 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #. type: Title ## -#: en/concept/autoloading.md en/security/best-practices.md -#: en/structure/domain.md en/tutorial/console-applications.md +#: ../../guide/en/concept/autoloading.md +#: ../../guide/en/security/best-practices.md ../../guide/en/structure/domain.md +#: ../../guide/en/tutorial/console-applications.md #, no-wrap msgid "References" msgstr "Referensi" +#. type: Bullet: '- ' +#: ../../guide/en/start/databases.md ../../guide/en/structure/domain.md +#: ../../guide/en/structure/service.md +#, no-wrap +msgid "Repository" +msgstr "" + #. type: Title # -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Domain" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "" "The Domain or domain model is what makes the project unique. With requirements and terminology of the problem being solved\n" @@ -39,7 +47,7 @@ msgid "" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "" "> [!NOTE]\n" @@ -50,136 +58,130 @@ msgid "" msgstr "" #. type: Title ## -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Bounded context" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "It's nearly impossible to build a model that solves multiple problems that aren't too complicated by itself. Therefore, it's a good practice to divide the domain into several use-cases and have a separate model for each use-case. Such separated models are called \"bounded contexts.\"" msgstr "" #. type: Title ## -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Building blocks" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "There are various building blocks that are typically used when describing domain models. It isn't mandatory to use them all." msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md en/structure/service.md +#: ../../guide/en/structure/domain.md ../../guide/en/structure/service.md #, no-wrap msgid "Entity" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Entity is a uniquely identifiable object such as user, product, payment, etc. When comparing them, you're checking ID, not the attribute values. If there are two objects with different attributes but the same ID, they're considered being the same thing." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Value object" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Value object describes an object by its characteristics. For example, a price that consists of value and currency. When comparing such objects, you're checking actual values. If they match, an object is considered to be the same." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Aggregate" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Aggregate is a set of domain objects such as entities and value objects and additional data that could be treated as a single unit. It usually represents a compound object from a domain model such as shop order or HR person dossier." msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "One of the components of an aggregate is called a root. The root identifies an aggregate as a whole and should be used to access it." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Domain event" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "An aggregate, while processed, may raise events. For example, when order is confirmed, `OrderConfirmed` event would be risen so other parts of the system may react on these." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Data transfer object" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Data transfer object or DTO is an object whose only purpose is to hold data as it is. It's commonly used to pass data between different services." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Service" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Service is a class that contains a standalone operation within the context of your domain model. See \"[service components](service.md)\"." msgstr "" -#. type: Bullet: '- ' -#: en/structure/domain.md en/structure/service.md -#, no-wrap -msgid "Repository" -msgstr "" - #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "The repository task is to abstract away how domain objects are obtained. These are usually separated into two parts: an interface that stays in the domain layer and an implementation that's situated in the infrastructure layer. In such a way, domain doesn't care how data is obtained and saved and may be focused around the complicated business logic instead." msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Repository is usually implemented as a service." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Instantiating building blocks" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Entity, value object, aggregate, and domain events aren't services and shouldn't be instantiated through DI container. Using `new` is the way to go with these." msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "[BoundedContext by Martin Fowler](https://martinfowler.com/bliki/BoundedContext.html)" msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "[ValueObject by Martin Fowler](https://martinfowler.com/bliki/ValueObject.html)" msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "[Aggregate by Marting Fowler](https://martinfowler.com/bliki/DDD_Aggregate.html)" msgstr "" diff --git a/_translations/guide/po/id/structure_service.md.po b/_translations/guide/po/id/structure_service.md.po index 15cf862..97ddefc 100644 --- a/_translations/guide/po/id/structure_service.md.po +++ b/_translations/guide/po/id/structure_service.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-04 11:19+0500\n" +"POT-Creation-Date: 2025-11-02 16:25+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -16,30 +16,31 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #. type: Bullet: '- ' -#: en/structure/domain.md en/structure/service.md +#: ../../guide/en/start/databases.md ../../guide/en/structure/domain.md +#: ../../guide/en/structure/service.md #, no-wrap -msgid "Entity" +msgid "Repository" msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md en/structure/service.md +#: ../../guide/en/structure/domain.md ../../guide/en/structure/service.md #, no-wrap -msgid "Repository" +msgid "Entity" msgstr "" #. type: Title # -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "Service components" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Application may get complicated, so it makes sense to extract focused parts of business logic or infrastructure into service components. They're typically injected into other components or action handlers. It's usually done via autowiring:" msgstr "" #. type: Fenced code block (php) -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "" "public function actionIndex(CurrentRoute $route, MyService $myService): ResponseInterface\n" @@ -54,12 +55,12 @@ msgid "" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Yii3 doesn't technically imply any limitations on how you build services. In general, there's no need to extend from a base class or implement a certain interface:" msgstr "" #. type: Fenced code block (php) -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "" "final readonly class MyService\n" @@ -78,43 +79,43 @@ msgid "" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Services either perform a task or return data. They're created once, put into a DI container and then could be used multiple times. Because of that, it's a good idea to keep your services stateless that's both service itself and any of its dependencies shouldn't hold state. You can ensure it by using `readonly` PHP keyword at class level." msgstr "" #. type: Title ## -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "Service dependencies and configuration" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Services should always define all their dependencies on other services via `__construct()`. It both allows you to use a service right away after it's created and serves as an indicator of a service doing too much if there are too many dependencies." msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "After the service is created, it shouldn't be re-configured in runtime." msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "DI container instance usually **shouldn't** be injected as a dependency. Prefer concrete interfaces." msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "In case of complicated or \"heavy\" initialization, try to postpone it until the service method is called." msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "The same is valid for configuration values. They should be provided as a constructor argument. Related values could be grouped together into value objects. For example, database connection usually requires DSN string, username and password. These three could be combined into Dsn class:" msgstr "" #. type: Fenced code block (php) -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "" "final readonly class Dsn\n" @@ -138,18 +139,18 @@ msgid "" msgstr "" #. type: Title ## -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "Service methods" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Service method usually does something. It could be a simple thing repeated exactly, but usually it depends on the context. For example:" msgstr "" #. type: Fenced code block (php) -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "" "final readonly class PostPersister\n" @@ -168,27 +169,27 @@ msgid "" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "There's a service that is saving posts into permanent storage such as a database. An object allowing communication with a concrete storage is always the same, so it's injected using constructor while the post saved could vary, so it's passed as a method argument." msgstr "" #. type: Title ## -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "Is everything a service?" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Often it makes sense to choose another class type to place your code into. Check:" msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Widget" msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "[Middleware](middleware.md)" msgstr "" diff --git a/_translations/guide/po/ru/start_databases.md.po b/_translations/guide/po/ru/start_databases.md.po index 79d8c5e..2e8b695 100644 --- a/_translations/guide/po/ru/start_databases.md.po +++ b/_translations/guide/po/ru/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-10-22 20:13+0000\n" +"POT-Creation-Date: 2025-11-02 16:25+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -176,7 +176,7 @@ msgstr "" #: ../../guide/en/start/databases.md #, fuzzy, no-wrap #| msgid "composer install yiisoft/security\n" -msgid "composer require yiisoft/db-pgsql\n" +msgid "make composer require yiisoft/db-pgsql\n" msgstr "composer install yiisoft/security\n" #. type: Plain text @@ -259,61 +259,296 @@ msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "And a directory to store migrations such as `migrations` right in the project root." +msgid "Create a directory to store migrations `src/Migration` right in the project root. Add the following configuration to `config/common/params.php`:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"'yiisoft/db-migration' => [\n" +" 'newMigrationNamespace' => 'App\\\\Migration',\n" +" 'sourceNamespaces' => ['App\\\\Migration'],\n" +"],\n" msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "Now you can use `yii migrate:create page` to create a new migration. For our example we need a `page` table with some columns:" +msgid "Now you can use `make yii migrate:create page` to create a new migration. For our example we need a `page` table with some columns:" msgstr "" #. type: Fenced code block (php) #: ../../guide/en/start/databases.md #, no-wrap msgid "" +"columnBuilder();\n" -"\n" -" $b->createTable('page', [\n" -" 'id' => $cb->primaryKey(),\n" -" 'title' => $cb->string()->notNull(),\n" -" 'text' => $cb->text()->notNull(),\n" -" 'created_at' => $cb->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'),\n" -" 'updated_at' => $cb->dateTime(),\n" -" 'deleted_at' => $cb->dateTime(),\n" -" ]);\n" +" public function up(MigrationBuilder $b): void\n" +" {\n" +" $b->createTable('page', [\n" +" 'id' => $b->uuidPrimaryKey(),\n" +" 'title' => $b->string()->notNull(),\n" +" 'slug' => $b->string()->notNull(),\n" +" 'text' => $b->text()->notNull(),\n" +" 'created_at' => $b->dateTime()->notNull(),\n" +" 'updated_at' => $b->dateTime(),\n" +" 'deleted_at' => $b->dateTime(),\n" +" ]);\n" +" }\n" +"\n" +" public function down(MigrationBuilder $b): void\n" +" {\n" +" $b->dropTable('page');\n" +" }\n" "}\n" msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "Apply it with `yii migrate:up`." +msgid "Note that we use UUID as the primary key. While the storage space is a bit bigger than using int, the workflow with such IDs is beneficial. You generate the ID yourself so you can define a set of related data and save it in a single transaction. The entities that define this set of data in the code are often called an \"aggregate\"." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Apply it with `make yii migrate:up`." msgstr "" #. type: Title ## #: ../../guide/en/start/databases.md #, no-wrap -msgid "Inserting" +msgid "An entity" msgstr "" -#. type: Title ## +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Now that you have a table it is time to define an entity in the code. Create `src/Web/Page/Page.php`:" +msgstr "" + +#. type: Fenced code block (php) #: ../../guide/en/start/databases.md #, no-wrap -msgid "Selecting" +msgid "" +"toSlug($this->title);\n" +" }\n" +"\n" +" public function isDeleted(): bool\n" +" {\n" +" return $this->deletedAt !== null;\n" +" }\n" +"}\n" msgstr "" #. type: Title ## #: ../../guide/en/start/databases.md #, no-wrap -msgid "Using data package" +msgid "Collection" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "You need to select both single pages and page collection. Let's make the collection typed. Create `src/Web/Page/PageCollection.php`:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"pages = $pages;\n" +" }\n" +"\n" +" public function add(Page $page): void\n" +" {\n" +" $this->pages[] = $page;\n" +" }\n" +"\n" +" /**\n" +" * @return Traversable\n" +" */\n" +" public function getIterator(): Traversable\n" +" {\n" +" return new ArrayIterator($this->pages);\n" +" }\n" +"}\n" +msgstr "" + +#. type: Bullet: '- ' +#: ../../guide/en/start/databases.md ../../guide/en/structure/domain.md +#: ../../guide/en/structure/service.md +#, no-wrap +msgid "Repository" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Now that we have entity and collection, we need a place for methods to save an entity, delete it and select either a single page or page collection." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Create `src/Web/Page/PageRepository.php`:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"connection->createCommand()->upsert('{{%page}}', [\n" +" 'id' => $page->id,\n" +" 'title' => $page->title,\n" +" 'slug' => $page->getSlug(),\n" +" 'text' => $page->text,\n" +" 'created_at' => $page->createdAt,\n" +" 'updated_at' => $page->updatedAt,\n" +" 'deleted_at' => $page->deletedAt,\n" +" ])->execute();\n" +" }\n" +"\n" +" public function findOneBySlug(string $slug): ?Page\n" +" {\n" +" $data = (new Query($this->connection))\n" +" ->select('*')\n" +" ->from('{{%page}}')\n" +" ->where('slug = :slug')\n" +" ->one();\n" +"\n" +" if ($data === null) {\n" +" return null;\n" +" }\n" +"\n" +" return $this->createPage($data);\n" +" }\n" +"\n" +" public function findAll(): PageCollection\n" +" {\n" +" $collection = new PageCollection();\n" +"\n" +" $data = (new Query($this->connection))\n" +" ->select('*')\n" +" ->from('{{%page}}')\n" +" ->all();\n" +"\n" +" foreach ($data as $page) {\n" +" $collection->add($this->createPage($page));\n" +" }\n" +"\n" +" return $collection;\n" +" }\n" +"\n" +" private function createPage(array $data): Page\n" +" {\n" +" return new Page(\n" +" id: $data['id'],\n" +" title: $data['title'],\n" +" text: $data['text'],\n" +" createdAt: new DateTimeImmutable($data['createdAt']),\n" +" updatedAt: new DateTimeImmutable($data['updatedAt']),\n" +" deletedAt: $data['deletedAt'] ? new DateTimeImmutable($data['deletedAt']) : null,\n" +" );\n" +" }\n" +"\n" +" public function delete(string $id): void\n" +" {\n" +" $this->connection->createCommand()->delete('{{%page}}', ['id' => $id])->execute();\n" +" }\n" +"}\n" msgstr "" -#. type: Title ### +#. type: Title ## #: ../../guide/en/start/databases.md #, no-wrap -msgid "Pagination" +msgid "Actions and routes" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "You need actions to:" +msgstr "" + +#. type: Bullet: '1. ' +#: ../../guide/en/start/databases.md +msgid "List all pages." +msgstr "" + +#. type: Bullet: '2. ' +#: ../../guide/en/start/databases.md +msgid "View a page." +msgstr "" + +#. type: Bullet: '3. ' +#: ../../guide/en/start/databases.md +msgid "Delete a page." +msgstr "" + +#. type: Bullet: '4. ' +#: ../../guide/en/start/databases.md +msgid "Create a page." +msgstr "" + +#. type: Bullet: '5. ' +#: ../../guide/en/start/databases.md +msgid "Edit a page." msgstr "" #. type: Plain text diff --git a/_translations/guide/po/ru/structure_domain.md.po b/_translations/guide/po/ru/structure_domain.md.po index 9e5bc4f..575944f 100644 --- a/_translations/guide/po/ru/structure_domain.md.po +++ b/_translations/guide/po/ru/structure_domain.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-04 11:19+0500\n" +"POT-Creation-Date: 2025-11-02 16:25+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -17,20 +17,28 @@ msgstr "" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #. type: Title ## -#: en/concept/autoloading.md en/security/best-practices.md -#: en/structure/domain.md en/tutorial/console-applications.md +#: ../../guide/en/concept/autoloading.md +#: ../../guide/en/security/best-practices.md ../../guide/en/structure/domain.md +#: ../../guide/en/tutorial/console-applications.md #, no-wrap msgid "References" msgstr "Ссылки" +#. type: Bullet: '- ' +#: ../../guide/en/start/databases.md ../../guide/en/structure/domain.md +#: ../../guide/en/structure/service.md +#, no-wrap +msgid "Repository" +msgstr "" + #. type: Title # -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Domain" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "" "The Domain or domain model is what makes the project unique. With requirements and terminology of the problem being solved\n" @@ -40,7 +48,7 @@ msgid "" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "" "> [!NOTE]\n" @@ -51,136 +59,130 @@ msgid "" msgstr "" #. type: Title ## -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Bounded context" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "It's nearly impossible to build a model that solves multiple problems that aren't too complicated by itself. Therefore, it's a good practice to divide the domain into several use-cases and have a separate model for each use-case. Such separated models are called \"bounded contexts.\"" msgstr "" #. type: Title ## -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Building blocks" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "There are various building blocks that are typically used when describing domain models. It isn't mandatory to use them all." msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md en/structure/service.md +#: ../../guide/en/structure/domain.md ../../guide/en/structure/service.md #, no-wrap msgid "Entity" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Entity is a uniquely identifiable object such as user, product, payment, etc. When comparing them, you're checking ID, not the attribute values. If there are two objects with different attributes but the same ID, they're considered being the same thing." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Value object" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Value object describes an object by its characteristics. For example, a price that consists of value and currency. When comparing such objects, you're checking actual values. If they match, an object is considered to be the same." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Aggregate" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Aggregate is a set of domain objects such as entities and value objects and additional data that could be treated as a single unit. It usually represents a compound object from a domain model such as shop order or HR person dossier." msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "One of the components of an aggregate is called a root. The root identifies an aggregate as a whole and should be used to access it." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Domain event" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "An aggregate, while processed, may raise events. For example, when order is confirmed, `OrderConfirmed` event would be risen so other parts of the system may react on these." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Data transfer object" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Data transfer object or DTO is an object whose only purpose is to hold data as it is. It's commonly used to pass data between different services." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Service" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Service is a class that contains a standalone operation within the context of your domain model. See \"[service components](service.md)\"." msgstr "" -#. type: Bullet: '- ' -#: en/structure/domain.md en/structure/service.md -#, no-wrap -msgid "Repository" -msgstr "" - #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "The repository task is to abstract away how domain objects are obtained. These are usually separated into two parts: an interface that stays in the domain layer and an implementation that's situated in the infrastructure layer. In such a way, domain doesn't care how data is obtained and saved and may be focused around the complicated business logic instead." msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Repository is usually implemented as a service." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Instantiating building blocks" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Entity, value object, aggregate, and domain events aren't services and shouldn't be instantiated through DI container. Using `new` is the way to go with these." msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "[BoundedContext by Martin Fowler](https://martinfowler.com/bliki/BoundedContext.html)" msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "[ValueObject by Martin Fowler](https://martinfowler.com/bliki/ValueObject.html)" msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "[Aggregate by Marting Fowler](https://martinfowler.com/bliki/DDD_Aggregate.html)" msgstr "" diff --git a/_translations/guide/po/ru/structure_service.md.po b/_translations/guide/po/ru/structure_service.md.po index 36bd193..303c03f 100644 --- a/_translations/guide/po/ru/structure_service.md.po +++ b/_translations/guide/po/ru/structure_service.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-04 11:19+0500\n" +"POT-Creation-Date: 2025-11-02 16:25+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -17,30 +17,31 @@ msgstr "" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #. type: Bullet: '- ' -#: en/structure/domain.md en/structure/service.md +#: ../../guide/en/start/databases.md ../../guide/en/structure/domain.md +#: ../../guide/en/structure/service.md #, no-wrap -msgid "Entity" +msgid "Repository" msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md en/structure/service.md +#: ../../guide/en/structure/domain.md ../../guide/en/structure/service.md #, no-wrap -msgid "Repository" +msgid "Entity" msgstr "" #. type: Title # -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "Service components" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Application may get complicated, so it makes sense to extract focused parts of business logic or infrastructure into service components. They're typically injected into other components or action handlers. It's usually done via autowiring:" msgstr "" #. type: Fenced code block (php) -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "" "public function actionIndex(CurrentRoute $route, MyService $myService): ResponseInterface\n" @@ -55,12 +56,12 @@ msgid "" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Yii3 doesn't technically imply any limitations on how you build services. In general, there's no need to extend from a base class or implement a certain interface:" msgstr "" #. type: Fenced code block (php) -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "" "final readonly class MyService\n" @@ -79,44 +80,44 @@ msgid "" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Services either perform a task or return data. They're created once, put into a DI container and then could be used multiple times. Because of that, it's a good idea to keep your services stateless that's both service itself and any of its dependencies shouldn't hold state. You can ensure it by using `readonly` PHP keyword at class level." msgstr "" #. type: Title ## -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, fuzzy, no-wrap #| msgid "Secure server configuration" msgid "Service dependencies and configuration" msgstr "Безопасная конфигурация сервера" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Services should always define all their dependencies on other services via `__construct()`. It both allows you to use a service right away after it's created and serves as an indicator of a service doing too much if there are too many dependencies." msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "After the service is created, it shouldn't be re-configured in runtime." msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "DI container instance usually **shouldn't** be injected as a dependency. Prefer concrete interfaces." msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "In case of complicated or \"heavy\" initialization, try to postpone it until the service method is called." msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "The same is valid for configuration values. They should be provided as a constructor argument. Related values could be grouped together into value objects. For example, database connection usually requires DSN string, username and password. These three could be combined into Dsn class:" msgstr "" #. type: Fenced code block (php) -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "" "final readonly class Dsn\n" @@ -140,18 +141,18 @@ msgid "" msgstr "" #. type: Title ## -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "Service methods" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Service method usually does something. It could be a simple thing repeated exactly, but usually it depends on the context. For example:" msgstr "" #. type: Fenced code block (php) -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, fuzzy, no-wrap #| msgid "" #| "final class MyService implements MyServiceInterface\n" @@ -192,27 +193,27 @@ msgstr "" " }\n" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "There's a service that is saving posts into permanent storage such as a database. An object allowing communication with a concrete storage is always the same, so it's injected using constructor while the post saved could vary, so it's passed as a method argument." msgstr "" #. type: Title ## -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "Is everything a service?" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Often it makes sense to choose another class type to place your code into. Check:" msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Widget" msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "[Middleware](middleware.md)" msgstr "" diff --git a/_translations/guide/pot/start_databases.md.pot b/_translations/guide/pot/start_databases.md.pot index 04d0923..ea559ed 100644 --- a/_translations/guide/pot/start_databases.md.pot +++ b/_translations/guide/pot/start_databases.md.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-10-22 20:13+0000\n" +"POT-Creation-Date: 2025-11-02 16:25+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -193,7 +193,7 @@ msgstr "" #. type: Fenced code block (sh) #: ../../guide/en/start/databases.md #, no-wrap -msgid "composer require yiisoft/db-pgsql\n" +msgid "make composer require yiisoft/db-pgsql\n" msgstr "" #. type: Plain text @@ -285,64 +285,310 @@ msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md msgid "" -"And a directory to store migrations such as `migrations` right in the " -"project root." +"Create a directory to store migrations `src/Migration` right in the project " +"root. Add the following configuration to `config/common/params.php`:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"'yiisoft/db-migration' => [\n" +" 'newMigrationNamespace' => 'App\\\\Migration',\n" +" 'sourceNamespaces' => ['App\\\\Migration'],\n" +"],\n" msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md msgid "" -"Now you can use `yii migrate:create page` to create a new migration. For our " -"example we need a `page` table with some columns:" +"Now you can use `make yii migrate:create page` to create a new migration. " +"For our example we need a `page` table with some columns:" msgstr "" #. type: Fenced code block (php) #: ../../guide/en/start/databases.md #, no-wrap msgid "" +"columnBuilder();\n" -"\n" -" $b->createTable('page', [\n" -" 'id' => $cb->primaryKey(),\n" -" 'title' => $cb->string()->notNull(),\n" -" 'text' => $cb->text()->notNull(),\n" -" 'created_at' => $cb->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'),\n" -" 'updated_at' => $cb->dateTime(),\n" -" 'deleted_at' => $cb->dateTime(),\n" -" ]);\n" +" public function up(MigrationBuilder $b): void\n" +" {\n" +" $b->createTable('page', [\n" +" 'id' => $b->uuidPrimaryKey(),\n" +" 'title' => $b->string()->notNull(),\n" +" 'slug' => $b->string()->notNull(),\n" +" 'text' => $b->text()->notNull(),\n" +" 'created_at' => $b->dateTime()->notNull(),\n" +" 'updated_at' => $b->dateTime(),\n" +" 'deleted_at' => $b->dateTime(),\n" +" ]);\n" +" }\n" +"\n" +" public function down(MigrationBuilder $b): void\n" +" {\n" +" $b->dropTable('page');\n" +" }\n" "}\n" msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "Apply it with `yii migrate:up`." +msgid "" +"Note that we use UUID as the primary key. While the storage space is a bit " +"bigger than using int, the workflow with such IDs is beneficial. You " +"generate the ID yourself so you can define a set of related data and save it " +"in a single transaction. The entities that define this set of data in the " +"code are often called an \"aggregate\"." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Apply it with `make yii migrate:up`." msgstr "" #. type: Title ## #: ../../guide/en/start/databases.md #, no-wrap -msgid "Inserting" +msgid "An entity" msgstr "" -#. type: Title ## +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "" +"Now that you have a table it is time to define an entity in the code. Create " +"`src/Web/Page/Page.php`:" +msgstr "" + +#. type: Fenced code block (php) #: ../../guide/en/start/databases.md #, no-wrap -msgid "Selecting" +msgid "" +"toSlug($this->title);\n" +" }\n" +"\n" +" public function isDeleted(): bool\n" +" {\n" +" return $this->deletedAt !== null;\n" +" }\n" +"}\n" msgstr "" #. type: Title ## #: ../../guide/en/start/databases.md #, no-wrap -msgid "Using data package" +msgid "Collection" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "" +"You need to select both single pages and page collection. Let's make the " +"collection typed. Create `src/Web/Page/PageCollection.php`:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"pages = $pages;\n" +" }\n" +"\n" +" public function add(Page $page): void\n" +" {\n" +" $this->pages[] = $page;\n" +" }\n" +"\n" +" /**\n" +" * @return Traversable\n" +" */\n" +" public function getIterator(): Traversable\n" +" {\n" +" return new ArrayIterator($this->pages);\n" +" }\n" +"}\n" +msgstr "" + +#. type: Bullet: '- ' +#: ../../guide/en/start/databases.md ../../guide/en/structure/domain.md +#: ../../guide/en/structure/service.md +#, no-wrap +msgid "Repository" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "" +"Now that we have entity and collection, we need a place for methods to save " +"an entity, delete it and select either a single page or page collection." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Create `src/Web/Page/PageRepository.php`:" +msgstr "" + +#. type: Fenced code block (php) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "" +"connection->createCommand()->upsert('{{%page}}', [\n" +" 'id' => $page->id,\n" +" 'title' => $page->title,\n" +" 'slug' => $page->getSlug(),\n" +" 'text' => $page->text,\n" +" 'created_at' => $page->createdAt,\n" +" 'updated_at' => $page->updatedAt,\n" +" 'deleted_at' => $page->deletedAt,\n" +" ])->execute();\n" +" }\n" +"\n" +" public function findOneBySlug(string $slug): ?Page\n" +" {\n" +" $data = (new Query($this->connection))\n" +" ->select('*')\n" +" ->from('{{%page}}')\n" +" ->where('slug = :slug')\n" +" ->one();\n" +"\n" +" if ($data === null) {\n" +" return null;\n" +" }\n" +"\n" +" return $this->createPage($data);\n" +" }\n" +"\n" +" public function findAll(): PageCollection\n" +" {\n" +" $collection = new PageCollection();\n" +"\n" +" $data = (new Query($this->connection))\n" +" ->select('*')\n" +" ->from('{{%page}}')\n" +" ->all();\n" +"\n" +" foreach ($data as $page) {\n" +" $collection->add($this->createPage($page));\n" +" }\n" +"\n" +" return $collection;\n" +" }\n" +"\n" +" private function createPage(array $data): Page\n" +" {\n" +" return new Page(\n" +" id: $data['id'],\n" +" title: $data['title'],\n" +" text: $data['text'],\n" +" createdAt: new DateTimeImmutable($data['createdAt']),\n" +" updatedAt: new DateTimeImmutable($data['updatedAt']),\n" +" deletedAt: $data['deletedAt'] ? new DateTimeImmutable($data['deletedAt']) : null,\n" +" );\n" +" }\n" +"\n" +" public function delete(string $id): void\n" +" {\n" +" $this->connection->createCommand()->delete('{{%page}}', ['id' => $id])->execute();\n" +" }\n" +"}\n" msgstr "" -#. type: Title ### +#. type: Title ## #: ../../guide/en/start/databases.md #, no-wrap -msgid "Pagination" +msgid "Actions and routes" +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "You need actions to:" +msgstr "" + +#. type: Bullet: '1. ' +#: ../../guide/en/start/databases.md +msgid "List all pages." +msgstr "" + +#. type: Bullet: '2. ' +#: ../../guide/en/start/databases.md +msgid "View a page." +msgstr "" + +#. type: Bullet: '3. ' +#: ../../guide/en/start/databases.md +msgid "Delete a page." +msgstr "" + +#. type: Bullet: '4. ' +#: ../../guide/en/start/databases.md +msgid "Create a page." +msgstr "" + +#. type: Bullet: '5. ' +#: ../../guide/en/start/databases.md +msgid "Edit a page." msgstr "" #. type: Plain text diff --git a/_translations/guide/pot/structure_domain.md.pot b/_translations/guide/pot/structure_domain.md.pot index 2226719..ea978a3 100644 --- a/_translations/guide/pot/structure_domain.md.pot +++ b/_translations/guide/pot/structure_domain.md.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-04 11:19+0500\n" +"POT-Creation-Date: 2025-11-02 16:25+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,20 +17,28 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #. type: Title ## -#: en/concept/autoloading.md en/security/best-practices.md -#: en/structure/domain.md en/tutorial/console-applications.md +#: ../../guide/en/concept/autoloading.md +#: ../../guide/en/security/best-practices.md ../../guide/en/structure/domain.md +#: ../../guide/en/tutorial/console-applications.md #, no-wrap msgid "References" msgstr "" +#. type: Bullet: '- ' +#: ../../guide/en/start/databases.md ../../guide/en/structure/domain.md +#: ../../guide/en/structure/service.md +#, no-wrap +msgid "Repository" +msgstr "" + #. type: Title # -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Domain" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "" "The Domain or domain model is what makes the project unique. With requirements and terminology of the problem being solved\n" @@ -40,7 +48,7 @@ msgid "" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "" "> [!NOTE]\n" @@ -51,13 +59,13 @@ msgid "" msgstr "" #. type: Title ## -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Bounded context" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "" "It's nearly impossible to build a model that solves multiple problems that " "aren't too complicated by itself. Therefore, it's a good practice to divide " @@ -66,26 +74,26 @@ msgid "" msgstr "" #. type: Title ## -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Building blocks" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "" "There are various building blocks that are typically used when describing " "domain models. It isn't mandatory to use them all." msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md en/structure/service.md +#: ../../guide/en/structure/domain.md ../../guide/en/structure/service.md #, no-wrap msgid "Entity" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "" "Entity is a uniquely identifiable object such as user, product, payment, " "etc. When comparing them, you're checking ID, not the attribute values. If " @@ -94,13 +102,13 @@ msgid "" msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Value object" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "" "Value object describes an object by its characteristics. For example, a " "price that consists of value and currency. When comparing such objects, " @@ -109,13 +117,13 @@ msgid "" msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Aggregate" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "" "Aggregate is a set of domain objects such as entities and value objects and " "additional data that could be treated as a single unit. It usually " @@ -124,20 +132,20 @@ msgid "" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "" "One of the components of an aggregate is called a root. The root identifies " "an aggregate as a whole and should be used to access it." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Domain event" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "" "An aggregate, while processed, may raise events. For example, when order is " "confirmed, `OrderConfirmed` event would be risen so other parts of the " @@ -145,39 +153,33 @@ msgid "" msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Data transfer object" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "" "Data transfer object or DTO is an object whose only purpose is to hold data " "as it is. It's commonly used to pass data between different services." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Service" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "" "Service is a class that contains a standalone operation within the context " "of your domain model. See \"[service components](service.md)\"." msgstr "" -#. type: Bullet: '- ' -#: en/structure/domain.md en/structure/service.md -#, no-wrap -msgid "Repository" -msgstr "" - #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "" "The repository task is to abstract away how domain objects are obtained. " "These are usually separated into two parts: an interface that stays in the " @@ -187,18 +189,18 @@ msgid "" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "Repository is usually implemented as a service." msgstr "" #. type: Title ### -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md #, no-wrap msgid "Instantiating building blocks" msgstr "" #. type: Plain text -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "" "Entity, value object, aggregate, and domain events aren't services and " "shouldn't be instantiated through DI container. Using `new` is the way to " @@ -206,21 +208,21 @@ msgid "" msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "" "[BoundedContext by Martin Fowler](https://martinfowler.com/bliki/" "BoundedContext.html)" msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "" "[ValueObject by Martin Fowler](https://martinfowler.com/bliki/ValueObject." "html)" msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md +#: ../../guide/en/structure/domain.md msgid "" "[Aggregate by Marting Fowler](https://martinfowler.com/bliki/DDD_Aggregate." "html)" diff --git a/_translations/guide/pot/structure_service.md.pot b/_translations/guide/pot/structure_service.md.pot index fe8bd0a..131a49f 100644 --- a/_translations/guide/pot/structure_service.md.pot +++ b/_translations/guide/pot/structure_service.md.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-09-04 11:19+0500\n" +"POT-Creation-Date: 2025-11-02 16:25+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,25 +17,26 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #. type: Bullet: '- ' -#: en/structure/domain.md en/structure/service.md +#: ../../guide/en/start/databases.md ../../guide/en/structure/domain.md +#: ../../guide/en/structure/service.md #, no-wrap -msgid "Entity" +msgid "Repository" msgstr "" #. type: Bullet: '- ' -#: en/structure/domain.md en/structure/service.md +#: ../../guide/en/structure/domain.md ../../guide/en/structure/service.md #, no-wrap -msgid "Repository" +msgid "Entity" msgstr "" #. type: Title # -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "Service components" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "" "Application may get complicated, so it makes sense to extract focused parts " "of business logic or infrastructure into service components. They're " @@ -44,7 +45,7 @@ msgid "" msgstr "" #. type: Fenced code block (php) -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "" "public function actionIndex(CurrentRoute $route, MyService $myService): ResponseInterface\n" @@ -59,7 +60,7 @@ msgid "" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "" "Yii3 doesn't technically imply any limitations on how you build services. In " "general, there's no need to extend from a base class or implement a certain " @@ -67,7 +68,7 @@ msgid "" msgstr "" #. type: Fenced code block (php) -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "" "final readonly class MyService\n" @@ -86,7 +87,7 @@ msgid "" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "" "Services either perform a task or return data. They're created once, put " "into a DI container and then could be used multiple times. Because of that, " @@ -96,13 +97,13 @@ msgid "" msgstr "" #. type: Title ## -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "Service dependencies and configuration" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "" "Services should always define all their dependencies on other services via " "`__construct()`. It both allows you to use a service right away after it's " @@ -111,26 +112,26 @@ msgid "" msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "After the service is created, it shouldn't be re-configured in runtime." msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "" "DI container instance usually **shouldn't** be injected as a dependency. " "Prefer concrete interfaces." msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "" "In case of complicated or \"heavy\" initialization, try to postpone it until " "the service method is called." msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "" "The same is valid for configuration values. They should be provided as a " "constructor argument. Related values could be grouped together into value " @@ -139,7 +140,7 @@ msgid "" msgstr "" #. type: Fenced code block (php) -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "" "final readonly class Dsn\n" @@ -163,20 +164,20 @@ msgid "" msgstr "" #. type: Title ## -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "Service methods" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "" "Service method usually does something. It could be a simple thing repeated " "exactly, but usually it depends on the context. For example:" msgstr "" #. type: Fenced code block (php) -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "" "final readonly class PostPersister\n" @@ -195,7 +196,7 @@ msgid "" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "" "There's a service that is saving posts into permanent storage such as a " "database. An object allowing communication with a concrete storage is always " @@ -204,24 +205,24 @@ msgid "" msgstr "" #. type: Title ## -#: en/structure/service.md +#: ../../guide/en/structure/service.md #, no-wrap msgid "Is everything a service?" msgstr "" #. type: Plain text -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "" "Often it makes sense to choose another class type to place your code into. " "Check:" msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "Widget" msgstr "" #. type: Bullet: '- ' -#: en/structure/service.md +#: ../../guide/en/structure/service.md msgid "[Middleware](middleware.md)" msgstr "" diff --git a/guide/es/start/databases.md b/guide/es/start/databases.md index 8ac018f..e236d4c 100644 --- a/guide/es/start/databases.md +++ b/guide/es/start/databases.md @@ -89,7 +89,7 @@ Now that we have the database, it's time to define the connection. We need a package to be installed first: ```sh -composer require yiisoft/db-pgsql +make composer require yiisoft/db-pgsql ``` Now create `config/common/di/db-pgsql.php`: @@ -152,38 +152,232 @@ To use migrations we need another package installed: composer require yiisoft/db-migration ``` -And a directory to store migrations such as `migrations` right in the -project root. +Create a directory to store migrations `src/Migration` right in the project +root. Add the following configuration to `config/common/params.php`: -Now you can use `yii migrate:create page` to create a new migration. For our -example we need a `page` table with some columns: +```php +'yiisoft/db-migration' => [ + 'newMigrationNamespace' => 'App\\Migration', + 'sourceNamespaces' => ['App\\Migration'], +], +``` + +Now you can use `make yii migrate:create page` to create a new +migration. For our example we need a `page` table with some columns: + +```php +createTable('page', [ + 'id' => $b->uuidPrimaryKey(), + 'title' => $b->string()->notNull(), + 'slug' => $b->string()->notNull(), + 'text' => $b->text()->notNull(), + 'created_at' => $b->dateTime()->notNull(), + 'updated_at' => $b->dateTime(), + 'deleted_at' => $b->dateTime(), + ]); + } + + public function down(MigrationBuilder $b): void + { + $b->dropTable('page'); + } +} +``` + +Note that we use UUID as the primary key. While the storage space is a bit +bigger than using int, the workflow with such IDs is beneficial. You +generate the ID yourself so you can define a set of related data and save it +in a single transaction. The entities that define this set of data in the +code are often called an "aggregate". + +Apply it with `make yii migrate:up`. + +## An entity + +Now that you have a table it is time to define an entity in the code. Create +`src/Web/Page/Page.php`: + +```php +toSlug($this->title); + } + + public function isDeleted(): bool + { + return $this->deletedAt !== null; + } +} +``` + +## Collection + +You need to select both single pages and page collection. Let's make the +collection typed. Create `src/Web/Page/PageCollection.php`: + +```php +pages = $pages; + } + + public function add(Page $page): void + { + $this->pages[] = $page; + } + + /** + * @return Traversable + */ + public function getIterator(): Traversable + { + return new ArrayIterator($this->pages); + } +} +``` + +## Repository + +Now that we have entity and collection, we need a place for methods to save +an entity, delete it and select either a single page or page collection. + +Create `src/Web/Page/PageRepository.php`: ```php +columnBuilder(); - - $b->createTable('page', [ - 'id' => $cb->primaryKey(), - 'title' => $cb->string()->notNull(), - 'text' => $cb->text()->notNull(), - 'created_at' => $cb->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'), - 'updated_at' => $cb->dateTime(), - 'deleted_at' => $cb->dateTime(), - ]); + public function __construct( + private ConnectionInterface $connection, + ) {} + + public function save(Page $page): void + { + $this->connection->createCommand()->upsert('{{%page}}', [ + 'id' => $page->id, + 'title' => $page->title, + 'slug' => $page->getSlug(), + 'text' => $page->text, + 'created_at' => $page->createdAt, + 'updated_at' => $page->updatedAt, + 'deleted_at' => $page->deletedAt, + ])->execute(); + } + + public function findOneBySlug(string $slug): ?Page + { + $data = (new Query($this->connection)) + ->select('*') + ->from('{{%page}}') + ->where('slug = :slug') + ->one(); + + if ($data === null) { + return null; + } + + return $this->createPage($data); + } + + public function findAll(): PageCollection + { + $collection = new PageCollection(); + + $data = (new Query($this->connection)) + ->select('*') + ->from('{{%page}}') + ->all(); + + foreach ($data as $page) { + $collection->add($this->createPage($page)); + } + + return $collection; + } + + private function createPage(array $data): Page + { + return new Page( + id: $data['id'], + title: $data['title'], + text: $data['text'], + createdAt: new DateTimeImmutable($data['createdAt']), + updatedAt: new DateTimeImmutable($data['updatedAt']), + deletedAt: $data['deletedAt'] ? new DateTimeImmutable($data['deletedAt']) : null, + ); + } + + public function delete(string $id): void + { + $this->connection->createCommand()->delete('{{%page}}', ['id' => $id])->execute(); + } } ``` -Apply it with `yii migrate:up`. +## Actions and routes -## Inserting +You need actions to: -## Selecting +1. List all pages. +2. View a page. +3. Delete a page. +4. Create a page. +5. Edit a page. -## Using data package -### Pagination > [!NOTE] > [← Working with forms](forms.md) | diff --git a/guide/id/start/databases.md b/guide/id/start/databases.md index 8ac018f..e236d4c 100644 --- a/guide/id/start/databases.md +++ b/guide/id/start/databases.md @@ -89,7 +89,7 @@ Now that we have the database, it's time to define the connection. We need a package to be installed first: ```sh -composer require yiisoft/db-pgsql +make composer require yiisoft/db-pgsql ``` Now create `config/common/di/db-pgsql.php`: @@ -152,38 +152,232 @@ To use migrations we need another package installed: composer require yiisoft/db-migration ``` -And a directory to store migrations such as `migrations` right in the -project root. +Create a directory to store migrations `src/Migration` right in the project +root. Add the following configuration to `config/common/params.php`: -Now you can use `yii migrate:create page` to create a new migration. For our -example we need a `page` table with some columns: +```php +'yiisoft/db-migration' => [ + 'newMigrationNamespace' => 'App\\Migration', + 'sourceNamespaces' => ['App\\Migration'], +], +``` + +Now you can use `make yii migrate:create page` to create a new +migration. For our example we need a `page` table with some columns: + +```php +createTable('page', [ + 'id' => $b->uuidPrimaryKey(), + 'title' => $b->string()->notNull(), + 'slug' => $b->string()->notNull(), + 'text' => $b->text()->notNull(), + 'created_at' => $b->dateTime()->notNull(), + 'updated_at' => $b->dateTime(), + 'deleted_at' => $b->dateTime(), + ]); + } + + public function down(MigrationBuilder $b): void + { + $b->dropTable('page'); + } +} +``` + +Note that we use UUID as the primary key. While the storage space is a bit +bigger than using int, the workflow with such IDs is beneficial. You +generate the ID yourself so you can define a set of related data and save it +in a single transaction. The entities that define this set of data in the +code are often called an "aggregate". + +Apply it with `make yii migrate:up`. + +## An entity + +Now that you have a table it is time to define an entity in the code. Create +`src/Web/Page/Page.php`: + +```php +toSlug($this->title); + } + + public function isDeleted(): bool + { + return $this->deletedAt !== null; + } +} +``` + +## Collection + +You need to select both single pages and page collection. Let's make the +collection typed. Create `src/Web/Page/PageCollection.php`: + +```php +pages = $pages; + } + + public function add(Page $page): void + { + $this->pages[] = $page; + } + + /** + * @return Traversable + */ + public function getIterator(): Traversable + { + return new ArrayIterator($this->pages); + } +} +``` + +## Repository + +Now that we have entity and collection, we need a place for methods to save +an entity, delete it and select either a single page or page collection. + +Create `src/Web/Page/PageRepository.php`: ```php +columnBuilder(); - - $b->createTable('page', [ - 'id' => $cb->primaryKey(), - 'title' => $cb->string()->notNull(), - 'text' => $cb->text()->notNull(), - 'created_at' => $cb->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'), - 'updated_at' => $cb->dateTime(), - 'deleted_at' => $cb->dateTime(), - ]); + public function __construct( + private ConnectionInterface $connection, + ) {} + + public function save(Page $page): void + { + $this->connection->createCommand()->upsert('{{%page}}', [ + 'id' => $page->id, + 'title' => $page->title, + 'slug' => $page->getSlug(), + 'text' => $page->text, + 'created_at' => $page->createdAt, + 'updated_at' => $page->updatedAt, + 'deleted_at' => $page->deletedAt, + ])->execute(); + } + + public function findOneBySlug(string $slug): ?Page + { + $data = (new Query($this->connection)) + ->select('*') + ->from('{{%page}}') + ->where('slug = :slug') + ->one(); + + if ($data === null) { + return null; + } + + return $this->createPage($data); + } + + public function findAll(): PageCollection + { + $collection = new PageCollection(); + + $data = (new Query($this->connection)) + ->select('*') + ->from('{{%page}}') + ->all(); + + foreach ($data as $page) { + $collection->add($this->createPage($page)); + } + + return $collection; + } + + private function createPage(array $data): Page + { + return new Page( + id: $data['id'], + title: $data['title'], + text: $data['text'], + createdAt: new DateTimeImmutable($data['createdAt']), + updatedAt: new DateTimeImmutable($data['updatedAt']), + deletedAt: $data['deletedAt'] ? new DateTimeImmutable($data['deletedAt']) : null, + ); + } + + public function delete(string $id): void + { + $this->connection->createCommand()->delete('{{%page}}', ['id' => $id])->execute(); + } } ``` -Apply it with `yii migrate:up`. +## Actions and routes -## Inserting +You need actions to: -## Selecting +1. List all pages. +2. View a page. +3. Delete a page. +4. Create a page. +5. Edit a page. -## Using data package -### Pagination > [!NOTE] > [← Working with forms](forms.md) | diff --git a/guide/ru/start/databases.md b/guide/ru/start/databases.md index 8ac018f..e236d4c 100644 --- a/guide/ru/start/databases.md +++ b/guide/ru/start/databases.md @@ -89,7 +89,7 @@ Now that we have the database, it's time to define the connection. We need a package to be installed first: ```sh -composer require yiisoft/db-pgsql +make composer require yiisoft/db-pgsql ``` Now create `config/common/di/db-pgsql.php`: @@ -152,38 +152,232 @@ To use migrations we need another package installed: composer require yiisoft/db-migration ``` -And a directory to store migrations such as `migrations` right in the -project root. +Create a directory to store migrations `src/Migration` right in the project +root. Add the following configuration to `config/common/params.php`: -Now you can use `yii migrate:create page` to create a new migration. For our -example we need a `page` table with some columns: +```php +'yiisoft/db-migration' => [ + 'newMigrationNamespace' => 'App\\Migration', + 'sourceNamespaces' => ['App\\Migration'], +], +``` + +Now you can use `make yii migrate:create page` to create a new +migration. For our example we need a `page` table with some columns: + +```php +createTable('page', [ + 'id' => $b->uuidPrimaryKey(), + 'title' => $b->string()->notNull(), + 'slug' => $b->string()->notNull(), + 'text' => $b->text()->notNull(), + 'created_at' => $b->dateTime()->notNull(), + 'updated_at' => $b->dateTime(), + 'deleted_at' => $b->dateTime(), + ]); + } + + public function down(MigrationBuilder $b): void + { + $b->dropTable('page'); + } +} +``` + +Note that we use UUID as the primary key. While the storage space is a bit +bigger than using int, the workflow with such IDs is beneficial. You +generate the ID yourself so you can define a set of related data and save it +in a single transaction. The entities that define this set of data in the +code are often called an "aggregate". + +Apply it with `make yii migrate:up`. + +## An entity + +Now that you have a table it is time to define an entity in the code. Create +`src/Web/Page/Page.php`: + +```php +toSlug($this->title); + } + + public function isDeleted(): bool + { + return $this->deletedAt !== null; + } +} +``` + +## Collection + +You need to select both single pages and page collection. Let's make the +collection typed. Create `src/Web/Page/PageCollection.php`: + +```php +pages = $pages; + } + + public function add(Page $page): void + { + $this->pages[] = $page; + } + + /** + * @return Traversable + */ + public function getIterator(): Traversable + { + return new ArrayIterator($this->pages); + } +} +``` + +## Repository + +Now that we have entity and collection, we need a place for methods to save +an entity, delete it and select either a single page or page collection. + +Create `src/Web/Page/PageRepository.php`: ```php +columnBuilder(); - - $b->createTable('page', [ - 'id' => $cb->primaryKey(), - 'title' => $cb->string()->notNull(), - 'text' => $cb->text()->notNull(), - 'created_at' => $cb->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP'), - 'updated_at' => $cb->dateTime(), - 'deleted_at' => $cb->dateTime(), - ]); + public function __construct( + private ConnectionInterface $connection, + ) {} + + public function save(Page $page): void + { + $this->connection->createCommand()->upsert('{{%page}}', [ + 'id' => $page->id, + 'title' => $page->title, + 'slug' => $page->getSlug(), + 'text' => $page->text, + 'created_at' => $page->createdAt, + 'updated_at' => $page->updatedAt, + 'deleted_at' => $page->deletedAt, + ])->execute(); + } + + public function findOneBySlug(string $slug): ?Page + { + $data = (new Query($this->connection)) + ->select('*') + ->from('{{%page}}') + ->where('slug = :slug') + ->one(); + + if ($data === null) { + return null; + } + + return $this->createPage($data); + } + + public function findAll(): PageCollection + { + $collection = new PageCollection(); + + $data = (new Query($this->connection)) + ->select('*') + ->from('{{%page}}') + ->all(); + + foreach ($data as $page) { + $collection->add($this->createPage($page)); + } + + return $collection; + } + + private function createPage(array $data): Page + { + return new Page( + id: $data['id'], + title: $data['title'], + text: $data['text'], + createdAt: new DateTimeImmutable($data['createdAt']), + updatedAt: new DateTimeImmutable($data['updatedAt']), + deletedAt: $data['deletedAt'] ? new DateTimeImmutable($data['deletedAt']) : null, + ); + } + + public function delete(string $id): void + { + $this->connection->createCommand()->delete('{{%page}}', ['id' => $id])->execute(); + } } ``` -Apply it with `yii migrate:up`. +## Actions and routes -## Inserting +You need actions to: -## Selecting +1. List all pages. +2. View a page. +3. Delete a page. +4. Create a page. +5. Edit a page. -## Using data package -### Pagination > [!NOTE] > [← Working with forms](forms.md) | From 20d634be86dfbe78cd3b29a75cd38081946edb5f Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sun, 2 Nov 2025 20:14:46 +0300 Subject: [PATCH 08/16] Remove collection --- guide/en/start/databases.md | 52 +++++-------------------------------- 1 file changed, 7 insertions(+), 45 deletions(-) diff --git a/guide/en/start/databases.md b/guide/en/start/databases.md index a1b7b07..3961de5 100644 --- a/guide/en/start/databases.md +++ b/guide/en/start/databases.md @@ -232,48 +232,10 @@ final readonly class Page } ``` -## Collection - -You need to select both single pages and page collection. Let's make the collection typed. -Create `src/Web/Page/PageCollection.php`: - -```php -pages = $pages; - } - - public function add(Page $page): void - { - $this->pages[] = $page; - } - - /** - * @return Traversable - */ - public function getIterator(): Traversable - { - return new ArrayIterator($this->pages); - } -} -``` - ## Repository -Now that we have entity and collection, we need a place for methods to save an entity, delete it and select either -a single page or page collection. +Now that we have entity, we need a place for methods to save an entity, delete it and select either +a single page or multiple pages. Create `src/Web/Page/PageRepository.php`: @@ -320,9 +282,11 @@ final readonly class PageRepository return $this->createPage($data); } - public function findAll(): PageCollection + /** + * @return iterable + */ + public function findAll(): iterable { - $collection = new PageCollection(); $data = (new Query($this->connection)) ->select('*') @@ -330,10 +294,8 @@ final readonly class PageRepository ->all(); foreach ($data as $page) { - $collection->add($this->createPage($page)); + yield $this->createPage($page); } - - return $collection; } private function createPage(array $data): Page From af48d50570768821c0343ed463155ecae7e1ffc6 Mon Sep 17 00:00:00 2001 From: samdark <47294+samdark@users.noreply.github.com> Date: Sun, 2 Nov 2025 17:16:31 +0000 Subject: [PATCH 09/16] Update translation --- .../guide/po/es/start_databases.md.po | 61 ++--------------- .../guide/po/id/start_databases.md.po | 61 ++--------------- .../guide/po/ru/start_databases.md.po | 61 ++--------------- .../guide/pot/start_databases.md.pot | 65 +++---------------- guide/es/start/databases.md | 52 ++------------- guide/id/start/databases.md | 52 ++------------- guide/ru/start/databases.md | 52 ++------------- 7 files changed, 50 insertions(+), 354 deletions(-) diff --git a/_translations/guide/po/es/start_databases.md.po b/_translations/guide/po/es/start_databases.md.po index 4c85cfc..f2bf914 100644 --- a/_translations/guide/po/es/start_databases.md.po +++ b/_translations/guide/po/es/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-11-02 16:25+0000\n" +"POT-Creation-Date: 2025-11-02 17:16+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -366,53 +366,6 @@ msgid "" "}\n" msgstr "" -#. type: Title ## -#: ../../guide/en/start/databases.md -#, no-wrap -msgid "Collection" -msgstr "" - -#. type: Plain text -#: ../../guide/en/start/databases.md -msgid "You need to select both single pages and page collection. Let's make the collection typed. Create `src/Web/Page/PageCollection.php`:" -msgstr "" - -#. type: Fenced code block (php) -#: ../../guide/en/start/databases.md -#, no-wrap -msgid "" -"pages = $pages;\n" -" }\n" -"\n" -" public function add(Page $page): void\n" -" {\n" -" $this->pages[] = $page;\n" -" }\n" -"\n" -" /**\n" -" * @return Traversable\n" -" */\n" -" public function getIterator(): Traversable\n" -" {\n" -" return new ArrayIterator($this->pages);\n" -" }\n" -"}\n" -msgstr "" - #. type: Bullet: '- ' #: ../../guide/en/start/databases.md ../../guide/en/structure/domain.md #: ../../guide/en/structure/service.md @@ -422,7 +375,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "Now that we have entity and collection, we need a place for methods to save an entity, delete it and select either a single page or page collection." +msgid "Now that we have entity, we need a place for methods to save an entity, delete it and select either a single page or multiple pages." msgstr "" #. type: Plain text @@ -476,9 +429,11 @@ msgid "" " return $this->createPage($data);\n" " }\n" "\n" -" public function findAll(): PageCollection\n" +" /**\n" +" * @return iterable\n" +" */\n" +" public function findAll(): iterable\n" " {\n" -" $collection = new PageCollection();\n" "\n" " $data = (new Query($this->connection))\n" " ->select('*')\n" @@ -486,10 +441,8 @@ msgid "" " ->all();\n" "\n" " foreach ($data as $page) {\n" -" $collection->add($this->createPage($page));\n" +" yield $this->createPage($page);\n" " }\n" -"\n" -" return $collection;\n" " }\n" "\n" " private function createPage(array $data): Page\n" diff --git a/_translations/guide/po/id/start_databases.md.po b/_translations/guide/po/id/start_databases.md.po index f833f34..46fe3b4 100644 --- a/_translations/guide/po/id/start_databases.md.po +++ b/_translations/guide/po/id/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-11-02 16:25+0000\n" +"POT-Creation-Date: 2025-11-02 17:16+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -366,53 +366,6 @@ msgid "" "}\n" msgstr "" -#. type: Title ## -#: ../../guide/en/start/databases.md -#, no-wrap -msgid "Collection" -msgstr "" - -#. type: Plain text -#: ../../guide/en/start/databases.md -msgid "You need to select both single pages and page collection. Let's make the collection typed. Create `src/Web/Page/PageCollection.php`:" -msgstr "" - -#. type: Fenced code block (php) -#: ../../guide/en/start/databases.md -#, no-wrap -msgid "" -"pages = $pages;\n" -" }\n" -"\n" -" public function add(Page $page): void\n" -" {\n" -" $this->pages[] = $page;\n" -" }\n" -"\n" -" /**\n" -" * @return Traversable\n" -" */\n" -" public function getIterator(): Traversable\n" -" {\n" -" return new ArrayIterator($this->pages);\n" -" }\n" -"}\n" -msgstr "" - #. type: Bullet: '- ' #: ../../guide/en/start/databases.md ../../guide/en/structure/domain.md #: ../../guide/en/structure/service.md @@ -422,7 +375,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "Now that we have entity and collection, we need a place for methods to save an entity, delete it and select either a single page or page collection." +msgid "Now that we have entity, we need a place for methods to save an entity, delete it and select either a single page or multiple pages." msgstr "" #. type: Plain text @@ -476,9 +429,11 @@ msgid "" " return $this->createPage($data);\n" " }\n" "\n" -" public function findAll(): PageCollection\n" +" /**\n" +" * @return iterable\n" +" */\n" +" public function findAll(): iterable\n" " {\n" -" $collection = new PageCollection();\n" "\n" " $data = (new Query($this->connection))\n" " ->select('*')\n" @@ -486,10 +441,8 @@ msgid "" " ->all();\n" "\n" " foreach ($data as $page) {\n" -" $collection->add($this->createPage($page));\n" +" yield $this->createPage($page);\n" " }\n" -"\n" -" return $collection;\n" " }\n" "\n" " private function createPage(array $data): Page\n" diff --git a/_translations/guide/po/ru/start_databases.md.po b/_translations/guide/po/ru/start_databases.md.po index 2e8b695..bf7dfff 100644 --- a/_translations/guide/po/ru/start_databases.md.po +++ b/_translations/guide/po/ru/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-11-02 16:25+0000\n" +"POT-Creation-Date: 2025-11-02 17:16+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -370,53 +370,6 @@ msgid "" "}\n" msgstr "" -#. type: Title ## -#: ../../guide/en/start/databases.md -#, no-wrap -msgid "Collection" -msgstr "" - -#. type: Plain text -#: ../../guide/en/start/databases.md -msgid "You need to select both single pages and page collection. Let's make the collection typed. Create `src/Web/Page/PageCollection.php`:" -msgstr "" - -#. type: Fenced code block (php) -#: ../../guide/en/start/databases.md -#, no-wrap -msgid "" -"pages = $pages;\n" -" }\n" -"\n" -" public function add(Page $page): void\n" -" {\n" -" $this->pages[] = $page;\n" -" }\n" -"\n" -" /**\n" -" * @return Traversable\n" -" */\n" -" public function getIterator(): Traversable\n" -" {\n" -" return new ArrayIterator($this->pages);\n" -" }\n" -"}\n" -msgstr "" - #. type: Bullet: '- ' #: ../../guide/en/start/databases.md ../../guide/en/structure/domain.md #: ../../guide/en/structure/service.md @@ -426,7 +379,7 @@ msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "Now that we have entity and collection, we need a place for methods to save an entity, delete it and select either a single page or page collection." +msgid "Now that we have entity, we need a place for methods to save an entity, delete it and select either a single page or multiple pages." msgstr "" #. type: Plain text @@ -480,9 +433,11 @@ msgid "" " return $this->createPage($data);\n" " }\n" "\n" -" public function findAll(): PageCollection\n" +" /**\n" +" * @return iterable\n" +" */\n" +" public function findAll(): iterable\n" " {\n" -" $collection = new PageCollection();\n" "\n" " $data = (new Query($this->connection))\n" " ->select('*')\n" @@ -490,10 +445,8 @@ msgid "" " ->all();\n" "\n" " foreach ($data as $page) {\n" -" $collection->add($this->createPage($page));\n" +" yield $this->createPage($page);\n" " }\n" -"\n" -" return $collection;\n" " }\n" "\n" " private function createPage(array $data): Page\n" diff --git a/_translations/guide/pot/start_databases.md.pot b/_translations/guide/pot/start_databases.md.pot index ea559ed..a77b473 100644 --- a/_translations/guide/pot/start_databases.md.pot +++ b/_translations/guide/pot/start_databases.md.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-11-02 16:25+0000\n" +"POT-Creation-Date: 2025-11-02 17:16+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -406,55 +406,6 @@ msgid "" "}\n" msgstr "" -#. type: Title ## -#: ../../guide/en/start/databases.md -#, no-wrap -msgid "Collection" -msgstr "" - -#. type: Plain text -#: ../../guide/en/start/databases.md -msgid "" -"You need to select both single pages and page collection. Let's make the " -"collection typed. Create `src/Web/Page/PageCollection.php`:" -msgstr "" - -#. type: Fenced code block (php) -#: ../../guide/en/start/databases.md -#, no-wrap -msgid "" -"pages = $pages;\n" -" }\n" -"\n" -" public function add(Page $page): void\n" -" {\n" -" $this->pages[] = $page;\n" -" }\n" -"\n" -" /**\n" -" * @return Traversable\n" -" */\n" -" public function getIterator(): Traversable\n" -" {\n" -" return new ArrayIterator($this->pages);\n" -" }\n" -"}\n" -msgstr "" - #. type: Bullet: '- ' #: ../../guide/en/start/databases.md ../../guide/en/structure/domain.md #: ../../guide/en/structure/service.md @@ -465,8 +416,8 @@ msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md msgid "" -"Now that we have entity and collection, we need a place for methods to save " -"an entity, delete it and select either a single page or page collection." +"Now that we have entity, we need a place for methods to save an entity, " +"delete it and select either a single page or multiple pages." msgstr "" #. type: Plain text @@ -520,9 +471,11 @@ msgid "" " return $this->createPage($data);\n" " }\n" "\n" -" public function findAll(): PageCollection\n" +" /**\n" +" * @return iterable\n" +" */\n" +" public function findAll(): iterable\n" " {\n" -" $collection = new PageCollection();\n" "\n" " $data = (new Query($this->connection))\n" " ->select('*')\n" @@ -530,10 +483,8 @@ msgid "" " ->all();\n" "\n" " foreach ($data as $page) {\n" -" $collection->add($this->createPage($page));\n" +" yield $this->createPage($page);\n" " }\n" -"\n" -" return $collection;\n" " }\n" "\n" " private function createPage(array $data): Page\n" diff --git a/guide/es/start/databases.md b/guide/es/start/databases.md index e236d4c..8c8dcaa 100644 --- a/guide/es/start/databases.md +++ b/guide/es/start/databases.md @@ -244,48 +244,10 @@ final readonly class Page } ``` -## Collection - -You need to select both single pages and page collection. Let's make the -collection typed. Create `src/Web/Page/PageCollection.php`: - -```php -pages = $pages; - } - - public function add(Page $page): void - { - $this->pages[] = $page; - } - - /** - * @return Traversable - */ - public function getIterator(): Traversable - { - return new ArrayIterator($this->pages); - } -} -``` - ## Repository -Now that we have entity and collection, we need a place for methods to save -an entity, delete it and select either a single page or page collection. +Now that we have entity, we need a place for methods to save an entity, +delete it and select either a single page or multiple pages. Create `src/Web/Page/PageRepository.php`: @@ -332,9 +294,11 @@ final readonly class PageRepository return $this->createPage($data); } - public function findAll(): PageCollection + /** + * @return iterable + */ + public function findAll(): iterable { - $collection = new PageCollection(); $data = (new Query($this->connection)) ->select('*') @@ -342,10 +306,8 @@ final readonly class PageRepository ->all(); foreach ($data as $page) { - $collection->add($this->createPage($page)); + yield $this->createPage($page); } - - return $collection; } private function createPage(array $data): Page diff --git a/guide/id/start/databases.md b/guide/id/start/databases.md index e236d4c..8c8dcaa 100644 --- a/guide/id/start/databases.md +++ b/guide/id/start/databases.md @@ -244,48 +244,10 @@ final readonly class Page } ``` -## Collection - -You need to select both single pages and page collection. Let's make the -collection typed. Create `src/Web/Page/PageCollection.php`: - -```php -pages = $pages; - } - - public function add(Page $page): void - { - $this->pages[] = $page; - } - - /** - * @return Traversable - */ - public function getIterator(): Traversable - { - return new ArrayIterator($this->pages); - } -} -``` - ## Repository -Now that we have entity and collection, we need a place for methods to save -an entity, delete it and select either a single page or page collection. +Now that we have entity, we need a place for methods to save an entity, +delete it and select either a single page or multiple pages. Create `src/Web/Page/PageRepository.php`: @@ -332,9 +294,11 @@ final readonly class PageRepository return $this->createPage($data); } - public function findAll(): PageCollection + /** + * @return iterable + */ + public function findAll(): iterable { - $collection = new PageCollection(); $data = (new Query($this->connection)) ->select('*') @@ -342,10 +306,8 @@ final readonly class PageRepository ->all(); foreach ($data as $page) { - $collection->add($this->createPage($page)); + yield $this->createPage($page); } - - return $collection; } private function createPage(array $data): Page diff --git a/guide/ru/start/databases.md b/guide/ru/start/databases.md index e236d4c..8c8dcaa 100644 --- a/guide/ru/start/databases.md +++ b/guide/ru/start/databases.md @@ -244,48 +244,10 @@ final readonly class Page } ``` -## Collection - -You need to select both single pages and page collection. Let's make the -collection typed. Create `src/Web/Page/PageCollection.php`: - -```php -pages = $pages; - } - - public function add(Page $page): void - { - $this->pages[] = $page; - } - - /** - * @return Traversable - */ - public function getIterator(): Traversable - { - return new ArrayIterator($this->pages); - } -} -``` - ## Repository -Now that we have entity and collection, we need a place for methods to save -an entity, delete it and select either a single page or page collection. +Now that we have entity, we need a place for methods to save an entity, +delete it and select either a single page or multiple pages. Create `src/Web/Page/PageRepository.php`: @@ -332,9 +294,11 @@ final readonly class PageRepository return $this->createPage($data); } - public function findAll(): PageCollection + /** + * @return iterable + */ + public function findAll(): iterable { - $collection = new PageCollection(); $data = (new Query($this->connection)) ->select('*') @@ -342,10 +306,8 @@ final readonly class PageRepository ->all(); foreach ($data as $page) { - $collection->add($this->createPage($page)); + yield $this->createPage($page); } - - return $collection; } private function createPage(array $data): Page From b4b32f88a76b695381d70e53c40380803ed64757 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sun, 2 Nov 2025 20:16:27 +0300 Subject: [PATCH 10/16] Fix formatting --- guide/en/start/databases.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/en/start/databases.md b/guide/en/start/databases.md index 3961de5..1bd3ca0 100644 --- a/guide/en/start/databases.md +++ b/guide/en/start/databases.md @@ -282,7 +282,7 @@ final readonly class PageRepository return $this->createPage($data); } - /** + /** * @return iterable */ public function findAll(): iterable From f7eca52bcac6beba4c648b3dd42fb37b3df2b4ce Mon Sep 17 00:00:00 2001 From: samdark <47294+samdark@users.noreply.github.com> Date: Sun, 2 Nov 2025 17:17:12 +0000 Subject: [PATCH 11/16] Update translation --- _translations/guide/po/es/start_databases.md.po | 4 ++-- _translations/guide/po/id/start_databases.md.po | 4 ++-- _translations/guide/po/ru/start_databases.md.po | 4 ++-- _translations/guide/pot/start_databases.md.pot | 4 ++-- guide/es/start/databases.md | 2 +- guide/id/start/databases.md | 2 +- guide/ru/start/databases.md | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/_translations/guide/po/es/start_databases.md.po b/_translations/guide/po/es/start_databases.md.po index f2bf914..af4c4a0 100644 --- a/_translations/guide/po/es/start_databases.md.po +++ b/_translations/guide/po/es/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-11-02 17:16+0000\n" +"POT-Creation-Date: 2025-11-02 17:17+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -429,7 +429,7 @@ msgid "" " return $this->createPage($data);\n" " }\n" "\n" -" /**\n" +" /**\n" " * @return iterable\n" " */\n" " public function findAll(): iterable\n" diff --git a/_translations/guide/po/id/start_databases.md.po b/_translations/guide/po/id/start_databases.md.po index 46fe3b4..88367fd 100644 --- a/_translations/guide/po/id/start_databases.md.po +++ b/_translations/guide/po/id/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-11-02 17:16+0000\n" +"POT-Creation-Date: 2025-11-02 17:17+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -429,7 +429,7 @@ msgid "" " return $this->createPage($data);\n" " }\n" "\n" -" /**\n" +" /**\n" " * @return iterable\n" " */\n" " public function findAll(): iterable\n" diff --git a/_translations/guide/po/ru/start_databases.md.po b/_translations/guide/po/ru/start_databases.md.po index bf7dfff..aa80289 100644 --- a/_translations/guide/po/ru/start_databases.md.po +++ b/_translations/guide/po/ru/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-11-02 17:16+0000\n" +"POT-Creation-Date: 2025-11-02 17:17+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -433,7 +433,7 @@ msgid "" " return $this->createPage($data);\n" " }\n" "\n" -" /**\n" +" /**\n" " * @return iterable\n" " */\n" " public function findAll(): iterable\n" diff --git a/_translations/guide/pot/start_databases.md.pot b/_translations/guide/pot/start_databases.md.pot index a77b473..ef6412f 100644 --- a/_translations/guide/pot/start_databases.md.pot +++ b/_translations/guide/pot/start_databases.md.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-11-02 17:16+0000\n" +"POT-Creation-Date: 2025-11-02 17:17+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -471,7 +471,7 @@ msgid "" " return $this->createPage($data);\n" " }\n" "\n" -" /**\n" +" /**\n" " * @return iterable\n" " */\n" " public function findAll(): iterable\n" diff --git a/guide/es/start/databases.md b/guide/es/start/databases.md index 8c8dcaa..55fbf81 100644 --- a/guide/es/start/databases.md +++ b/guide/es/start/databases.md @@ -294,7 +294,7 @@ final readonly class PageRepository return $this->createPage($data); } - /** + /** * @return iterable */ public function findAll(): iterable diff --git a/guide/id/start/databases.md b/guide/id/start/databases.md index 8c8dcaa..55fbf81 100644 --- a/guide/id/start/databases.md +++ b/guide/id/start/databases.md @@ -294,7 +294,7 @@ final readonly class PageRepository return $this->createPage($data); } - /** + /** * @return iterable */ public function findAll(): iterable diff --git a/guide/ru/start/databases.md b/guide/ru/start/databases.md index 8c8dcaa..55fbf81 100644 --- a/guide/ru/start/databases.md +++ b/guide/ru/start/databases.md @@ -294,7 +294,7 @@ final readonly class PageRepository return $this->createPage($data); } - /** + /** * @return iterable */ public function findAll(): iterable From 7081a8ed331ac6d4d7f979da53f09ed6abea04c4 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Mon, 3 Nov 2025 10:08:45 +0300 Subject: [PATCH 12/16] Fixes --- guide/en/start/databases.md | 53 +++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/guide/en/start/databases.md b/guide/en/start/databases.md index 1bd3ca0..b828b1b 100644 --- a/guide/en/start/databases.md +++ b/guide/en/start/databases.md @@ -6,7 +6,8 @@ There are many ways you can work with relational databases: - [Yii DB](https://github.com/yiisoft/db) - [Yii Active Record](https://github.com/yiisoft/active-record) - [Cycle](https://github.com/cycle) via [Yii Cycle package](https://github.com/yiisoft/yii-cycle) -- [Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine) +- [Doctrine](https://www.doctrine-project.org/) + via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine) - [PDO](https://www.php.net/manual/en/book.pdo.php) For non-relational ones, there are usually official libraries available: @@ -20,12 +21,11 @@ simple CRUD (create read update delete). ## Installing PostgreSQL -You need to install PostgreSQL. If you prefer not to use Docker, +You need to install PostgreSQL. If you prefer not to use Docker, [get the installer from official website](https://www.postgresql.org/download/), install it and create a database. If you use Docker, it is a bit simpler. Modify `docker/dev/compose.yml`: - ```yaml services: app: @@ -37,9 +37,9 @@ services: USER_ID: ${UID} GROUP_ID: ${GID} env_file: - - path: ./dev/.env - - path: ./dev/override.env - required: false + - path: ./dev/.env + - path: ./dev/override.env + required: false ports: - "${DEV_PORT:-80}:80" volumes: @@ -49,27 +49,27 @@ services: - caddy_config:/config tty: true depends_on: - db: - condition: service_healthy + db: + condition: service_healthy db: image: postgres:${POSTGRES_VERSION:-15}-alpine environment: - POSTGRES_DB: app - POSTGRES_PASSWORD: password - POSTGRES_USER: user + POSTGRES_DB: app + POSTGRES_PASSWORD: password + POSTGRES_USER: user volumes: - - ./runtime/db:/var/lib/postgresql/data:rw + - ./runtime/db:/var/lib/postgresql/data:rw ports: - - "${DEV_DB_PORT:-5432}:5432" + - "${DEV_DB_PORT:-5432}:5432" healthcheck: - test: [ "CMD-SHELL", "pg_isready -U user -d app" ] - interval: 5s - timeout: 5s - retries: 5 + test: [ "CMD-SHELL", "pg_isready -U user -d app" ] + interval: 5s + timeout: 5s + retries: 5 volumes: - db: + db: ``` Note that we add `depends_on` so application waits for database to be up. @@ -272,7 +272,7 @@ final readonly class PageRepository $data = (new Query($this->connection)) ->select('*') ->from('{{%page}}') - ->where('slug = :slug') + ->where('slug = :slug', ['slug' => $slug]) ->one(); if ($data === null) { @@ -282,12 +282,11 @@ final readonly class PageRepository return $this->createPage($data); } - /** - * @return iterable - */ + /** + * @return iterable + */ public function findAll(): iterable { - $data = (new Query($this->connection)) ->select('*') ->from('{{%page}}') @@ -304,9 +303,9 @@ final readonly class PageRepository id: $data['id'], title: $data['title'], text: $data['text'], - createdAt: new DateTimeImmutable($data['createdAt']), - updatedAt: new DateTimeImmutable($data['updatedAt']), - deletedAt: $data['deletedAt'] ? new DateTimeImmutable($data['deletedAt']) : null, + createdAt: new DateTimeImmutable($data['created_at']), + updatedAt: new DateTimeImmutable($data['updated_at']), + deletedAt: $data['deleted_at'] ? new DateTimeImmutable($data['deleted_at']) : null, ); } @@ -327,8 +326,6 @@ You need actions to: 4. Create a page. 5. Edit a page. - - > [!NOTE] > [← Working with forms](forms.md) | > [Generating code with Gii →](gii.md) From 7597788fc853d259311a65ee5de9cb3629147804 Mon Sep 17 00:00:00 2001 From: samdark <47294+samdark@users.noreply.github.com> Date: Mon, 3 Nov 2025 07:09:41 +0000 Subject: [PATCH 13/16] Update translation --- .../guide/po/es/start_databases.md.po | 49 +++++++++--------- .../guide/po/id/start_databases.md.po | 49 +++++++++--------- .../guide/po/ru/start_databases.md.po | 49 +++++++++--------- .../guide/pot/start_databases.md.pot | 49 +++++++++--------- guide/es/start/databases.md | 50 +++++++++---------- guide/id/start/databases.md | 50 +++++++++---------- guide/ru/start/databases.md | 50 +++++++++---------- 7 files changed, 165 insertions(+), 181 deletions(-) diff --git a/_translations/guide/po/es/start_databases.md.po b/_translations/guide/po/es/start_databases.md.po index af4c4a0..0987f2a 100644 --- a/_translations/guide/po/es/start_databases.md.po +++ b/_translations/guide/po/es/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-11-02 17:17+0000\n" +"POT-Creation-Date: 2025-11-03 07:09+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -50,7 +50,7 @@ msgstr "" #. type: Bullet: '- ' #: ../../guide/en/start/databases.md -msgid "[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine)" +msgid "[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine)" msgstr "" #. type: Bullet: '- ' @@ -113,9 +113,9 @@ msgid "" " USER_ID: ${UID}\n" " GROUP_ID: ${GID}\n" " env_file:\n" -" - path: ./dev/.env\n" -" - path: ./dev/override.env\n" -" required: false\n" +" - path: ./dev/.env\n" +" - path: ./dev/override.env\n" +" required: false\n" " ports:\n" " - \"${DEV_PORT:-80}:80\"\n" " volumes:\n" @@ -125,27 +125,27 @@ msgid "" " - caddy_config:/config\n" " tty: true\n" " depends_on:\n" -" db:\n" -" condition: service_healthy\n" +" db:\n" +" condition: service_healthy\n" "\n" " db:\n" " image: postgres:${POSTGRES_VERSION:-15}-alpine\n" " environment:\n" -" POSTGRES_DB: app\n" -" POSTGRES_PASSWORD: password\n" -" POSTGRES_USER: user\n" +" POSTGRES_DB: app\n" +" POSTGRES_PASSWORD: password\n" +" POSTGRES_USER: user\n" " volumes:\n" -" - ./runtime/db:/var/lib/postgresql/data:rw\n" +" - ./runtime/db:/var/lib/postgresql/data:rw\n" " ports:\n" -" - \"${DEV_DB_PORT:-5432}:5432\"\n" +" - \"${DEV_DB_PORT:-5432}:5432\"\n" " healthcheck:\n" -" test: [ \"CMD-SHELL\", \"pg_isready -U user -d app\" ]\n" -" interval: 5s\n" -" timeout: 5s\n" -" retries: 5\n" +" test: [ \"CMD-SHELL\", \"pg_isready -U user -d app\" ]\n" +" interval: 5s\n" +" timeout: 5s\n" +" retries: 5\n" "\n" "volumes:\n" -" db:\n" +" db:\n" msgstr "" #. type: Plain text @@ -419,7 +419,7 @@ msgid "" " $data = (new Query($this->connection))\n" " ->select('*')\n" " ->from('{{%page}}')\n" -" ->where('slug = :slug')\n" +" ->where('slug = :slug', ['slug' => $slug])\n" " ->one();\n" "\n" " if ($data === null) {\n" @@ -429,12 +429,11 @@ msgid "" " return $this->createPage($data);\n" " }\n" "\n" -" /**\n" -" * @return iterable\n" -" */\n" +" /**\n" +" * @return iterable\n" +" */\n" " public function findAll(): iterable\n" " {\n" -"\n" " $data = (new Query($this->connection))\n" " ->select('*')\n" " ->from('{{%page}}')\n" @@ -451,9 +450,9 @@ msgid "" " id: $data['id'],\n" " title: $data['title'],\n" " text: $data['text'],\n" -" createdAt: new DateTimeImmutable($data['createdAt']),\n" -" updatedAt: new DateTimeImmutable($data['updatedAt']),\n" -" deletedAt: $data['deletedAt'] ? new DateTimeImmutable($data['deletedAt']) : null,\n" +" createdAt: new DateTimeImmutable($data['created_at']),\n" +" updatedAt: new DateTimeImmutable($data['updated_at']),\n" +" deletedAt: $data['deleted_at'] ? new DateTimeImmutable($data['deleted_at']) : null,\n" " );\n" " }\n" "\n" diff --git a/_translations/guide/po/id/start_databases.md.po b/_translations/guide/po/id/start_databases.md.po index 88367fd..588960b 100644 --- a/_translations/guide/po/id/start_databases.md.po +++ b/_translations/guide/po/id/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-11-02 17:17+0000\n" +"POT-Creation-Date: 2025-11-03 07:09+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -49,7 +49,7 @@ msgstr "" #. type: Bullet: '- ' #: ../../guide/en/start/databases.md -msgid "[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine)" +msgid "[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine)" msgstr "" #. type: Bullet: '- ' @@ -112,9 +112,9 @@ msgid "" " USER_ID: ${UID}\n" " GROUP_ID: ${GID}\n" " env_file:\n" -" - path: ./dev/.env\n" -" - path: ./dev/override.env\n" -" required: false\n" +" - path: ./dev/.env\n" +" - path: ./dev/override.env\n" +" required: false\n" " ports:\n" " - \"${DEV_PORT:-80}:80\"\n" " volumes:\n" @@ -124,27 +124,27 @@ msgid "" " - caddy_config:/config\n" " tty: true\n" " depends_on:\n" -" db:\n" -" condition: service_healthy\n" +" db:\n" +" condition: service_healthy\n" "\n" " db:\n" " image: postgres:${POSTGRES_VERSION:-15}-alpine\n" " environment:\n" -" POSTGRES_DB: app\n" -" POSTGRES_PASSWORD: password\n" -" POSTGRES_USER: user\n" +" POSTGRES_DB: app\n" +" POSTGRES_PASSWORD: password\n" +" POSTGRES_USER: user\n" " volumes:\n" -" - ./runtime/db:/var/lib/postgresql/data:rw\n" +" - ./runtime/db:/var/lib/postgresql/data:rw\n" " ports:\n" -" - \"${DEV_DB_PORT:-5432}:5432\"\n" +" - \"${DEV_DB_PORT:-5432}:5432\"\n" " healthcheck:\n" -" test: [ \"CMD-SHELL\", \"pg_isready -U user -d app\" ]\n" -" interval: 5s\n" -" timeout: 5s\n" -" retries: 5\n" +" test: [ \"CMD-SHELL\", \"pg_isready -U user -d app\" ]\n" +" interval: 5s\n" +" timeout: 5s\n" +" retries: 5\n" "\n" "volumes:\n" -" db:\n" +" db:\n" msgstr "" #. type: Plain text @@ -419,7 +419,7 @@ msgid "" " $data = (new Query($this->connection))\n" " ->select('*')\n" " ->from('{{%page}}')\n" -" ->where('slug = :slug')\n" +" ->where('slug = :slug', ['slug' => $slug])\n" " ->one();\n" "\n" " if ($data === null) {\n" @@ -429,12 +429,11 @@ msgid "" " return $this->createPage($data);\n" " }\n" "\n" -" /**\n" -" * @return iterable\n" -" */\n" +" /**\n" +" * @return iterable\n" +" */\n" " public function findAll(): iterable\n" " {\n" -"\n" " $data = (new Query($this->connection))\n" " ->select('*')\n" " ->from('{{%page}}')\n" @@ -451,9 +450,9 @@ msgid "" " id: $data['id'],\n" " title: $data['title'],\n" " text: $data['text'],\n" -" createdAt: new DateTimeImmutable($data['createdAt']),\n" -" updatedAt: new DateTimeImmutable($data['updatedAt']),\n" -" deletedAt: $data['deletedAt'] ? new DateTimeImmutable($data['deletedAt']) : null,\n" +" createdAt: new DateTimeImmutable($data['created_at']),\n" +" updatedAt: new DateTimeImmutable($data['updated_at']),\n" +" deletedAt: $data['deleted_at'] ? new DateTimeImmutable($data['deleted_at']) : null,\n" " );\n" " }\n" "\n" diff --git a/_translations/guide/po/ru/start_databases.md.po b/_translations/guide/po/ru/start_databases.md.po index aa80289..9804e7c 100644 --- a/_translations/guide/po/ru/start_databases.md.po +++ b/_translations/guide/po/ru/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-11-02 17:17+0000\n" +"POT-Creation-Date: 2025-11-03 07:09+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -50,7 +50,7 @@ msgstr "" #. type: Bullet: '- ' #: ../../guide/en/start/databases.md -msgid "[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine)" +msgid "[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine)" msgstr "" #. type: Bullet: '- ' @@ -115,9 +115,9 @@ msgid "" " USER_ID: ${UID}\n" " GROUP_ID: ${GID}\n" " env_file:\n" -" - path: ./dev/.env\n" -" - path: ./dev/override.env\n" -" required: false\n" +" - path: ./dev/.env\n" +" - path: ./dev/override.env\n" +" required: false\n" " ports:\n" " - \"${DEV_PORT:-80}:80\"\n" " volumes:\n" @@ -127,27 +127,27 @@ msgid "" " - caddy_config:/config\n" " tty: true\n" " depends_on:\n" -" db:\n" -" condition: service_healthy\n" +" db:\n" +" condition: service_healthy\n" "\n" " db:\n" " image: postgres:${POSTGRES_VERSION:-15}-alpine\n" " environment:\n" -" POSTGRES_DB: app\n" -" POSTGRES_PASSWORD: password\n" -" POSTGRES_USER: user\n" +" POSTGRES_DB: app\n" +" POSTGRES_PASSWORD: password\n" +" POSTGRES_USER: user\n" " volumes:\n" -" - ./runtime/db:/var/lib/postgresql/data:rw\n" +" - ./runtime/db:/var/lib/postgresql/data:rw\n" " ports:\n" -" - \"${DEV_DB_PORT:-5432}:5432\"\n" +" - \"${DEV_DB_PORT:-5432}:5432\"\n" " healthcheck:\n" -" test: [ \"CMD-SHELL\", \"pg_isready -U user -d app\" ]\n" -" interval: 5s\n" -" timeout: 5s\n" -" retries: 5\n" +" test: [ \"CMD-SHELL\", \"pg_isready -U user -d app\" ]\n" +" interval: 5s\n" +" timeout: 5s\n" +" retries: 5\n" "\n" "volumes:\n" -" db:\n" +" db:\n" msgstr "" #. type: Plain text @@ -423,7 +423,7 @@ msgid "" " $data = (new Query($this->connection))\n" " ->select('*')\n" " ->from('{{%page}}')\n" -" ->where('slug = :slug')\n" +" ->where('slug = :slug', ['slug' => $slug])\n" " ->one();\n" "\n" " if ($data === null) {\n" @@ -433,12 +433,11 @@ msgid "" " return $this->createPage($data);\n" " }\n" "\n" -" /**\n" -" * @return iterable\n" -" */\n" +" /**\n" +" * @return iterable\n" +" */\n" " public function findAll(): iterable\n" " {\n" -"\n" " $data = (new Query($this->connection))\n" " ->select('*')\n" " ->from('{{%page}}')\n" @@ -455,9 +454,9 @@ msgid "" " id: $data['id'],\n" " title: $data['title'],\n" " text: $data['text'],\n" -" createdAt: new DateTimeImmutable($data['createdAt']),\n" -" updatedAt: new DateTimeImmutable($data['updatedAt']),\n" -" deletedAt: $data['deletedAt'] ? new DateTimeImmutable($data['deletedAt']) : null,\n" +" createdAt: new DateTimeImmutable($data['created_at']),\n" +" updatedAt: new DateTimeImmutable($data['updated_at']),\n" +" deletedAt: $data['deleted_at'] ? new DateTimeImmutable($data['deleted_at']) : null,\n" " );\n" " }\n" "\n" diff --git a/_translations/guide/pot/start_databases.md.pot b/_translations/guide/pot/start_databases.md.pot index ef6412f..2b08824 100644 --- a/_translations/guide/pot/start_databases.md.pot +++ b/_translations/guide/pot/start_databases.md.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-11-02 17:17+0000\n" +"POT-Creation-Date: 2025-11-03 07:09+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -55,7 +55,7 @@ msgstr "" #. type: Bullet: '- ' #: ../../guide/en/start/databases.md msgid "" -"[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package]" +"[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package]" "(https://github.com/stargazer-team/yii-doctrine)" msgstr "" @@ -127,9 +127,9 @@ msgid "" " USER_ID: ${UID}\n" " GROUP_ID: ${GID}\n" " env_file:\n" -" - path: ./dev/.env\n" -" - path: ./dev/override.env\n" -" required: false\n" +" - path: ./dev/.env\n" +" - path: ./dev/override.env\n" +" required: false\n" " ports:\n" " - \"${DEV_PORT:-80}:80\"\n" " volumes:\n" @@ -139,27 +139,27 @@ msgid "" " - caddy_config:/config\n" " tty: true\n" " depends_on:\n" -" db:\n" -" condition: service_healthy\n" +" db:\n" +" condition: service_healthy\n" "\n" " db:\n" " image: postgres:${POSTGRES_VERSION:-15}-alpine\n" " environment:\n" -" POSTGRES_DB: app\n" -" POSTGRES_PASSWORD: password\n" -" POSTGRES_USER: user\n" +" POSTGRES_DB: app\n" +" POSTGRES_PASSWORD: password\n" +" POSTGRES_USER: user\n" " volumes:\n" -" - ./runtime/db:/var/lib/postgresql/data:rw\n" +" - ./runtime/db:/var/lib/postgresql/data:rw\n" " ports:\n" -" - \"${DEV_DB_PORT:-5432}:5432\"\n" +" - \"${DEV_DB_PORT:-5432}:5432\"\n" " healthcheck:\n" -" test: [ \"CMD-SHELL\", \"pg_isready -U user -d app\" ]\n" -" interval: 5s\n" -" timeout: 5s\n" -" retries: 5\n" +" test: [ \"CMD-SHELL\", \"pg_isready -U user -d app\" ]\n" +" interval: 5s\n" +" timeout: 5s\n" +" retries: 5\n" "\n" "volumes:\n" -" db:\n" +" db:\n" msgstr "" #. type: Plain text @@ -461,7 +461,7 @@ msgid "" " $data = (new Query($this->connection))\n" " ->select('*')\n" " ->from('{{%page}}')\n" -" ->where('slug = :slug')\n" +" ->where('slug = :slug', ['slug' => $slug])\n" " ->one();\n" "\n" " if ($data === null) {\n" @@ -471,12 +471,11 @@ msgid "" " return $this->createPage($data);\n" " }\n" "\n" -" /**\n" -" * @return iterable\n" -" */\n" +" /**\n" +" * @return iterable\n" +" */\n" " public function findAll(): iterable\n" " {\n" -"\n" " $data = (new Query($this->connection))\n" " ->select('*')\n" " ->from('{{%page}}')\n" @@ -493,9 +492,9 @@ msgid "" " id: $data['id'],\n" " title: $data['title'],\n" " text: $data['text'],\n" -" createdAt: new DateTimeImmutable($data['createdAt']),\n" -" updatedAt: new DateTimeImmutable($data['updatedAt']),\n" -" deletedAt: $data['deletedAt'] ? new DateTimeImmutable($data['deletedAt']) : null,\n" +" createdAt: new DateTimeImmutable($data['created_at']),\n" +" updatedAt: new DateTimeImmutable($data['updated_at']),\n" +" deletedAt: $data['deleted_at'] ? new DateTimeImmutable($data['deleted_at']) : null,\n" " );\n" " }\n" "\n" diff --git a/guide/es/start/databases.md b/guide/es/start/databases.md index 55fbf81..30267c8 100644 --- a/guide/es/start/databases.md +++ b/guide/es/start/databases.md @@ -7,7 +7,7 @@ application. There are many ways you can work with relational databases: - [Yii Active Record](https://github.com/yiisoft/active-record) - [Cycle](https://github.com/cycle) via [Yii Cycle package](https://github.com/yiisoft/yii-cycle) -- [Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine +- [Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine) - [PDO](https://www.php.net/manual/en/book.pdo.php) @@ -29,7 +29,6 @@ install it and create a database. If you use Docker, it is a bit simpler. Modify `docker/dev/compose.yml`: - ```yaml services: app: @@ -41,9 +40,9 @@ services: USER_ID: ${UID} GROUP_ID: ${GID} env_file: - - path: ./dev/.env - - path: ./dev/override.env - required: false + - path: ./dev/.env + - path: ./dev/override.env + required: false ports: - "${DEV_PORT:-80}:80" volumes: @@ -53,27 +52,27 @@ services: - caddy_config:/config tty: true depends_on: - db: - condition: service_healthy + db: + condition: service_healthy db: image: postgres:${POSTGRES_VERSION:-15}-alpine environment: - POSTGRES_DB: app - POSTGRES_PASSWORD: password - POSTGRES_USER: user + POSTGRES_DB: app + POSTGRES_PASSWORD: password + POSTGRES_USER: user volumes: - - ./runtime/db:/var/lib/postgresql/data:rw + - ./runtime/db:/var/lib/postgresql/data:rw ports: - - "${DEV_DB_PORT:-5432}:5432" + - "${DEV_DB_PORT:-5432}:5432" healthcheck: - test: [ "CMD-SHELL", "pg_isready -U user -d app" ] - interval: 5s - timeout: 5s - retries: 5 + test: [ "CMD-SHELL", "pg_isready -U user -d app" ] + interval: 5s + timeout: 5s + retries: 5 volumes: - db: + db: ``` Note that we add `depends_on` so application waits for database to be up. @@ -284,7 +283,7 @@ final readonly class PageRepository $data = (new Query($this->connection)) ->select('*') ->from('{{%page}}') - ->where('slug = :slug') + ->where('slug = :slug', ['slug' => $slug]) ->one(); if ($data === null) { @@ -294,12 +293,11 @@ final readonly class PageRepository return $this->createPage($data); } - /** - * @return iterable - */ + /** + * @return iterable + */ public function findAll(): iterable { - $data = (new Query($this->connection)) ->select('*') ->from('{{%page}}') @@ -316,9 +314,9 @@ final readonly class PageRepository id: $data['id'], title: $data['title'], text: $data['text'], - createdAt: new DateTimeImmutable($data['createdAt']), - updatedAt: new DateTimeImmutable($data['updatedAt']), - deletedAt: $data['deletedAt'] ? new DateTimeImmutable($data['deletedAt']) : null, + createdAt: new DateTimeImmutable($data['created_at']), + updatedAt: new DateTimeImmutable($data['updated_at']), + deletedAt: $data['deleted_at'] ? new DateTimeImmutable($data['deleted_at']) : null, ); } @@ -339,8 +337,6 @@ You need actions to: 4. Create a page. 5. Edit a page. - - > [!NOTE] > [← Working with forms](forms.md) | > [Generating code with Gii →](gii.md) diff --git a/guide/id/start/databases.md b/guide/id/start/databases.md index 55fbf81..30267c8 100644 --- a/guide/id/start/databases.md +++ b/guide/id/start/databases.md @@ -7,7 +7,7 @@ application. There are many ways you can work with relational databases: - [Yii Active Record](https://github.com/yiisoft/active-record) - [Cycle](https://github.com/cycle) via [Yii Cycle package](https://github.com/yiisoft/yii-cycle) -- [Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine +- [Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine) - [PDO](https://www.php.net/manual/en/book.pdo.php) @@ -29,7 +29,6 @@ install it and create a database. If you use Docker, it is a bit simpler. Modify `docker/dev/compose.yml`: - ```yaml services: app: @@ -41,9 +40,9 @@ services: USER_ID: ${UID} GROUP_ID: ${GID} env_file: - - path: ./dev/.env - - path: ./dev/override.env - required: false + - path: ./dev/.env + - path: ./dev/override.env + required: false ports: - "${DEV_PORT:-80}:80" volumes: @@ -53,27 +52,27 @@ services: - caddy_config:/config tty: true depends_on: - db: - condition: service_healthy + db: + condition: service_healthy db: image: postgres:${POSTGRES_VERSION:-15}-alpine environment: - POSTGRES_DB: app - POSTGRES_PASSWORD: password - POSTGRES_USER: user + POSTGRES_DB: app + POSTGRES_PASSWORD: password + POSTGRES_USER: user volumes: - - ./runtime/db:/var/lib/postgresql/data:rw + - ./runtime/db:/var/lib/postgresql/data:rw ports: - - "${DEV_DB_PORT:-5432}:5432" + - "${DEV_DB_PORT:-5432}:5432" healthcheck: - test: [ "CMD-SHELL", "pg_isready -U user -d app" ] - interval: 5s - timeout: 5s - retries: 5 + test: [ "CMD-SHELL", "pg_isready -U user -d app" ] + interval: 5s + timeout: 5s + retries: 5 volumes: - db: + db: ``` Note that we add `depends_on` so application waits for database to be up. @@ -284,7 +283,7 @@ final readonly class PageRepository $data = (new Query($this->connection)) ->select('*') ->from('{{%page}}') - ->where('slug = :slug') + ->where('slug = :slug', ['slug' => $slug]) ->one(); if ($data === null) { @@ -294,12 +293,11 @@ final readonly class PageRepository return $this->createPage($data); } - /** - * @return iterable - */ + /** + * @return iterable + */ public function findAll(): iterable { - $data = (new Query($this->connection)) ->select('*') ->from('{{%page}}') @@ -316,9 +314,9 @@ final readonly class PageRepository id: $data['id'], title: $data['title'], text: $data['text'], - createdAt: new DateTimeImmutable($data['createdAt']), - updatedAt: new DateTimeImmutable($data['updatedAt']), - deletedAt: $data['deletedAt'] ? new DateTimeImmutable($data['deletedAt']) : null, + createdAt: new DateTimeImmutable($data['created_at']), + updatedAt: new DateTimeImmutable($data['updated_at']), + deletedAt: $data['deleted_at'] ? new DateTimeImmutable($data['deleted_at']) : null, ); } @@ -339,8 +337,6 @@ You need actions to: 4. Create a page. 5. Edit a page. - - > [!NOTE] > [← Working with forms](forms.md) | > [Generating code with Gii →](gii.md) diff --git a/guide/ru/start/databases.md b/guide/ru/start/databases.md index 55fbf81..30267c8 100644 --- a/guide/ru/start/databases.md +++ b/guide/ru/start/databases.md @@ -7,7 +7,7 @@ application. There are many ways you can work with relational databases: - [Yii Active Record](https://github.com/yiisoft/active-record) - [Cycle](https://github.com/cycle) via [Yii Cycle package](https://github.com/yiisoft/yii-cycle) -- [Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine +- [Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine) - [PDO](https://www.php.net/manual/en/book.pdo.php) @@ -29,7 +29,6 @@ install it and create a database. If you use Docker, it is a bit simpler. Modify `docker/dev/compose.yml`: - ```yaml services: app: @@ -41,9 +40,9 @@ services: USER_ID: ${UID} GROUP_ID: ${GID} env_file: - - path: ./dev/.env - - path: ./dev/override.env - required: false + - path: ./dev/.env + - path: ./dev/override.env + required: false ports: - "${DEV_PORT:-80}:80" volumes: @@ -53,27 +52,27 @@ services: - caddy_config:/config tty: true depends_on: - db: - condition: service_healthy + db: + condition: service_healthy db: image: postgres:${POSTGRES_VERSION:-15}-alpine environment: - POSTGRES_DB: app - POSTGRES_PASSWORD: password - POSTGRES_USER: user + POSTGRES_DB: app + POSTGRES_PASSWORD: password + POSTGRES_USER: user volumes: - - ./runtime/db:/var/lib/postgresql/data:rw + - ./runtime/db:/var/lib/postgresql/data:rw ports: - - "${DEV_DB_PORT:-5432}:5432" + - "${DEV_DB_PORT:-5432}:5432" healthcheck: - test: [ "CMD-SHELL", "pg_isready -U user -d app" ] - interval: 5s - timeout: 5s - retries: 5 + test: [ "CMD-SHELL", "pg_isready -U user -d app" ] + interval: 5s + timeout: 5s + retries: 5 volumes: - db: + db: ``` Note that we add `depends_on` so application waits for database to be up. @@ -284,7 +283,7 @@ final readonly class PageRepository $data = (new Query($this->connection)) ->select('*') ->from('{{%page}}') - ->where('slug = :slug') + ->where('slug = :slug', ['slug' => $slug]) ->one(); if ($data === null) { @@ -294,12 +293,11 @@ final readonly class PageRepository return $this->createPage($data); } - /** - * @return iterable - */ + /** + * @return iterable + */ public function findAll(): iterable { - $data = (new Query($this->connection)) ->select('*') ->from('{{%page}}') @@ -316,9 +314,9 @@ final readonly class PageRepository id: $data['id'], title: $data['title'], text: $data['text'], - createdAt: new DateTimeImmutable($data['createdAt']), - updatedAt: new DateTimeImmutable($data['updatedAt']), - deletedAt: $data['deletedAt'] ? new DateTimeImmutable($data['deletedAt']) : null, + createdAt: new DateTimeImmutable($data['created_at']), + updatedAt: new DateTimeImmutable($data['updated_at']), + deletedAt: $data['deleted_at'] ? new DateTimeImmutable($data['deleted_at']) : null, ); } @@ -339,8 +337,6 @@ You need actions to: 4. Create a page. 5. Edit a page. - - > [!NOTE] > [← Working with forms](forms.md) | > [Generating code with Gii →](gii.md) From 47337042fc35af0a3925c638d60d66831693410d Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Mon, 3 Nov 2025 15:40:23 +0300 Subject: [PATCH 14/16] Use latest versions --- guide/en/start/databases.md | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/guide/en/start/databases.md b/guide/en/start/databases.md index b828b1b..d866298 100644 --- a/guide/en/start/databases.md +++ b/guide/en/start/databases.md @@ -80,10 +80,14 @@ PHP image with `make build && make down && make up`. ## Configuring connection -Now that we have the database, it's time to define the connection. We need a package to be installed first: +Now that we have the database, it's time to define the connection. + +Let's use latest versions to be released. Change your `minumum-stability` to `dev` in `composer.json` first. + +Then we need a package to be installed: ```sh -make composer require yiisoft/db-pgsql +make composer require yiisoft/db-pgsql dev-master ``` Now create `config/common/di/db-pgsql.php`: @@ -140,7 +144,7 @@ the current state and which migrations remain to be applied. To use migrations we need another package installed: ```sh -composer require yiisoft/db-migration +composer require yiisoft/db-migration dev-master ``` Create a directory to store migrations `src/Migration` right in the project root. Add the following configuration to @@ -173,14 +177,16 @@ final class M251102141707Page implements RevertibleMigrationInterface { public function up(MigrationBuilder $b): void { + $cb = $b->columnBuilder(); + $b->createTable('page', [ - 'id' => $b->uuidPrimaryKey(), - 'title' => $b->string()->notNull(), - 'slug' => $b->string()->notNull(), - 'text' => $b->text()->notNull(), - 'created_at' => $b->dateTime()->notNull(), - 'updated_at' => $b->dateTime(), - 'deleted_at' => $b->dateTime(), + 'id' => $cb::uuidPrimaryKey(), + 'title' => $cb::string()->notNull(), + 'slug' => $cb::string()->notNull(), + 'text' => $cb::text()->notNull(), + 'created_at' => $cb::dateTime(), + 'updated_at' => $cb::dateTime(), + 'deleted_at' => $cb::dateTime(), ]); } From 6311b008643d296d63b0e4656534fdca333c905b Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Mon, 3 Nov 2025 15:47:46 +0300 Subject: [PATCH 15/16] Adjust DTO and repository --- guide/en/start/databases.md | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/guide/en/start/databases.md b/guide/en/start/databases.md index d866298..14de80c 100644 --- a/guide/en/start/databases.md +++ b/guide/en/start/databases.md @@ -6,8 +6,7 @@ There are many ways you can work with relational databases: - [Yii DB](https://github.com/yiisoft/db) - [Yii Active Record](https://github.com/yiisoft/active-record) - [Cycle](https://github.com/cycle) via [Yii Cycle package](https://github.com/yiisoft/yii-cycle) -- [Doctrine](https://www.doctrine-project.org/) - via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine) +- [Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine) - [PDO](https://www.php.net/manual/en/book.pdo.php) For non-relational ones, there are usually official libraries available: @@ -217,15 +216,33 @@ use Yiisoft\Strings\Inflector; final readonly class Page { - public function __construct( + private function __construct( public string $id, public string $title, public string $text, - public DateTimeImmutable $createdAt = new DateTimeImmutable(), - public DateTimeImmutable $updatedAt = new DateTimeImmutable(), + public DateTimeImmutable $createdAt, + public DateTimeImmutable $updatedAt, public ?DateTimeImmutable $deletedAt = null, ) {} + public static function create( + string $id, + string $title, + string $text, + ?DateTimeImmutable $createdAt = null, + ?DateTimeImmutable $updatedAt = null, + ?DateTimeImmutable $deletedAt = null, + ): self { + return new self( + id: $id, + title: $title, + text: $text, + createdAt: $createdAt ?? new DateTimeImmutable(), + updatedAt: $updatedAt ?? new DateTimeImmutable(), + deletedAt: $deletedAt, + ); + } + public function getSlug(): string { return (new Inflector())->toSlug($this->title); @@ -305,7 +322,7 @@ final readonly class PageRepository private function createPage(array $data): Page { - return new Page( + return Page::create( id: $data['id'], title: $data['title'], text: $data['text'], From 3a35f526a0abc91e1964057ce4607c60873ab630 Mon Sep 17 00:00:00 2001 From: samdark <47294+samdark@users.noreply.github.com> Date: Mon, 3 Nov 2025 12:48:38 +0000 Subject: [PATCH 16/16] Update translation --- .../guide/po/es/databases_db-migrations.md.po | 6 +- .../guide/po/es/start_databases.md.po | 72 ++++++++++++------ .../guide/po/id/databases_db-migrations.md.po | 6 +- .../guide/po/id/start_databases.md.po | 73 ++++++++++++------ .../guide/po/ru/databases_db-migrations.md.po | 6 +- .../guide/po/ru/start_databases.md.po | 72 ++++++++++++------ .../guide/pot/databases_db-migrations.md.pot | 6 +- .../guide/pot/start_databases.md.pot | 74 +++++++++++++------ guide/es/start/databases.md | 56 ++++++++++---- guide/id/start/databases.md | 56 ++++++++++---- guide/ru/start/databases.md | 56 ++++++++++---- 11 files changed, 338 insertions(+), 145 deletions(-) diff --git a/_translations/guide/po/es/databases_db-migrations.md.po b/_translations/guide/po/es/databases_db-migrations.md.po index ebcc007..007c226 100644 --- a/_translations/guide/po/es/databases_db-migrations.md.po +++ b/_translations/guide/po/es/databases_db-migrations.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-10-22 11:35+0000\n" +"POT-Creation-Date: 2025-11-03 12:48+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -27,8 +27,8 @@ msgstr "" msgid "To use migrations, install [yiisoft/db-migration](https://github.com/yiisoft/db-migration/) package:" msgstr "" -#. type: Fenced code block (sh) -#: ../../guide/en/databases/db-migrations.md ../../guide/en/start/databases.md +#. type: Fenced code block (shell) +#: ../../guide/en/databases/db-migrations.md #, no-wrap msgid "composer require yiisoft/db-migration\n" msgstr "" diff --git a/_translations/guide/po/es/start_databases.md.po b/_translations/guide/po/es/start_databases.md.po index 0987f2a..972ac95 100644 --- a/_translations/guide/po/es/start_databases.md.po +++ b/_translations/guide/po/es/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-11-03 07:09+0000\n" +"POT-Creation-Date: 2025-11-03 12:48+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -22,12 +22,6 @@ msgstr "" msgid "Working with databases" msgstr "" -#. type: Fenced code block (sh) -#: ../../guide/en/databases/db-migrations.md ../../guide/en/start/databases.md -#, no-wrap -msgid "composer require yiisoft/db-migration\n" -msgstr "" - #. type: Plain text #: ../../guide/en/start/databases.md msgid "Yii doesn't dictate using a particular database or storage for your application. There are many ways you can work with relational databases:" @@ -50,7 +44,7 @@ msgstr "" #. type: Bullet: '- ' #: ../../guide/en/start/databases.md -msgid "[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine)" +msgid "[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine)" msgstr "" #. type: Bullet: '- ' @@ -166,13 +160,23 @@ msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "Now that we have the database, it's time to define the connection. We need a package to be installed first:" +msgid "Now that we have the database, it's time to define the connection." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Let's use latest versions to be released. Change your `minumum-stability` to `dev` in `composer.json` first." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Then we need a package to be installed:" msgstr "" #. type: Fenced code block (sh) #: ../../guide/en/start/databases.md #, no-wrap -msgid "make composer require yiisoft/db-pgsql\n" +msgid "make composer require yiisoft/db-pgsql dev-master\n" msgstr "" #. type: Plain text @@ -253,6 +257,12 @@ msgstr "" msgid "To use migrations we need another package installed:" msgstr "" +#. type: Fenced code block (sh) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "composer require yiisoft/db-migration dev-master\n" +msgstr "" + #. type: Plain text #: ../../guide/en/start/databases.md msgid "Create a directory to store migrations `src/Migration` right in the project root. Add the following configuration to `config/common/params.php`:" @@ -293,14 +303,16 @@ msgid "" "{\n" " public function up(MigrationBuilder $b): void\n" " {\n" +" $cb = $b->columnBuilder();\n" +"\n" " $b->createTable('page', [\n" -" 'id' => $b->uuidPrimaryKey(),\n" -" 'title' => $b->string()->notNull(),\n" -" 'slug' => $b->string()->notNull(),\n" -" 'text' => $b->text()->notNull(),\n" -" 'created_at' => $b->dateTime()->notNull(),\n" -" 'updated_at' => $b->dateTime(),\n" -" 'deleted_at' => $b->dateTime(),\n" +" 'id' => $cb::uuidPrimaryKey(),\n" +" 'title' => $cb::string()->notNull(),\n" +" 'slug' => $cb::string()->notNull(),\n" +" 'text' => $cb::text()->notNull(),\n" +" 'created_at' => $cb::dateTime(),\n" +" 'updated_at' => $cb::dateTime(),\n" +" 'deleted_at' => $cb::dateTime(),\n" " ]);\n" " }\n" "\n" @@ -345,15 +357,33 @@ msgid "" "\n" "final readonly class Page\n" "{\n" -" public function __construct(\n" +" private function __construct(\n" " public string $id,\n" " public string $title,\n" " public string $text,\n" -" public DateTimeImmutable $createdAt = new DateTimeImmutable(),\n" -" public DateTimeImmutable $updatedAt = new DateTimeImmutable(),\n" +" public DateTimeImmutable $createdAt,\n" +" public DateTimeImmutable $updatedAt,\n" " public ?DateTimeImmutable $deletedAt = null,\n" " ) {}\n" "\n" +" public static function create(\n" +" string $id,\n" +" string $title,\n" +" string $text,\n" +" ?DateTimeImmutable $createdAt = null,\n" +" ?DateTimeImmutable $updatedAt = null,\n" +" ?DateTimeImmutable $deletedAt = null,\n" +" ): self {\n" +" return new self(\n" +" id: $id,\n" +" title: $title,\n" +" text: $text,\n" +" createdAt: $createdAt ?? new DateTimeImmutable(),\n" +" updatedAt: $updatedAt ?? new DateTimeImmutable(),\n" +" deletedAt: $deletedAt,\n" +" );\n" +" }\n" +"\n" " public function getSlug(): string\n" " {\n" " return (new Inflector())->toSlug($this->title);\n" @@ -446,7 +476,7 @@ msgid "" "\n" " private function createPage(array $data): Page\n" " {\n" -" return new Page(\n" +" return Page::create(\n" " id: $data['id'],\n" " title: $data['title'],\n" " text: $data['text'],\n" diff --git a/_translations/guide/po/id/databases_db-migrations.md.po b/_translations/guide/po/id/databases_db-migrations.md.po index 144e6e8..c9dc03f 100644 --- a/_translations/guide/po/id/databases_db-migrations.md.po +++ b/_translations/guide/po/id/databases_db-migrations.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-10-22 11:35+0000\n" +"POT-Creation-Date: 2025-11-03 12:48+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -26,8 +26,8 @@ msgstr "" msgid "To use migrations, install [yiisoft/db-migration](https://github.com/yiisoft/db-migration/) package:" msgstr "" -#. type: Fenced code block (sh) -#: ../../guide/en/databases/db-migrations.md ../../guide/en/start/databases.md +#. type: Fenced code block (shell) +#: ../../guide/en/databases/db-migrations.md #, no-wrap msgid "composer require yiisoft/db-migration\n" msgstr "" diff --git a/_translations/guide/po/id/start_databases.md.po b/_translations/guide/po/id/start_databases.md.po index 588960b..cb55854 100644 --- a/_translations/guide/po/id/start_databases.md.po +++ b/_translations/guide/po/id/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-11-03 07:09+0000\n" +"POT-Creation-Date: 2025-11-03 12:48+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -21,12 +21,6 @@ msgstr "" msgid "Working with databases" msgstr "" -#. type: Fenced code block (sh) -#: ../../guide/en/databases/db-migrations.md ../../guide/en/start/databases.md -#, no-wrap -msgid "composer require yiisoft/db-migration\n" -msgstr "" - #. type: Plain text #: ../../guide/en/start/databases.md msgid "Yii doesn't dictate using a particular database or storage for your application. There are many ways you can work with relational databases:" @@ -49,7 +43,7 @@ msgstr "" #. type: Bullet: '- ' #: ../../guide/en/start/databases.md -msgid "[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine)" +msgid "[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine)" msgstr "" #. type: Bullet: '- ' @@ -165,14 +159,24 @@ msgstr "" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "Now that we have the database, it's time to define the connection. We need a package to be installed first:" +msgid "Now that we have the database, it's time to define the connection." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Let's use latest versions to be released. Change your `minumum-stability` to `dev` in `composer.json` first." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Then we need a package to be installed:" msgstr "" #. type: Fenced code block (sh) #: ../../guide/en/start/databases.md #, fuzzy, no-wrap #| msgid "composer require yiisoft/cache\n" -msgid "make composer require yiisoft/db-pgsql\n" +msgid "make composer require yiisoft/db-pgsql dev-master\n" msgstr "composer require yiisoft/cache\n" #. type: Plain text @@ -253,6 +257,13 @@ msgstr "" msgid "To use migrations we need another package installed:" msgstr "" +#. type: Fenced code block (sh) +#: ../../guide/en/start/databases.md +#, fuzzy, no-wrap +#| msgid "composer require yiisoft/cache\n" +msgid "composer require yiisoft/db-migration dev-master\n" +msgstr "composer require yiisoft/cache\n" + #. type: Plain text #: ../../guide/en/start/databases.md msgid "Create a directory to store migrations `src/Migration` right in the project root. Add the following configuration to `config/common/params.php`:" @@ -293,14 +304,16 @@ msgid "" "{\n" " public function up(MigrationBuilder $b): void\n" " {\n" +" $cb = $b->columnBuilder();\n" +"\n" " $b->createTable('page', [\n" -" 'id' => $b->uuidPrimaryKey(),\n" -" 'title' => $b->string()->notNull(),\n" -" 'slug' => $b->string()->notNull(),\n" -" 'text' => $b->text()->notNull(),\n" -" 'created_at' => $b->dateTime()->notNull(),\n" -" 'updated_at' => $b->dateTime(),\n" -" 'deleted_at' => $b->dateTime(),\n" +" 'id' => $cb::uuidPrimaryKey(),\n" +" 'title' => $cb::string()->notNull(),\n" +" 'slug' => $cb::string()->notNull(),\n" +" 'text' => $cb::text()->notNull(),\n" +" 'created_at' => $cb::dateTime(),\n" +" 'updated_at' => $cb::dateTime(),\n" +" 'deleted_at' => $cb::dateTime(),\n" " ]);\n" " }\n" "\n" @@ -345,15 +358,33 @@ msgid "" "\n" "final readonly class Page\n" "{\n" -" public function __construct(\n" +" private function __construct(\n" " public string $id,\n" " public string $title,\n" " public string $text,\n" -" public DateTimeImmutable $createdAt = new DateTimeImmutable(),\n" -" public DateTimeImmutable $updatedAt = new DateTimeImmutable(),\n" +" public DateTimeImmutable $createdAt,\n" +" public DateTimeImmutable $updatedAt,\n" " public ?DateTimeImmutable $deletedAt = null,\n" " ) {}\n" "\n" +" public static function create(\n" +" string $id,\n" +" string $title,\n" +" string $text,\n" +" ?DateTimeImmutable $createdAt = null,\n" +" ?DateTimeImmutable $updatedAt = null,\n" +" ?DateTimeImmutable $deletedAt = null,\n" +" ): self {\n" +" return new self(\n" +" id: $id,\n" +" title: $title,\n" +" text: $text,\n" +" createdAt: $createdAt ?? new DateTimeImmutable(),\n" +" updatedAt: $updatedAt ?? new DateTimeImmutable(),\n" +" deletedAt: $deletedAt,\n" +" );\n" +" }\n" +"\n" " public function getSlug(): string\n" " {\n" " return (new Inflector())->toSlug($this->title);\n" @@ -446,7 +477,7 @@ msgid "" "\n" " private function createPage(array $data): Page\n" " {\n" -" return new Page(\n" +" return Page::create(\n" " id: $data['id'],\n" " title: $data['title'],\n" " text: $data['text'],\n" diff --git a/_translations/guide/po/ru/databases_db-migrations.md.po b/_translations/guide/po/ru/databases_db-migrations.md.po index 952e080..545975f 100644 --- a/_translations/guide/po/ru/databases_db-migrations.md.po +++ b/_translations/guide/po/ru/databases_db-migrations.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-10-22 11:35+0000\n" +"POT-Creation-Date: 2025-11-03 12:48+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -27,8 +27,8 @@ msgstr "" msgid "To use migrations, install [yiisoft/db-migration](https://github.com/yiisoft/db-migration/) package:" msgstr "" -#. type: Fenced code block (sh) -#: ../../guide/en/databases/db-migrations.md ../../guide/en/start/databases.md +#. type: Fenced code block (shell) +#: ../../guide/en/databases/db-migrations.md #, fuzzy, no-wrap msgid "composer require yiisoft/db-migration\n" msgstr "composer install yiisoft/security\n" diff --git a/_translations/guide/po/ru/start_databases.md.po b/_translations/guide/po/ru/start_databases.md.po index 9804e7c..ee2cfe4 100644 --- a/_translations/guide/po/ru/start_databases.md.po +++ b/_translations/guide/po/ru/start_databases.md.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-11-03 07:09+0000\n" +"POT-Creation-Date: 2025-11-03 12:48+0000\n" "PO-Revision-Date: 2025-09-04 11:19+0500\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -22,12 +22,6 @@ msgstr "" msgid "Working with databases" msgstr "" -#. type: Fenced code block (sh) -#: ../../guide/en/databases/db-migrations.md ../../guide/en/start/databases.md -#, fuzzy, no-wrap -msgid "composer require yiisoft/db-migration\n" -msgstr "composer install yiisoft/security\n" - #. type: Plain text #: ../../guide/en/start/databases.md msgid "Yii doesn't dictate using a particular database or storage for your application. There are many ways you can work with relational databases:" @@ -50,7 +44,7 @@ msgstr "" #. type: Bullet: '- ' #: ../../guide/en/start/databases.md -msgid "[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine)" +msgid "[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine)" msgstr "" #. type: Bullet: '- ' @@ -169,14 +163,24 @@ msgstr "Настройка проверки SSL-сертификата" #. type: Plain text #: ../../guide/en/start/databases.md -msgid "Now that we have the database, it's time to define the connection. We need a package to be installed first:" +msgid "Now that we have the database, it's time to define the connection." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Let's use latest versions to be released. Change your `minumum-stability` to `dev` in `composer.json` first." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Then we need a package to be installed:" msgstr "" #. type: Fenced code block (sh) #: ../../guide/en/start/databases.md #, fuzzy, no-wrap #| msgid "composer install yiisoft/security\n" -msgid "make composer require yiisoft/db-pgsql\n" +msgid "make composer require yiisoft/db-pgsql dev-master\n" msgstr "composer install yiisoft/security\n" #. type: Plain text @@ -257,6 +261,12 @@ msgstr "" msgid "To use migrations we need another package installed:" msgstr "" +#. type: Fenced code block (sh) +#: ../../guide/en/start/databases.md +#, fuzzy, no-wrap +msgid "composer require yiisoft/db-migration dev-master\n" +msgstr "composer install yiisoft/security\n" + #. type: Plain text #: ../../guide/en/start/databases.md msgid "Create a directory to store migrations `src/Migration` right in the project root. Add the following configuration to `config/common/params.php`:" @@ -297,14 +307,16 @@ msgid "" "{\n" " public function up(MigrationBuilder $b): void\n" " {\n" +" $cb = $b->columnBuilder();\n" +"\n" " $b->createTable('page', [\n" -" 'id' => $b->uuidPrimaryKey(),\n" -" 'title' => $b->string()->notNull(),\n" -" 'slug' => $b->string()->notNull(),\n" -" 'text' => $b->text()->notNull(),\n" -" 'created_at' => $b->dateTime()->notNull(),\n" -" 'updated_at' => $b->dateTime(),\n" -" 'deleted_at' => $b->dateTime(),\n" +" 'id' => $cb::uuidPrimaryKey(),\n" +" 'title' => $cb::string()->notNull(),\n" +" 'slug' => $cb::string()->notNull(),\n" +" 'text' => $cb::text()->notNull(),\n" +" 'created_at' => $cb::dateTime(),\n" +" 'updated_at' => $cb::dateTime(),\n" +" 'deleted_at' => $cb::dateTime(),\n" " ]);\n" " }\n" "\n" @@ -349,15 +361,33 @@ msgid "" "\n" "final readonly class Page\n" "{\n" -" public function __construct(\n" +" private function __construct(\n" " public string $id,\n" " public string $title,\n" " public string $text,\n" -" public DateTimeImmutable $createdAt = new DateTimeImmutable(),\n" -" public DateTimeImmutable $updatedAt = new DateTimeImmutable(),\n" +" public DateTimeImmutable $createdAt,\n" +" public DateTimeImmutable $updatedAt,\n" " public ?DateTimeImmutable $deletedAt = null,\n" " ) {}\n" "\n" +" public static function create(\n" +" string $id,\n" +" string $title,\n" +" string $text,\n" +" ?DateTimeImmutable $createdAt = null,\n" +" ?DateTimeImmutable $updatedAt = null,\n" +" ?DateTimeImmutable $deletedAt = null,\n" +" ): self {\n" +" return new self(\n" +" id: $id,\n" +" title: $title,\n" +" text: $text,\n" +" createdAt: $createdAt ?? new DateTimeImmutable(),\n" +" updatedAt: $updatedAt ?? new DateTimeImmutable(),\n" +" deletedAt: $deletedAt,\n" +" );\n" +" }\n" +"\n" " public function getSlug(): string\n" " {\n" " return (new Inflector())->toSlug($this->title);\n" @@ -450,7 +480,7 @@ msgid "" "\n" " private function createPage(array $data): Page\n" " {\n" -" return new Page(\n" +" return Page::create(\n" " id: $data['id'],\n" " title: $data['title'],\n" " text: $data['text'],\n" diff --git a/_translations/guide/pot/databases_db-migrations.md.pot b/_translations/guide/pot/databases_db-migrations.md.pot index e71d6c2..f263633 100644 --- a/_translations/guide/pot/databases_db-migrations.md.pot +++ b/_translations/guide/pot/databases_db-migrations.md.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-10-22 11:35+0000\n" +"POT-Creation-Date: 2025-11-03 12:48+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -29,8 +29,8 @@ msgid "" "db-migration/) package:" msgstr "" -#. type: Fenced code block (sh) -#: ../../guide/en/databases/db-migrations.md ../../guide/en/start/databases.md +#. type: Fenced code block (shell) +#: ../../guide/en/databases/db-migrations.md #, no-wrap msgid "composer require yiisoft/db-migration\n" msgstr "" diff --git a/_translations/guide/pot/start_databases.md.pot b/_translations/guide/pot/start_databases.md.pot index 2b08824..52b4225 100644 --- a/_translations/guide/pot/start_databases.md.pot +++ b/_translations/guide/pot/start_databases.md.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2025-11-03 07:09+0000\n" +"POT-Creation-Date: 2025-11-03 12:48+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -22,12 +22,6 @@ msgstr "" msgid "Working with databases" msgstr "" -#. type: Fenced code block (sh) -#: ../../guide/en/databases/db-migrations.md ../../guide/en/start/databases.md -#, no-wrap -msgid "composer require yiisoft/db-migration\n" -msgstr "" - #. type: Plain text #: ../../guide/en/start/databases.md msgid "" @@ -55,7 +49,7 @@ msgstr "" #. type: Bullet: '- ' #: ../../guide/en/start/databases.md msgid "" -"[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package]" +"[Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package]" "(https://github.com/stargazer-team/yii-doctrine)" msgstr "" @@ -183,17 +177,27 @@ msgstr "" msgid "Configuring connection" msgstr "" +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Now that we have the database, it's time to define the connection." +msgstr "" + #. type: Plain text #: ../../guide/en/start/databases.md msgid "" -"Now that we have the database, it's time to define the connection. We need a " -"package to be installed first:" +"Let's use latest versions to be released. Change your `minumum-stability` to " +"`dev` in `composer.json` first." +msgstr "" + +#. type: Plain text +#: ../../guide/en/start/databases.md +msgid "Then we need a package to be installed:" msgstr "" #. type: Fenced code block (sh) #: ../../guide/en/start/databases.md #, no-wrap -msgid "make composer require yiisoft/db-pgsql\n" +msgid "make composer require yiisoft/db-pgsql dev-master\n" msgstr "" #. type: Plain text @@ -282,6 +286,12 @@ msgstr "" msgid "To use migrations we need another package installed:" msgstr "" +#. type: Fenced code block (sh) +#: ../../guide/en/start/databases.md +#, no-wrap +msgid "composer require yiisoft/db-migration dev-master\n" +msgstr "" + #. type: Plain text #: ../../guide/en/start/databases.md msgid "" @@ -326,14 +336,16 @@ msgid "" "{\n" " public function up(MigrationBuilder $b): void\n" " {\n" +" $cb = $b->columnBuilder();\n" +"\n" " $b->createTable('page', [\n" -" 'id' => $b->uuidPrimaryKey(),\n" -" 'title' => $b->string()->notNull(),\n" -" 'slug' => $b->string()->notNull(),\n" -" 'text' => $b->text()->notNull(),\n" -" 'created_at' => $b->dateTime()->notNull(),\n" -" 'updated_at' => $b->dateTime(),\n" -" 'deleted_at' => $b->dateTime(),\n" +" 'id' => $cb::uuidPrimaryKey(),\n" +" 'title' => $cb::string()->notNull(),\n" +" 'slug' => $cb::string()->notNull(),\n" +" 'text' => $cb::text()->notNull(),\n" +" 'created_at' => $cb::dateTime(),\n" +" 'updated_at' => $cb::dateTime(),\n" +" 'deleted_at' => $cb::dateTime(),\n" " ]);\n" " }\n" "\n" @@ -385,15 +397,33 @@ msgid "" "\n" "final readonly class Page\n" "{\n" -" public function __construct(\n" +" private function __construct(\n" " public string $id,\n" " public string $title,\n" " public string $text,\n" -" public DateTimeImmutable $createdAt = new DateTimeImmutable(),\n" -" public DateTimeImmutable $updatedAt = new DateTimeImmutable(),\n" +" public DateTimeImmutable $createdAt,\n" +" public DateTimeImmutable $updatedAt,\n" " public ?DateTimeImmutable $deletedAt = null,\n" " ) {}\n" "\n" +" public static function create(\n" +" string $id,\n" +" string $title,\n" +" string $text,\n" +" ?DateTimeImmutable $createdAt = null,\n" +" ?DateTimeImmutable $updatedAt = null,\n" +" ?DateTimeImmutable $deletedAt = null,\n" +" ): self {\n" +" return new self(\n" +" id: $id,\n" +" title: $title,\n" +" text: $text,\n" +" createdAt: $createdAt ?? new DateTimeImmutable(),\n" +" updatedAt: $updatedAt ?? new DateTimeImmutable(),\n" +" deletedAt: $deletedAt,\n" +" );\n" +" }\n" +"\n" " public function getSlug(): string\n" " {\n" " return (new Inflector())->toSlug($this->title);\n" @@ -488,7 +518,7 @@ msgid "" "\n" " private function createPage(array $data): Page\n" " {\n" -" return new Page(\n" +" return Page::create(\n" " id: $data['id'],\n" " title: $data['title'],\n" " text: $data['text'],\n" diff --git a/guide/es/start/databases.md b/guide/es/start/databases.md index 30267c8..0bd840e 100644 --- a/guide/es/start/databases.md +++ b/guide/es/start/databases.md @@ -7,7 +7,7 @@ application. There are many ways you can work with relational databases: - [Yii Active Record](https://github.com/yiisoft/active-record) - [Cycle](https://github.com/cycle) via [Yii Cycle package](https://github.com/yiisoft/yii-cycle) -- [Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine +- [Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine) - [PDO](https://www.php.net/manual/en/book.pdo.php) @@ -84,11 +84,15 @@ list. Then rebuild PHP image with `make build && make down && make up`. ## Configuring connection -Now that we have the database, it's time to define the connection. We need a -package to be installed first: +Now that we have the database, it's time to define the connection. + +Let's use latest versions to be released. Change your `minumum-stability` to +`dev` in `composer.json` first. + +Then we need a package to be installed: ```sh -make composer require yiisoft/db-pgsql +make composer require yiisoft/db-pgsql dev-master ``` Now create `config/common/di/db-pgsql.php`: @@ -148,7 +152,7 @@ the current state and which migrations remain to be applied. To use migrations we need another package installed: ```sh -composer require yiisoft/db-migration +composer require yiisoft/db-migration dev-master ``` Create a directory to store migrations `src/Migration` right in the project @@ -181,14 +185,16 @@ final class M251102141707Page implements RevertibleMigrationInterface { public function up(MigrationBuilder $b): void { + $cb = $b->columnBuilder(); + $b->createTable('page', [ - 'id' => $b->uuidPrimaryKey(), - 'title' => $b->string()->notNull(), - 'slug' => $b->string()->notNull(), - 'text' => $b->text()->notNull(), - 'created_at' => $b->dateTime()->notNull(), - 'updated_at' => $b->dateTime(), - 'deleted_at' => $b->dateTime(), + 'id' => $cb::uuidPrimaryKey(), + 'title' => $cb::string()->notNull(), + 'slug' => $cb::string()->notNull(), + 'text' => $cb::text()->notNull(), + 'created_at' => $cb::dateTime(), + 'updated_at' => $cb::dateTime(), + 'deleted_at' => $cb::dateTime(), ]); } @@ -222,15 +228,33 @@ use Yiisoft\Strings\Inflector; final readonly class Page { - public function __construct( + private function __construct( public string $id, public string $title, public string $text, - public DateTimeImmutable $createdAt = new DateTimeImmutable(), - public DateTimeImmutable $updatedAt = new DateTimeImmutable(), + public DateTimeImmutable $createdAt, + public DateTimeImmutable $updatedAt, public ?DateTimeImmutable $deletedAt = null, ) {} + public static function create( + string $id, + string $title, + string $text, + ?DateTimeImmutable $createdAt = null, + ?DateTimeImmutable $updatedAt = null, + ?DateTimeImmutable $deletedAt = null, + ): self { + return new self( + id: $id, + title: $title, + text: $text, + createdAt: $createdAt ?? new DateTimeImmutable(), + updatedAt: $updatedAt ?? new DateTimeImmutable(), + deletedAt: $deletedAt, + ); + } + public function getSlug(): string { return (new Inflector())->toSlug($this->title); @@ -310,7 +334,7 @@ final readonly class PageRepository private function createPage(array $data): Page { - return new Page( + return Page::create( id: $data['id'], title: $data['title'], text: $data['text'], diff --git a/guide/id/start/databases.md b/guide/id/start/databases.md index 30267c8..0bd840e 100644 --- a/guide/id/start/databases.md +++ b/guide/id/start/databases.md @@ -7,7 +7,7 @@ application. There are many ways you can work with relational databases: - [Yii Active Record](https://github.com/yiisoft/active-record) - [Cycle](https://github.com/cycle) via [Yii Cycle package](https://github.com/yiisoft/yii-cycle) -- [Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine +- [Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine) - [PDO](https://www.php.net/manual/en/book.pdo.php) @@ -84,11 +84,15 @@ list. Then rebuild PHP image with `make build && make down && make up`. ## Configuring connection -Now that we have the database, it's time to define the connection. We need a -package to be installed first: +Now that we have the database, it's time to define the connection. + +Let's use latest versions to be released. Change your `minumum-stability` to +`dev` in `composer.json` first. + +Then we need a package to be installed: ```sh -make composer require yiisoft/db-pgsql +make composer require yiisoft/db-pgsql dev-master ``` Now create `config/common/di/db-pgsql.php`: @@ -148,7 +152,7 @@ the current state and which migrations remain to be applied. To use migrations we need another package installed: ```sh -composer require yiisoft/db-migration +composer require yiisoft/db-migration dev-master ``` Create a directory to store migrations `src/Migration` right in the project @@ -181,14 +185,16 @@ final class M251102141707Page implements RevertibleMigrationInterface { public function up(MigrationBuilder $b): void { + $cb = $b->columnBuilder(); + $b->createTable('page', [ - 'id' => $b->uuidPrimaryKey(), - 'title' => $b->string()->notNull(), - 'slug' => $b->string()->notNull(), - 'text' => $b->text()->notNull(), - 'created_at' => $b->dateTime()->notNull(), - 'updated_at' => $b->dateTime(), - 'deleted_at' => $b->dateTime(), + 'id' => $cb::uuidPrimaryKey(), + 'title' => $cb::string()->notNull(), + 'slug' => $cb::string()->notNull(), + 'text' => $cb::text()->notNull(), + 'created_at' => $cb::dateTime(), + 'updated_at' => $cb::dateTime(), + 'deleted_at' => $cb::dateTime(), ]); } @@ -222,15 +228,33 @@ use Yiisoft\Strings\Inflector; final readonly class Page { - public function __construct( + private function __construct( public string $id, public string $title, public string $text, - public DateTimeImmutable $createdAt = new DateTimeImmutable(), - public DateTimeImmutable $updatedAt = new DateTimeImmutable(), + public DateTimeImmutable $createdAt, + public DateTimeImmutable $updatedAt, public ?DateTimeImmutable $deletedAt = null, ) {} + public static function create( + string $id, + string $title, + string $text, + ?DateTimeImmutable $createdAt = null, + ?DateTimeImmutable $updatedAt = null, + ?DateTimeImmutable $deletedAt = null, + ): self { + return new self( + id: $id, + title: $title, + text: $text, + createdAt: $createdAt ?? new DateTimeImmutable(), + updatedAt: $updatedAt ?? new DateTimeImmutable(), + deletedAt: $deletedAt, + ); + } + public function getSlug(): string { return (new Inflector())->toSlug($this->title); @@ -310,7 +334,7 @@ final readonly class PageRepository private function createPage(array $data): Page { - return new Page( + return Page::create( id: $data['id'], title: $data['title'], text: $data['text'], diff --git a/guide/ru/start/databases.md b/guide/ru/start/databases.md index 30267c8..0bd840e 100644 --- a/guide/ru/start/databases.md +++ b/guide/ru/start/databases.md @@ -7,7 +7,7 @@ application. There are many ways you can work with relational databases: - [Yii Active Record](https://github.com/yiisoft/active-record) - [Cycle](https://github.com/cycle) via [Yii Cycle package](https://github.com/yiisoft/yii-cycle) -- [Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine +- [Doctrine](https://www.doctrine-project.org/) via [Yii Doctrine package](https://github.com/stargazer-team/yii-doctrine) - [PDO](https://www.php.net/manual/en/book.pdo.php) @@ -84,11 +84,15 @@ list. Then rebuild PHP image with `make build && make down && make up`. ## Configuring connection -Now that we have the database, it's time to define the connection. We need a -package to be installed first: +Now that we have the database, it's time to define the connection. + +Let's use latest versions to be released. Change your `minumum-stability` to +`dev` in `composer.json` first. + +Then we need a package to be installed: ```sh -make composer require yiisoft/db-pgsql +make composer require yiisoft/db-pgsql dev-master ``` Now create `config/common/di/db-pgsql.php`: @@ -148,7 +152,7 @@ the current state and which migrations remain to be applied. To use migrations we need another package installed: ```sh -composer require yiisoft/db-migration +composer require yiisoft/db-migration dev-master ``` Create a directory to store migrations `src/Migration` right in the project @@ -181,14 +185,16 @@ final class M251102141707Page implements RevertibleMigrationInterface { public function up(MigrationBuilder $b): void { + $cb = $b->columnBuilder(); + $b->createTable('page', [ - 'id' => $b->uuidPrimaryKey(), - 'title' => $b->string()->notNull(), - 'slug' => $b->string()->notNull(), - 'text' => $b->text()->notNull(), - 'created_at' => $b->dateTime()->notNull(), - 'updated_at' => $b->dateTime(), - 'deleted_at' => $b->dateTime(), + 'id' => $cb::uuidPrimaryKey(), + 'title' => $cb::string()->notNull(), + 'slug' => $cb::string()->notNull(), + 'text' => $cb::text()->notNull(), + 'created_at' => $cb::dateTime(), + 'updated_at' => $cb::dateTime(), + 'deleted_at' => $cb::dateTime(), ]); } @@ -222,15 +228,33 @@ use Yiisoft\Strings\Inflector; final readonly class Page { - public function __construct( + private function __construct( public string $id, public string $title, public string $text, - public DateTimeImmutable $createdAt = new DateTimeImmutable(), - public DateTimeImmutable $updatedAt = new DateTimeImmutable(), + public DateTimeImmutable $createdAt, + public DateTimeImmutable $updatedAt, public ?DateTimeImmutable $deletedAt = null, ) {} + public static function create( + string $id, + string $title, + string $text, + ?DateTimeImmutable $createdAt = null, + ?DateTimeImmutable $updatedAt = null, + ?DateTimeImmutable $deletedAt = null, + ): self { + return new self( + id: $id, + title: $title, + text: $text, + createdAt: $createdAt ?? new DateTimeImmutable(), + updatedAt: $updatedAt ?? new DateTimeImmutable(), + deletedAt: $deletedAt, + ); + } + public function getSlug(): string { return (new Inflector())->toSlug($this->title); @@ -310,7 +334,7 @@ final readonly class PageRepository private function createPage(array $data): Page { - return new Page( + return Page::create( id: $data['id'], title: $data['title'], text: $data['text'],