[Provider] Change provider construction (possible BC break)
* 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.
This commit is contained in:
parent
89a368ae35
commit
e09225eb09
12 changed files with 349 additions and 181 deletions
30
Provider/AbstractProvider.php
Normal file
30
Provider/AbstractProvider.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue