remi-san/doctrine-tools

A set of tools for Doctrine

v0.2.1 2021-02-21 14:57 UTC

This package is auto-updated.

Last update: 2024-12-21 23:15:19 UTC


README

Author Build Status Quality Score Software License Packagist Version Coverage Status SensioLabsInsight

Providing easy-to-use tools for doctrine.

Content

This lib provides the following util classes:

  • EntityManagerBuilder an entity manager builder providing an easy way to add Doctrine types to the EntityManager, you can also call methods on the type using a callable formatted array. It has been designed to be compatible with Symfony DI config files.
  • Psr3SqlLogger is a Doctrine logger encapsulating a PSR3 logger.

Usage example

EntityManagerBuilder

$builder = new EntityManagerBuilder($connection, $config);
$builder->addType('customName', CustomType::class, [ [ 'callTypeMethod', []] ]);
$entityManager = $builder->buildEntityManager();

Psr3SqlLogger

$logger = new Psr3SqlLogger($psr3Logger, LogLevel::INFO);