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
Requires
- php: >=8.3
- ext-iconv: *
- small/swoole-entity-manager-core: *
- symfony/console: 7.1.*
- symfony/dotenv: 7.1.*
- symfony/flex: ^2
- symfony/framework-bundle: 7.1.*
- symfony/runtime: 7.1.*
- symfony/yaml: 7.1.*
Requires (Dev)
- pestphp/pest: 2.34.*
- phpstan/phpstan: 1.11.*
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.