-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
771cb2d
commit 1bf6423
Showing
3 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace ZfSnapPhpDebugBar\Collector; | ||
|
||
use Interop\Container\ContainerInterface; | ||
use DebugBar\Bridge\DoctrineCollector; | ||
use Zend\ServiceManager\FactoryInterface; | ||
use Zend\ServiceManager\ServiceLocatorInterface; | ||
|
||
class DoctrineCollectorFactory implements FactoryInterface | ||
{ | ||
public function __invoke(ContainerInterface $container, $requestedName, array $options = null) | ||
{ | ||
$debugStack = $container->get('doctrine.configuration.orm_default')->getSQLLogger(); | ||
return new DoctrineCollector($debugStack); | ||
} | ||
|
||
public function createService(ServiceLocatorInterface $serviceLocator) | ||
{ | ||
return $this($serviceLocator, DoctrineCollector::class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace ZfSnapPhpDebugBar\Delegator; | ||
|
||
use Interop\Container\ContainerInterface; | ||
use Zend\ServiceManager\DelegatorFactoryInterface; | ||
use Zend\ServiceManager\ServiceLocatorInterface; | ||
use Doctrine\DBAL\Logging\DebugStack; | ||
|
||
class DoctrineConfigurationDelegatorFactory implements DelegatorFactoryInterface | ||
{ | ||
public function __invoke(ContainerInterface $container, $name, callable $callback, array $options = null) | ||
{ | ||
$doctrineConfiguration = $callback(); | ||
$doctrineConfiguration->setSQLLogger(new DebugStack); | ||
return $doctrineConfiguration; | ||
} | ||
|
||
public function createDelegatorWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName, $callback) | ||
{ | ||
return $this($serviceLocator, $requestedName, $callback); | ||
} | ||
} |