Skip to content

Upgrade to bundle v2

The bundle v2 line aligns the Symfony integration with Small Swoole Entity Manager Core 3 and with current Symfony releases.

Dependency baseline

The current v2 source requires:

  • PHP >=8.3 <8.5;
  • small/swoole-entity-manager-core 3.0.*;
  • Symfony 7.4 or 8.0 components.

The PHP <8.5 upper bound is intentional in the current bundle dependency contract. Do not remove it in an application override unless the complete Core and bundle stack has been verified on PHP 8.5.

Depend on service contracts

Application services should inject:

  • ConnectionFactoryInterface;
  • EntityManagerFactoryInterface.

The concrete bundle services are private implementation details. This makes application code independent from the bundle's internal service IDs and factory wrappers.

Long-running processes

The entity manager factory is registered with kernel.reset. Cached Core managers are cleared when Symfony resets the service between worker cycles.

If you own the worker loop and it does not trigger Symfony's reset mechanism, call EntityManagerFactoryInterface::reset() at the appropriate request/job boundary.

Connection configuration

Use Symfony-style public option names:

small_swoole_entity_manager:
  connections:
    default:
      type: mysql
      host: mysql
      port: 3306
      database: app
      user: app
      password: secret
      encoding: utf8mb4
      max_connections: 50

The bundle validates the configuration and translates max_connections to Core's maxConnections option.

SQL connection definitions require host, database, user, password and encoding. Small Swoole DB accepts only type: swoole-db.

Database-layer parameters are explicit

The v2 layer executor receives only layer_parameters. It no longer passes Symfony's complete parameter bag into Core migration layers.

Move every value required by a layer into the bundle configuration:

small_swoole_entity_manager:
  layer_parameters:
    application_environment: prod

Selector-aware layer execution

The layer command can now execute one configured selector:

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

Missing layer configuration and unknown selectors produce a command failure status instead of silently appearing successful.