small/swoole-entity-manager-bundle

Symfony bundle for Small Swoole Entity Manager, an ORM designed for swoole

1.0.2 2024-11-05 17:47 UTC

This package is auto-updated.

Last update: 2024-12-05 17:58:47 UTC


README

Small Swoole Entity Manager Bundle

Small Swoole Entity Manager is an ORM designed for Swoole and OpenSwoole.

This bundle is a Symfony bridge for it.

  

Installation

composer require small/swoole-entity-manager-bundle

To configure a connection to database, create a "config/packages/small_swoole_entity_manager.yaml" :

small_swoole_entity_manager:
  default_connection: test
  connections:
    test:
      type: mysql
      host: localhost
      database: test_db
      user: root
      encoding: utf8
      password: dev

Possibles values for type : "mysql" or "postgres"

Get manager

Now, you are able to get your managers via Symfony container :

$this->container
    ->get(\Small\SwooleEntityManagerBundle\Contract\EntityManagerFactoryInterface::class)
    ->get(\Small\SwooleEntityManagerBundle\Test\Fixture\EntityManager\UserManager::class)
;

See Small Swoole Entity Manager documentation for how to use manager.

Get connection

You can also retrieve Small Swoole Entity Manager connection to execute native statements :

$connection = $this->container
    ->get(\Small\SwooleEntityManagerBundle\Contract\ConnectionFactoryInterface::class)
    ->get('test')
;

See Small Swoole Entity Manager documentation for how to use connection.