Skip to content

Database layers

Configure layer directories

database_layers maps a selector to a layer directory:

small_swoole_entity_manager:
  database_layers:
    app: "@projectRoot/databaseLayers"
    users: "@UserBundle/Resources/databaseLayers"

Once the directories are configured, create one subdirectory for each migration layer. See the Core database-layer documentation for the layer format and execution model.

Pass explicit layer parameters

Only explicitly configured values are visible to the Core layer parameter bag:

small_swoole_entity_manager:
  layer_parameters:
    application_environment: prod
    tenant: main
    retries: 3

Values must be scalar or null. Boolean values are normalized to integers before they are passed to Core.

This explicit list avoids exposing unrelated or sensitive Symfony container parameters to database-layer code.

Execute every configured selector

bin/console swoole:entity-manager:layers:execute

The command exits successfully after all configured layer directories have been loaded and executed.

Execute one selector

Use --selector to run only one configured layer group:

bin/console swoole:entity-manager:layers:execute --selector=users

The command returns a non-zero exit status when no database layers are configured or when the requested selector does not exist. This makes the command safe to use in CI/deployment scripts that must stop on a configuration error.

Next chapter: Upgrade to bundle v2