440c36f537
Conflicts: Command/PopulateCommand.php Command/SearchCommand.php DependencyInjection/Configuration.php Doctrine/AbstractElasticaToModelTransformer.php Doctrine/AbstractListener.php Doctrine/MongoDB/ElasticaToModelTransformer.php Doctrine/ORM/ElasticaToModelTransformer.php Doctrine/RepositoryManager.php Finder/TransformedFinder.php Paginator/PaginatorAdapterInterface.php Paginator/RawPaginatorAdapter.php Persister/ObjectPersister.php Propel/ElasticaToModelTransformer.php Subscriber/PaginateElasticaQuerySubscriber.php Tests/DataCollector/ElasticaDataCollectorTest.php Tests/Doctrine/AbstractProviderTest.php Tests/Doctrine/RepositoryManagerTest.php Tests/Manager/RepositoryManagerTest.php Tests/RepositoryTest.php Transformer/ElasticaToModelTransformerCollection.php composer.json
36 lines
753 B
PHP
36 lines
753 B
PHP
<?php
|
|
|
|
namespace FOS\ElasticaBundle;
|
|
|
|
use Elastica_Client;
|
|
use FOS\ElasticaBundle\Logger\ElasticaLogger;
|
|
|
|
/**
|
|
* @author Gordon Franke <info@nevalon.de>
|
|
*/
|
|
class Client extends Elastica_Client
|
|
{
|
|
/**
|
|
* @var ElasticaLogger
|
|
*/
|
|
protected $logger;
|
|
|
|
public function setLogger(ElasticaLogger $logger)
|
|
{
|
|
$this->logger = $logger;
|
|
}
|
|
|
|
public function request($path, $method, $data = array(), array $query = array())
|
|
{
|
|
$start = microtime(true);
|
|
$response = parent::request($path, $method, $data, $query);
|
|
|
|
if (null !== $this->logger) {
|
|
$time = microtime(true) - $start;
|
|
$this->logger->logQuery($path, $method, $data, $time);
|
|
}
|
|
|
|
return $response;
|
|
}
|
|
}
|