Move doctrine related logic to Doctrine\ORM and Doctrine\MongoDB
This commit is contained in:
parent
30eb9c90f5
commit
1eff840c99
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace FOQ\ElasticaBundle\Transformer;
|
||||
namespace FOQ\ElasticaBundle\Doctrine;
|
||||
|
||||
use FOQ\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface;
|
||||
use Elastica_Document;
|
||||
|
||||
/**
|
||||
|
@ -9,7 +10,7 @@ use Elastica_Document;
|
|||
* This mapper assumes an exact match between
|
||||
* elastica documents ids and doctrine object ids
|
||||
*/
|
||||
abstract class ElasticaToModelAbstractDoctrineTransformer implements ElasticaToModelTransformerInterface
|
||||
abstract class AbstractElasticaToModelTransformer implements ElasticaToModelTransformerInterface
|
||||
{
|
||||
/**
|
||||
* Repository to fetch the objects from
|
|
@ -1,14 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace FOQ\ElasticaBundle\Provider;
|
||||
namespace FOQ\ElasticaBundle\Doctrine;
|
||||
|
||||
use FOQ\ElasticaBundle\Provider\ProviderInterface;
|
||||
use FOQ\ElasticaBundle\Transformer\ModelToElasticaTransformerInterface;
|
||||
use Elastica_Type;
|
||||
use Elastica_Document;
|
||||
use Closure;
|
||||
use InvalidArgumentException;
|
||||
|
||||
abstract class AbstractDoctrineProvider implements ProviderInterface
|
||||
abstract class AbstractProvider implements ProviderInterface
|
||||
{
|
||||
protected $type;
|
||||
protected $objectManager;
|
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace FOQ\ElasticaBundle\Transformer;
|
||||
namespace FOQ\ElasticaBundle\Doctrine\MongoDB;
|
||||
|
||||
use FOQ\ElasticaBundle\Doctrine\AbstractElasticaToModelTransformer;
|
||||
use Elastica_Document;
|
||||
|
||||
/**
|
||||
|
@ -9,7 +10,7 @@ use Elastica_Document;
|
|||
* This mapper assumes an exact match between
|
||||
* elastica documents ids and doctrine object ids
|
||||
*/
|
||||
class ElasticaToModelDoctrineMongoDBTransformer extends ElasticaToModelAbstractDoctrineTransformer
|
||||
class ElasticaToModelTransformer extends AbstractElasticaToModelTransformer
|
||||
{
|
||||
/**
|
||||
* Fetch objects for theses identifier values
|
|
@ -1,8 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace FOQ\ElasticaBundle\Provider;
|
||||
namespace FOQ\ElasticaBundle\Doctrine\MongoDB;
|
||||
|
||||
class DoctrineMongoDBProvider extends AbstractDoctrineProvider
|
||||
use FOQ\ElasticaBundle\Doctrine\AbstractProvider;
|
||||
|
||||
class Provider extends AbstractProvider
|
||||
{
|
||||
/**
|
||||
* Counts the objects of a query builder
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace FOQ\ElasticaBundle\Transformer;
|
||||
namespace FOQ\ElasticaBundle\Doctrine\ORM;
|
||||
|
||||
use Elastica_Document;
|
||||
|
||||
|
@ -9,7 +9,7 @@ use Elastica_Document;
|
|||
* This mapper assumes an exact match between
|
||||
* elastica documents ids and doctrine object ids
|
||||
*/
|
||||
class ElasticaToModelDoctrineORMTransformer extends ElasticaToModelAbstractDoctrineTransformer
|
||||
class ElasticaToModelTransformer extends AbstractElasticaToModelTransformer
|
||||
{
|
||||
/**
|
||||
* Fetch objects for theses identifier values
|
|
@ -1,8 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace FOQ\ElasticaBundle\Provider;
|
||||
namespace FOQ\ElasticaBundle\Doctrine\ORM;
|
||||
|
||||
class DoctrineORMProvider extends AbstractDoctrineProvider
|
||||
use FOQ\ElasticaBundle\Doctrine\AbstractProvider;
|
||||
|
||||
class Provider extends AbstractProvider
|
||||
{
|
||||
/**
|
||||
* Counts the objects of a query builder
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace FOQ\ElasticaBundle\Paginator;
|
||||
namespace FOQ\ElasticaBundle\Doctrine;
|
||||
|
||||
use FOQ\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface;
|
||||
use Elastica_Searchable;
|
||||
|
@ -11,7 +11,7 @@ use Elastica_Query;
|
|||
*
|
||||
* Allows pagination of Elastica_Query
|
||||
*/
|
||||
class DoctrinePaginatorAdapter extends AbstractPaginatorAdapter
|
||||
class PaginatorAdapter extends AbstractPaginatorAdapter
|
||||
{
|
||||
protected $transformer;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<services>
|
||||
|
||||
<service id="foq_elastica.provider.prototype.mongodb" class="FOQ\ElasticaBundle\Provider\DoctrineMongoDBProvider" public="false" abstract="true">
|
||||
<service id="foq_elastica.provider.prototype.mongodb" class="FOQ\ElasticaBundle\Doctrine\MongoDB\Provider" public="false" abstract="true">
|
||||
<argument /> <!-- index -->
|
||||
<argument type="service" id="doctrine.odm.mongodb.document_manager" />
|
||||
<argument /> <!-- transformer -->
|
||||
|
@ -14,7 +14,7 @@
|
|||
<argument type="collection" /> <!-- options -->
|
||||
</service>
|
||||
|
||||
<service id="foq_elastica.elastica_to_model_transformer.prototype.mongodb" class="FOQ\ElasticaBundle\Transformer\ElasticaToModelDoctrineMongoDBTransformer" public="false">
|
||||
<service id="foq_elastica.elastica_to_model_transformer.prototype.mongodb" class="FOQ\ElasticaBundle\Doctrine\MongoDB\ElasticaToModelTransformer" public="false">
|
||||
<argument type="service" id="doctrine.odm.mongodb.document_manager" />
|
||||
<argument /> <!-- model -->
|
||||
<argument type="collection" /> <!-- options -->
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<services>
|
||||
|
||||
<service id="foq_elastica.provider.prototype.orm" class="FOQ\ElasticaBundle\Provider\DoctrineORMProvider" public="false" abstract="true">
|
||||
<service id="foq_elastica.provider.prototype.orm" class="FOQ\ElasticaBundle\Doctrine\ORM\Provider" public="false" abstract="true">
|
||||
<argument /> <!-- index -->
|
||||
<argument type="service" id="doctrine.orm.entity_manager" />
|
||||
<argument /> <!-- transformer -->
|
||||
|
@ -14,7 +14,7 @@
|
|||
<argument type="collection" /> <!-- options -->
|
||||
</service>
|
||||
|
||||
<service id="foq_elastica.elastica_to_model_transformer.prototype.orm" class="FOQ\ElasticaBundle\Transformer\ElasticaToModelDoctrineTransformer" public="false">
|
||||
<service id="foq_elastica.elastica_to_model_transformer.prototype.orm" class="FOQ\ElasticaBundle\Doctrine\ORM\Transformer" public="false">
|
||||
<argument type="service" id="doctrine.orm.entity_manager" />
|
||||
<argument /> <!-- model -->
|
||||
<argument type="collection" /> <!-- options -->
|
||||
|
|
Loading…
Reference in a new issue