cadre/atlasorm-debugbar-bridge

This package is abandoned and no longer maintained. No replacement package was suggested.

Library to use PHP DebugBar with Atlas ORM

1.1.1 2017-07-28 18:33 UTC

This package is not auto-updated.

Last update: 2020-04-14 01:57:50 UTC


README

Read the instructions for using Atlas.Orm and PHP Debug Bar. I'll just show you what you need to do to make these work together.

1. Include Atlas.Orm and PHP Debug Bar in your project

I'm not listing either of these as a dependency of this library because I'll let you define what version and stability you want in your project.

2. Use Cadre\AtlasOrmDebugBarBridge\AtlasContainer

Instead of using the normal Atlas\Orm\AtlasContainer use Cadre\AtlasOrmDebugBarBridge\AtlasContainer.

This class functions exactly as the normal Atlas.ORM one only it uses Cadre\AtlasOrmDebugBarBridge\ExtendedPdo instead of Aura\Sql\ExtendedPdo which wraps the inner PDO object in DebugBar\DataCollector\PDO\TraceablePDO.

3. Use Cadre\AtlasOrmDebugBarBridge\AtlasOrmCollector

I've provided Cadre\AtlasOrmDebugBarBridge\AtlasOrmCollector which takes a Cadre\AtlasOrmDebugBarBridge\AtlasContainer, pulls the DebugBar\DataCollector\PDO\TraceablePDO object out of it and passes it up to its parent DebugBar\DataCollector\PDO\PDOCollector.

Example

$atlasContainer = new Cadre\AtlasOrmDebugBarBridge\AtlasContainer(
    'mysql:host=localhost;dbname=testdb',
    'username',
    'password'
);

$debugbar = new DebugBar\StandardDebugBar();
$debugbar->addCollector(
    new Cadre\AtlasOrmDebugBarBridge\AtlasOrmCollector($atlasContainer)
);

Multiple Connections

$atlasContainer = Cadre\AtlasOrmDebugBarBridge\AtlasContainer(
    'mysql:host=localhost;dbname=testdb',
    'username',
    'password'
);

$factory = new Cadre\AtlasOrmDebugBarBridge\ConnectionFactory(
    'mysql:host=localhost;dbname=slavedb',
    'readonly',
    'password'
);

$atlasContainer->setReadConnection('readonly', $factory);

$collector = new Cadre\AtlasOrmDebugBarBridge\AtlasOrmCollector($container);
$collector->addConnectionFactory($factory, 'readonly');

$debugbar = new DebugBar\StandardDebugBar();
$debugbar->addCollector($collector);