Skip to content

Get started

Install

composer require small/swoole-entity-manager-core

Configuration

Create a file config/packages/swoole-entity-manager.yaml

small_swoole_entity_manager:
    default_connection: default

    connections:
        default:
            type: mysql
            host: database.my-app.net
            encoding: utf8
            database: app
            user: root
            password: secret

        users:
            type: postgres
            host: 128.0.5.10
            encoding: utf8
            database: sso_users
            user: postgres
            password: secret123

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

You can define any number of connections.

The special tag @projectRoot indication the project root dir as defined in Kernel.

Possible values for connection type entry : - "mysql" - "postgres" - "swoole-db"

Next chapter : Instanciate managers