e09225eb09
* Created AbstractProvider class (for all DB services), which handles the default batch_size option. * The logger Closure is now optional for populate(). * Removed unused Elastica_Type argument from Provider constructors. * Added unit tests for Doctrine's AbstractProvider class. * The extra argument (ManagerRegistry) for Doctrine providers is now an appended constructor argument, so the extension no longer needs to use different replacement indexes for Propel/Doctrine providers.
31 lines
828 B
PHP
31 lines
828 B
PHP
<?php
|
|
|
|
namespace FOQ\ElasticaBundle\Provider;
|
|
|
|
use FOQ\ElasticaBundle\Persister\ObjectPersisterInterface;
|
|
use FOQ\ElasticaBundle\Provider\ProviderInterface;
|
|
|
|
abstract class AbstractProvider implements ProviderInterface
|
|
{
|
|
protected $objectClass;
|
|
protected $objectPersister;
|
|
protected $options;
|
|
|
|
/**
|
|
* Constructor.
|
|
*
|
|
* @param ObjectPersisterInterface $objectPersister
|
|
* @param string $objectClass
|
|
* @param array $options
|
|
*/
|
|
public function __construct(ObjectPersisterInterface $objectPersister, $objectClass, array $options = array())
|
|
{
|
|
$this->objectPersister = $objectPersister;
|
|
$this->objectClass = $objectClass;
|
|
|
|
$this->options = array_merge(array(
|
|
'batch_size' => 100,
|
|
), $options);
|
|
}
|
|
}
|