Rename FOQ namespaces and services to FOS

This commit is contained in:
Jeremy Mikola 2013-03-27 13:44:06 -04:00
parent 4e11e20071
commit 3fb9aaa56a
76 changed files with 352 additions and 352 deletions

View file

@ -1,9 +1,9 @@
<?php
namespace FOQ\ElasticaBundle;
namespace FOS\ElasticaBundle;
use Elastica_Client;
use FOQ\ElasticaBundle\Logger\ElasticaLogger;
use FOS\ElasticaBundle\Logger\ElasticaLogger;
/**
* @author Gordon Franke <info@nevalon.de>

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\Command;
namespace FOS\ElasticaBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
@ -15,17 +15,17 @@ use Symfony\Component\Console\Output\Output;
class PopulateCommand extends ContainerAwareCommand
{
/**
* @var FOQ\ElasticaBundle\IndexManager
* @var FOS\ElasticaBundle\IndexManager
*/
private $indexManager;
/**
* @var FOQ\ElasticaBundle\Provider\ProviderRegistry
* @var FOS\ElasticaBundle\Provider\ProviderRegistry
*/
private $providerRegistry;
/**
* @var FOQ\ElasticaBundle\Resetter
* @var FOS\ElasticaBundle\Resetter
*/
private $resetter;
@ -35,7 +35,7 @@ class PopulateCommand extends ContainerAwareCommand
protected function configure()
{
$this
->setName('foq:elastica:populate')
->setName('fos:elastica:populate')
->addOption('index', null, InputOption::VALUE_OPTIONAL, 'The index to repopulate')
->addOption('type', null, InputOption::VALUE_OPTIONAL, 'The type to repopulate')
->addOption('no-reset', null, InputOption::VALUE_NONE, 'Do not reset index before populating')
@ -48,9 +48,9 @@ class PopulateCommand extends ContainerAwareCommand
*/
protected function initialize(InputInterface $input, OutputInterface $output)
{
$this->indexManager = $this->getContainer()->get('foq_elastica.index_manager');
$this->providerRegistry = $this->getContainer()->get('foq_elastica.provider_registry');
$this->resetter = $this->getContainer()->get('foq_elastica.resetter');
$this->indexManager = $this->getContainer()->get('fos_elastica.index_manager');
$this->providerRegistry = $this->getContainer()->get('fos_elastica.provider_registry');
$this->resetter = $this->getContainer()->get('fos_elastica.resetter');
}
/**

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\Command;
namespace FOS\ElasticaBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
@ -22,7 +22,7 @@ class SearchCommand extends ContainerAwareCommand
protected function configure()
{
$this
->setName('foq:elastica:search')
->setName('fos:elastica:search')
->addArgument('type', InputArgument::REQUIRED, 'The type to search in')
->addArgument('query', InputArgument::REQUIRED, 'The text to search')
->addOption('index', null, InputOption::VALUE_REQUIRED, 'The index to search in')
@ -41,7 +41,7 @@ class SearchCommand extends ContainerAwareCommand
protected function execute(InputInterface $input, OutputInterface $output)
{
$indexName = $input->getOption('index');
$index = $this->getContainer()->get('foq_elastica.index_manager')->getIndex($indexName ? $indexName : null);
$index = $this->getContainer()->get('fos_elastica.index_manager')->getIndex($indexName ? $indexName : null);
$type = $index->getType($input->getArgument('type'));
$query = Elastica_Query::create($input->getArgument('query'));
$query->setLimit($input->getOption('limit'));

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\Configuration;
namespace FOS\ElasticaBundle\Configuration;
/**
* Annotation class for setting search repository.

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\DataCollector;
namespace FOS\ElasticaBundle\DataCollector;
use FOQ\ElasticaBundle\Logger\ElasticaLogger;
use FOS\ElasticaBundle\Logger\ElasticaLogger;
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\DependencyInjection\Compiler;
namespace FOS\ElasticaBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
@ -21,15 +21,15 @@ class RegisterProvidersPass implements CompilerPassInterface
*/
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('foq_elastica.provider_registry')) {
if (!$container->hasDefinition('fos_elastica.provider_registry')) {
return;
}
// Infer the default index name from the service alias
$defaultIndex = substr($container->getAlias('foq_elastica.index'), 19);
$defaultIndex = substr($container->getAlias('fos_elastica.index'), 19);
$registry = $container->getDefinition('foq_elastica.provider_registry');
$providers = $container->findTaggedServiceIds('foq_elastica.provider');
$registry = $container->getDefinition('fos_elastica.provider_registry');
$providers = $container->findTaggedServiceIds('fos_elastica.provider');
foreach ($providers as $providerId => $tags) {
$index = $type = null;
@ -62,7 +62,7 @@ class RegisterProvidersPass implements CompilerPassInterface
{
if (!isset($this->implementations[$class])) {
$refl = new \ReflectionClass($class);
$this->implementations[$class] = $refl->implementsInterface('FOQ\ElasticaBundle\Provider\ProviderInterface');
$this->implementations[$class] = $refl->implementsInterface('FOS\ElasticaBundle\Provider\ProviderInterface');
}
return $this->implementations[$class];

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\DependencyInjection\Compiler;
namespace FOS\ElasticaBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
@ -20,13 +20,13 @@ class TransformerPass implements CompilerPassInterface
*/
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('foq_elastica.elastica_to_model_transformer.collection.prototype')) {
if (!$container->hasDefinition('fos_elastica.elastica_to_model_transformer.collection.prototype')) {
return;
}
$transformers = array();
foreach ($container->findTaggedServiceIds('foq_elastica.elastica_to_model_transformer') as $id => $tags) {
foreach ($container->findTaggedServiceIds('fos_elastica.elastica_to_model_transformer') as $id => $tags) {
foreach ($tags as $tag) {
if (empty($tag['index']) || empty($tag['type'])) {
throw new InvalidArgumentException('The Transformer must have both a type and an index defined.');
@ -37,11 +37,11 @@ class TransformerPass implements CompilerPassInterface
}
foreach ($transformers as $index => $indexTransformers) {
if (!$container->hasDefinition(sprintf('foq_elastica.elastica_to_model_transformer.collection.%s', $index))) {
if (!$container->hasDefinition(sprintf('fos_elastica.elastica_to_model_transformer.collection.%s', $index))) {
continue;
}
$index = $container->getDefinition(sprintf('foq_elastica.elastica_to_model_transformer.collection.%s', $index));
$index = $container->getDefinition(sprintf('fos_elastica.elastica_to_model_transformer.collection.%s', $index));
$index->replaceArgument(0, $indexTransformers);
}
}

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\DependencyInjection;
namespace FOS\ElasticaBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
@ -22,7 +22,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('foq_elastica', 'array');
$rootNode = $treeBuilder->root('fos_elastica', 'array');
$this->addClientsSection($rootNode);
$this->addIndexesSection($rootNode);

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\DependencyInjection;
namespace FOS\ElasticaBundle\DependencyInjection;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
@ -11,7 +11,7 @@ use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Config\FileLocator;
use InvalidArgumentException;
class FOQElasticaExtension extends Extension
class FOSElasticaExtension extends Extension
{
protected $indexConfigs = array();
protected $typeFields = array();
@ -48,8 +48,8 @@ class FOQElasticaExtension extends Extension
$this->loadIndexManager($indexRefsByName, $container);
$this->loadResetter($this->indexConfigs, $container);
$container->setAlias('foq_elastica.client', sprintf('foq_elastica.client.%s', $config['default_client']));
$container->setAlias('foq_elastica.index', sprintf('foq_elastica.index.%s', $config['default_index']));
$container->setAlias('fos_elastica.client', sprintf('fos_elastica.client.%s', $config['default_client']));
$container->setAlias('fos_elastica.index', sprintf('fos_elastica.index.%s', $config['default_index']));
$this->createDefaultManagerAlias($config['default_manager'], $container);
}
@ -69,10 +69,10 @@ class FOQElasticaExtension extends Extension
{
$clientIds = array();
foreach ($clients as $name => $clientConfig) {
$clientDef = $container->getDefinition('foq_elastica.client');
$clientDef = $container->getDefinition('fos_elastica.client');
$clientDef->replaceArgument(0, $clientConfig);
$clientId = sprintf('foq_elastica.client.%s', $name);
$clientId = sprintf('fos_elastica.client.%s', $name);
$container->setDefinition($clientId, $clientDef);
@ -102,10 +102,10 @@ class FOQElasticaExtension extends Extension
}
$clientId = $clientIdsByName[$clientName];
$indexId = sprintf('foq_elastica.index.%s', $name);
$indexId = sprintf('fos_elastica.index.%s', $name);
$indexName = isset($index['index_name']) ? $index['index_name'] : $name;
$indexDefArgs = array($indexName);
$indexDef = new Definition('%foq_elastica.index.class%', $indexDefArgs);
$indexDef = new Definition('%fos_elastica.index.class%', $indexDefArgs);
$indexDef->setFactoryService($clientId);
$indexDef->setFactoryMethod('getIndex');
$container->setDefinition($indexId, $indexDef);
@ -139,13 +139,13 @@ class FOQElasticaExtension extends Extension
*/
protected function loadIndexFinder(ContainerBuilder $container, $name, $indexId)
{
$abstractTransformerId = 'foq_elastica.elastica_to_model_transformer.collection.prototype';
$transformerId = sprintf('foq_elastica.elastica_to_model_transformer.collection.%s', $name);
$abstractTransformerId = 'fos_elastica.elastica_to_model_transformer.collection.prototype';
$transformerId = sprintf('fos_elastica.elastica_to_model_transformer.collection.%s', $name);
$transformerDef = new DefinitionDecorator($abstractTransformerId);
$container->setDefinition($transformerId, $transformerDef);
$abstractFinderId = 'foq_elastica.finder.prototype';
$finderId = sprintf('foq_elastica.finder.%s', $name);
$abstractFinderId = 'fos_elastica.finder.prototype';
$finderId = sprintf('fos_elastica.finder.%s', $name);
$finderDef = new DefinitionDecorator($abstractFinderId);
$finderDef->replaceArgument(0, new Reference($indexId));
$finderDef->replaceArgument(1, new Reference($transformerId));
@ -167,7 +167,7 @@ class FOQElasticaExtension extends Extension
$type = self::deepArrayUnion($typePrototypeConfig, $type);
$typeId = sprintf('%s.%s', $indexId, $name);
$typeDefArgs = array($name);
$typeDef = new Definition('%foq_elastica.type.class%', $typeDefArgs);
$typeDef = new Definition('%fos_elastica.type.class%', $typeDefArgs);
$typeDef->setFactoryService($indexId);
$typeDef->setFactoryMethod('getType');
$container->setDefinition($typeId, $typeDef);
@ -250,10 +250,10 @@ class FOQElasticaExtension extends Extension
if (isset($typeConfig['elastica_to_model_transformer']['service'])) {
return $typeConfig['elastica_to_model_transformer']['service'];
}
$abstractId = sprintf('foq_elastica.elastica_to_model_transformer.prototype.%s', $typeConfig['driver']);
$serviceId = sprintf('foq_elastica.elastica_to_model_transformer.%s.%s', $indexName, $typeName);
$abstractId = sprintf('fos_elastica.elastica_to_model_transformer.prototype.%s', $typeConfig['driver']);
$serviceId = sprintf('fos_elastica.elastica_to_model_transformer.%s.%s', $indexName, $typeName);
$serviceDef = new DefinitionDecorator($abstractId);
$serviceDef->addTag('foq_elastica.elastica_to_model_transformer', array('type' => $typeName, 'index' => $indexName));
$serviceDef->addTag('fos_elastica.elastica_to_model_transformer', array('type' => $typeName, 'index' => $indexName));
// Doctrine has a mandatory service as first argument
$argPos = ('propel' === $typeConfig['driver']) ? 0 : 1;
@ -273,8 +273,8 @@ class FOQElasticaExtension extends Extension
if (isset($typeConfig['model_to_elastica_transformer']['service'])) {
return $typeConfig['model_to_elastica_transformer']['service'];
}
$abstractId = sprintf('foq_elastica.model_to_elastica_transformer.prototype.auto');
$serviceId = sprintf('foq_elastica.model_to_elastica_transformer.%s.%s', $indexName, $typeName);
$abstractId = sprintf('fos_elastica.model_to_elastica_transformer.prototype.auto');
$serviceId = sprintf('fos_elastica.model_to_elastica_transformer.%s.%s', $indexName, $typeName);
$serviceDef = new DefinitionDecorator($abstractId);
$serviceDef->replaceArgument(0, array(
'identifier' => $typeConfig['identifier']
@ -286,8 +286,8 @@ class FOQElasticaExtension extends Extension
protected function loadObjectPersister(array $typeConfig, Definition $typeDef, ContainerBuilder $container, $indexName, $typeName, $transformerId)
{
$abstractId = sprintf('foq_elastica.object_persister.prototype');
$serviceId = sprintf('foq_elastica.object_persister.%s.%s', $indexName, $typeName);
$abstractId = sprintf('fos_elastica.object_persister.prototype');
$serviceId = sprintf('fos_elastica.object_persister.%s.%s', $indexName, $typeName);
$serviceDef = new DefinitionDecorator($abstractId);
$serviceDef->replaceArgument(0, $typeDef);
$serviceDef->replaceArgument(1, new Reference($transformerId));
@ -304,9 +304,9 @@ class FOQElasticaExtension extends Extension
return $typeConfig['provider']['service'];
}
$providerId = sprintf('foq_elastica.provider.%s.%s', $indexName, $typeName);
$providerDef = new DefinitionDecorator('foq_elastica.provider.prototype.' . $typeConfig['driver']);
$providerDef->addTag('foq_elastica.provider', array('index' => $indexName, 'type' => $typeName));
$providerId = sprintf('fos_elastica.provider.%s.%s', $indexName, $typeName);
$providerDef = new DefinitionDecorator('fos_elastica.provider.prototype.' . $typeConfig['driver']);
$providerDef->addTag('fos_elastica.provider', array('index' => $indexName, 'type' => $typeName));
$providerDef->replaceArgument(0, new Reference($objectPersisterId));
$providerDef->replaceArgument(1, $typeConfig['model']);
// Propel provider can simply ignore Doctrine-specific options
@ -321,8 +321,8 @@ class FOQElasticaExtension extends Extension
if (isset($typeConfig['listener']['service'])) {
return $typeConfig['listener']['service'];
}
$abstractListenerId = sprintf('foq_elastica.listener.prototype.%s', $typeConfig['driver']);
$listenerId = sprintf('foq_elastica.listener.%s.%s', $indexName, $typeName);
$abstractListenerId = sprintf('fos_elastica.listener.prototype.%s', $typeConfig['driver']);
$listenerId = sprintf('fos_elastica.listener.%s.%s', $indexName, $typeName);
$listenerDef = new DefinitionDecorator($abstractListenerId);
$listenerDef->replaceArgument(0, new Reference($objectPersisterId));
$listenerDef->replaceArgument(1, $typeConfig['model']);
@ -372,15 +372,15 @@ class FOQElasticaExtension extends Extension
if (isset($typeConfig['finder']['service'])) {
$finderId = $typeConfig['finder']['service'];
} else {
$abstractFinderId = 'foq_elastica.finder.prototype';
$finderId = sprintf('foq_elastica.finder.%s.%s', $indexName, $typeName);
$abstractFinderId = 'fos_elastica.finder.prototype';
$finderId = sprintf('fos_elastica.finder.%s.%s', $indexName, $typeName);
$finderDef = new DefinitionDecorator($abstractFinderId);
$finderDef->replaceArgument(0, $typeDef);
$finderDef->replaceArgument(1, new Reference($elasticaToModelId));
$container->setDefinition($finderId, $finderDef);
}
$managerId = sprintf('foq_elastica.manager.%s', $typeConfig['driver']);
$managerId = sprintf('fos_elastica.manager.%s', $typeConfig['driver']);
$managerDef = $container->getDefinition($managerId);
$arguments = array( $typeConfig['model'], new Reference($finderId));
if (isset($typeConfig['repository'])) {
@ -399,9 +399,9 @@ class FOQElasticaExtension extends Extension
**/
protected function loadIndexManager(array $indexRefsByName, ContainerBuilder $container)
{
$managerDef = $container->getDefinition('foq_elastica.index_manager');
$managerDef = $container->getDefinition('fos_elastica.index_manager');
$managerDef->replaceArgument(0, $indexRefsByName);
$managerDef->replaceArgument(1, new Reference('foq_elastica.index'));
$managerDef->replaceArgument(1, new Reference('fos_elastica.index'));
}
/**
@ -411,7 +411,7 @@ class FOQElasticaExtension extends Extension
**/
protected function loadResetter(array $indexConfigs, ContainerBuilder $container)
{
$resetterDef = $container->getDefinition('foq_elastica.resetter');
$resetterDef = $container->getDefinition('fos_elastica.resetter');
$resetterDef->replaceArgument(0, $indexConfigs);
}
@ -439,7 +439,7 @@ class FOQElasticaExtension extends Extension
$defaultManagerService = $this->loadedDrivers[0];
}
$container->setAlias('foq_elastica.manager', sprintf('foq_elastica.manager.%s', $defaultManagerService));
$container->setAlias('fos_elastica.manager', sprintf('fos_elastica.manager.%s', $defaultManagerService));
}
}

View file

@ -1,10 +1,10 @@
<?php
namespace FOQ\ElasticaBundle\Doctrine;
namespace FOS\ElasticaBundle\Doctrine;
use FOQ\ElasticaBundle\HybridResult;
use FOQ\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface;
use FOQ\ElasticaBundle\Transformer\HighlightableModelInterface;
use FOS\ElasticaBundle\HybridResult;
use FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface;
use FOS\ElasticaBundle\Transformer\HighlightableModelInterface;
use Elastica_Document;
use Symfony\Component\Form\Util\PropertyPath;

View file

@ -1,10 +1,10 @@
<?php
namespace FOQ\ElasticaBundle\Doctrine;
namespace FOS\ElasticaBundle\Doctrine;
use Doctrine\Common\EventSubscriber;
use Doctrine\Common\Persistence\ObjectManager;
use FOQ\ElasticaBundle\Persister\ObjectPersisterInterface;
use FOS\ElasticaBundle\Persister\ObjectPersisterInterface;
abstract class AbstractListener implements EventSubscriber
{

View file

@ -1,10 +1,10 @@
<?php
namespace FOQ\ElasticaBundle\Doctrine;
namespace FOS\ElasticaBundle\Doctrine;
use Doctrine\Common\Persistence\ManagerRegistry;
use FOQ\ElasticaBundle\Persister\ObjectPersisterInterface;
use FOQ\ElasticaBundle\Provider\AbstractProvider as BaseAbstractProvider;
use FOS\ElasticaBundle\Persister\ObjectPersisterInterface;
use FOS\ElasticaBundle\Provider\AbstractProvider as BaseAbstractProvider;
abstract class AbstractProvider extends BaseAbstractProvider
{
@ -29,7 +29,7 @@ abstract class AbstractProvider extends BaseAbstractProvider
}
/**
* @see FOQ\ElasticaBundle\Provider\ProviderInterface::populate()
* @see FOS\ElasticaBundle\Provider\ProviderInterface::populate()
*/
public function populate(\Closure $loggerClosure = null)
{

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Doctrine\MongoDB;
namespace FOS\ElasticaBundle\Doctrine\MongoDB;
use FOQ\ElasticaBundle\Doctrine\AbstractElasticaToModelTransformer;
use FOS\ElasticaBundle\Doctrine\AbstractElasticaToModelTransformer;
use Elastica_Document;
/**

View file

@ -1,9 +1,9 @@
<?php
namespace FOQ\ElasticaBundle\Doctrine\MongoDB;
namespace FOS\ElasticaBundle\Doctrine\MongoDB;
use Doctrine\ODM\MongoDB\Event\LifecycleEventArgs;
use FOQ\ElasticaBundle\Doctrine\AbstractListener;
use FOS\ElasticaBundle\Doctrine\AbstractListener;
class Listener extends AbstractListener
{

View file

@ -1,15 +1,15 @@
<?php
namespace FOQ\ElasticaBundle\Doctrine\MongoDB;
namespace FOS\ElasticaBundle\Doctrine\MongoDB;
use Doctrine\ODM\MongoDB\Query\Builder;
use FOQ\ElasticaBundle\Doctrine\AbstractProvider;
use FOQ\ElasticaBundle\Exception\InvalidArgumentTypeException;
use FOS\ElasticaBundle\Doctrine\AbstractProvider;
use FOS\ElasticaBundle\Exception\InvalidArgumentTypeException;
class Provider extends AbstractProvider
{
/**
* @see FOQ\ElasticaBundle\Doctrine\AbstractProvider::countObjects()
* @see FOS\ElasticaBundle\Doctrine\AbstractProvider::countObjects()
*/
protected function countObjects($queryBuilder)
{
@ -23,7 +23,7 @@ class Provider extends AbstractProvider
}
/**
* @see FOQ\ElasticaBundle\Doctrine\AbstractProvider::fetchSlice()
* @see FOS\ElasticaBundle\Doctrine\AbstractProvider::fetchSlice()
*/
protected function fetchSlice($queryBuilder, $limit, $offset)
{
@ -40,7 +40,7 @@ class Provider extends AbstractProvider
}
/**
* @see FOQ\ElasticaBundle\Doctrine\AbstractProvider::createQueryBuilder()
* @see FOS\ElasticaBundle\Doctrine\AbstractProvider::createQueryBuilder()
*/
protected function createQueryBuilder()
{

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Doctrine\ORM;
namespace FOS\ElasticaBundle\Doctrine\ORM;
use FOQ\ElasticaBundle\Doctrine\AbstractElasticaToModelTransformer;
use FOS\ElasticaBundle\Doctrine\AbstractElasticaToModelTransformer;
use Elastica_Document;
use Doctrine\ORM\Query;

View file

@ -1,9 +1,9 @@
<?php
namespace FOQ\ElasticaBundle\Doctrine\ORM;
namespace FOS\ElasticaBundle\Doctrine\ORM;
use Doctrine\ORM\Event\LifecycleEventArgs;
use FOQ\ElasticaBundle\Doctrine\AbstractListener;
use FOS\ElasticaBundle\Doctrine\AbstractListener;
class Listener extends AbstractListener
{

View file

@ -1,15 +1,15 @@
<?php
namespace FOQ\ElasticaBundle\Doctrine\ORM;
namespace FOS\ElasticaBundle\Doctrine\ORM;
use Doctrine\ORM\QueryBuilder;
use FOQ\ElasticaBundle\Doctrine\AbstractProvider;
use FOQ\ElasticaBundle\Exception\InvalidArgumentTypeException;
use FOS\ElasticaBundle\Doctrine\AbstractProvider;
use FOS\ElasticaBundle\Exception\InvalidArgumentTypeException;
class Provider extends AbstractProvider
{
/**
* @see FOQ\ElasticaBundle\Doctrine\AbstractProvider::countObjects()
* @see FOS\ElasticaBundle\Doctrine\AbstractProvider::countObjects()
*/
protected function countObjects($queryBuilder)
{
@ -31,7 +31,7 @@ class Provider extends AbstractProvider
}
/**
* @see FOQ\ElasticaBundle\Doctrine\AbstractProvider::fetchSlice()
* @see FOS\ElasticaBundle\Doctrine\AbstractProvider::fetchSlice()
*/
protected function fetchSlice($queryBuilder, $limit, $offset)
{
@ -47,7 +47,7 @@ class Provider extends AbstractProvider
}
/**
* @see FOQ\ElasticaBundle\Doctrine\AbstractProvider::createQueryBuilder()
* @see FOS\ElasticaBundle\Doctrine\AbstractProvider::createQueryBuilder()
*/
protected function createQueryBuilder()
{

View file

@ -1,11 +1,11 @@
<?php
namespace FOQ\ElasticaBundle\Doctrine;
namespace FOS\ElasticaBundle\Doctrine;
use Doctrine\Common\Annotations\Reader;
use Doctrine\Common\Persistence\ManagerRegistry;
use FOQ\ElasticaBundle\Finder\FinderInterface;
use FOQ\ElasticaBundle\Manager\RepositoryManager as BaseManager;
use FOS\ElasticaBundle\Finder\FinderInterface;
use FOS\ElasticaBundle\Manager\RepositoryManager as BaseManager;
/**
* @author Richard Miller <info@limethinking.co.uk>

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\Exception;
namespace FOS\ElasticaBundle\Exception;
class InvalidArgumentTypeException extends \InvalidArgumentException
{

View file

@ -1,14 +1,14 @@
<?php
namespace FOQ\ElasticaBundle;
namespace FOS\ElasticaBundle;
use FOQ\ElasticaBundle\DependencyInjection\Compiler\RegisterProvidersPass;
use FOQ\ElasticaBundle\DependencyInjection\Compiler\TransformerPass;
use FOS\ElasticaBundle\DependencyInjection\Compiler\RegisterProvidersPass;
use FOS\ElasticaBundle\DependencyInjection\Compiler\TransformerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class FOQElasticaBundle extends Bundle
class FOSElasticaBundle extends Bundle
{
/**
* @see Symfony\Component\HttpKernel\Bundle\Bundle::build()

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\Finder;
namespace FOS\ElasticaBundle\Finder;
interface FinderInterface
{

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Finder;
namespace FOS\ElasticaBundle\Finder;
use FOQ\ElasticaBundle\Paginator\PaginatorAdapterInterface;
use FOS\ElasticaBundle\Paginator\PaginatorAdapterInterface;
use Pagerfanta\Pagerfanta;
use Elastica_Query;

View file

@ -1,12 +1,12 @@
<?php
namespace FOQ\ElasticaBundle\Finder;
namespace FOS\ElasticaBundle\Finder;
use FOQ\ElasticaBundle\Finder\FinderInterface;
use FOQ\ElasticaBundle\Finder\PaginatedFinderInterface;
use FOQ\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface;
use FOQ\ElasticaBundle\Paginator\TransformedPaginatorAdapter;
use FOQ\ElasticaBundle\Paginator\FantaPaginatorAdapter;
use FOS\ElasticaBundle\Finder\FinderInterface;
use FOS\ElasticaBundle\Finder\PaginatedFinderInterface;
use FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface;
use FOS\ElasticaBundle\Paginator\TransformedPaginatorAdapter;
use FOS\ElasticaBundle\Paginator\FantaPaginatorAdapter;
use Pagerfanta\Pagerfanta;
use Elastica_Searchable;
use Elastica_Query;

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle;
namespace FOS\ElasticaBundle;
use Elastica_Result;

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle;
namespace FOS\ElasticaBundle;
class IndexManager
{

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\Logger;
namespace FOS\ElasticaBundle\Logger;
use Symfony\Component\HttpKernel\Log\LoggerInterface;

View file

@ -1,9 +1,9 @@
<?php
namespace FOQ\ElasticaBundle\Manager;
namespace FOS\ElasticaBundle\Manager;
use Doctrine\Common\Annotations\Reader;
use FOQ\ElasticaBundle\Finder\FinderInterface;
use FOS\ElasticaBundle\Finder\FinderInterface;
use RuntimeException;
/**
* @author Richard Miller <info@limethinking.co.uk>
@ -58,14 +58,14 @@ class RepositoryManager implements RepositoryManagerInterface
}
$refClass = new \ReflectionClass($entityName);
$annotation = $this->reader->getClassAnnotation($refClass, 'FOQ\\ElasticaBundle\\Configuration\\Search');
$annotation = $this->reader->getClassAnnotation($refClass, 'FOS\\ElasticaBundle\\Configuration\\Search');
if ($annotation) {
$this->entities[$entityName]['repositoryName']
= $annotation->repositoryClass;
return $annotation->repositoryClass;
}
return 'FOQ\ElasticaBundle\Repository';
return 'FOS\ElasticaBundle\Repository';
}
private function createRepository($entityName)

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Manager;
namespace FOS\ElasticaBundle\Manager;
use FOQ\ElasticaBundle\Finder\FinderInterface;
use FOS\ElasticaBundle\Finder\FinderInterface;
/**
* @author Richard Miller <info@limethinking.co.uk>

View file

@ -1,9 +1,9 @@
<?php
namespace FOQ\ElasticaBundle\Paginator;
namespace FOS\ElasticaBundle\Paginator;
use Pagerfanta\Adapter\AdapterInterface;
use FOQ\ElasticaBundle\Paginator\PaginatorAdapterInterface;
use FOS\ElasticaBundle\Paginator\PaginatorAdapterInterface;
class FantaPaginatorAdapter implements AdapterInterface
{

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\Paginator;
namespace FOS\ElasticaBundle\Paginator;
interface PaginatorAdapterInterface
{
@ -19,7 +19,7 @@ interface PaginatorAdapterInterface
* @param integer $offset The offset.
* @param integer $length The length.
*
* @return FOQ\ElasticaBundle\Paginator\PartialResults
* @return FOS\ElasticaBundle\Paginator\PartialResults
*
* @api
*/

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\Paginator;
namespace FOS\ElasticaBundle\Paginator;
interface PartialResultsInterface
{

View file

@ -1,11 +1,11 @@
<?php
namespace FOQ\ElasticaBundle\Paginator;
namespace FOS\ElasticaBundle\Paginator;
use Elastica_Searchable;
use Elastica_Query;
use FOQ\ElasticaBundle\Paginator\PaginatorAdapterInterface;
use FOQ\ElasticaBundle\Paginator\RawPartialResults;
use FOS\ElasticaBundle\Paginator\PaginatorAdapterInterface;
use FOS\ElasticaBundle\Paginator\RawPartialResults;
/**
* Allows pagination of Elastica_Query. Does not map results
@ -51,7 +51,7 @@ class RawPaginatorAdapter implements PaginatorAdapterInterface
/**
* Returns the paginated results.
*
* @return FOQ\ElasticaBundle\Paginator\PartialResultInterface
* @return FOS\ElasticaBundle\Paginator\PartialResultInterface
*/
public function getResults($offset, $itemCountPerPage)
{

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Paginator;
namespace FOS\ElasticaBundle\Paginator;
use FOQ\ElasticaBundle\Paginator\PartialResultsInterface;
use FOS\ElasticaBundle\Paginator\PartialResultsInterface;
use Elastica_ResultSet;
/**

View file

@ -1,9 +1,9 @@
<?php
namespace FOQ\ElasticaBundle\Paginator;
namespace FOS\ElasticaBundle\Paginator;
use FOQ\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface;
use FOQ\ElasticaBundle\Paginator\TransformedPartialResults;
use FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface;
use FOS\ElasticaBundle\Paginator\TransformedPartialResults;
use Elastica_Searchable;
use Elastica_Query;

View file

@ -1,9 +1,9 @@
<?php
namespace FOQ\ElasticaBundle\Paginator;
namespace FOS\ElasticaBundle\Paginator;
use FOQ\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface;
use FOQ\ElasticaBundle\Paginator\RawPartialResults;
use FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface;
use FOS\ElasticaBundle\Paginator\RawPartialResults;
use Elastica_ResultSet;
/**
@ -15,7 +15,7 @@ class TransformedPartialResults extends RawPartialResults
/**
* @param \Elastica_ResultSet $resultSet
* @param \FOQ\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface $transformer
* @param \FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface $transformer
*/
public function __construct(Elastica_ResultSet $resultSet, ElasticaToModelTransformerInterface $transformer)
{

View file

@ -1,9 +1,9 @@
<?php
namespace FOQ\ElasticaBundle\Persister;
namespace FOS\ElasticaBundle\Persister;
use FOQ\ElasticaBundle\Provider\ProviderInterface;
use FOQ\ElasticaBundle\Transformer\ModelToElasticaTransformerInterface;
use FOS\ElasticaBundle\Provider\ProviderInterface;
use FOS\ElasticaBundle\Transformer\ModelToElasticaTransformerInterface;
use Symfony\Component\HttpKernel\Log\LoggerInterface;
use Elastica_Type;
use Elastica_Document;

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\Persister;
namespace FOS\ElasticaBundle\Persister;
/**
* Inserts, replaces and deletes single documents in an elastica type

View file

@ -1,9 +1,9 @@
<?php
namespace FOQ\ElasticaBundle\Propel;
namespace FOS\ElasticaBundle\Propel;
use FOQ\ElasticaBundle\HybridResult;
use FOQ\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface;
use FOS\ElasticaBundle\HybridResult;
use FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface;
use Elastica_Document;
use Symfony\Component\Form\Util\PropertyPath;

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Propel;
namespace FOS\ElasticaBundle\Propel;
use FOQ\ElasticaBundle\Provider\AbstractProvider;
use FOS\ElasticaBundle\Provider\AbstractProvider;
/**
* Propel provider
@ -12,7 +12,7 @@ use FOQ\ElasticaBundle\Provider\AbstractProvider;
class Provider extends AbstractProvider
{
/**
* @see FOQ\ElasticaBundle\Provider\ProviderInterface::populate()
* @see FOS\ElasticaBundle\Provider\ProviderInterface::populate()
*/
public function populate(\Closure $loggerClosure = null)
{

View file

@ -1,9 +1,9 @@
<?php
namespace FOQ\ElasticaBundle\Provider;
namespace FOS\ElasticaBundle\Provider;
use FOQ\ElasticaBundle\Persister\ObjectPersisterInterface;
use FOQ\ElasticaBundle\Provider\ProviderInterface;
use FOS\ElasticaBundle\Persister\ObjectPersisterInterface;
use FOS\ElasticaBundle\Provider\ProviderInterface;
abstract class AbstractProvider implements ProviderInterface
{

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\Provider;
namespace FOS\ElasticaBundle\Provider;
/**
* Insert application domain objects into elastica types

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\Provider;
namespace FOS\ElasticaBundle\Provider;
use Symfony\Component\DependencyInjection\ContainerBuilder;

120
README.md
View file

@ -43,25 +43,25 @@ Use the master branch with Symfony2 master only, use the 2.0 branch with Symfony
**With submodule**
`git submodule add git://github.com/Exercise/FOQElasticaBundle vendor/bundles/FOQ/ElasticaBundle`
`git submodule add git://github.com/Exercise/FOSElasticaBundle vendor/bundles/FOS/ElasticaBundle`
**With clone**
`git clone git://github.com/Exercise/FOQElasticaBundle vendor/bundles/FOQ/ElasticaBundle`
`git clone git://github.com/Exercise/FOSElasticaBundle vendor/bundles/FOS/ElasticaBundle`
**With the vendors script**
Add the following lines to your deps file:
[FOQElasticaBundle]
git=git://github.com/Exercise/FOQElasticaBundle.git
target=bundles/FOQ/ElasticaBundle
[FOSElasticaBundle]
git=git://github.com/Exercise/FOSElasticaBundle.git
target=bundles/FOS/ElasticaBundle
For the 2.0 branch for use with Symfony2.0.x releases add the following:
[FOQElasticaBundle]
git=git://github.com/Exercise/FOQElasticaBundle.git
target=bundles/FOQ/ElasticaBundle
[FOSElasticaBundle]
git=git://github.com/Exercise/FOSElasticaBundle.git
target=bundles/FOS/ElasticaBundle
version=origin/2.0
Run the vendors script:
@ -75,7 +75,7 @@ $ php bin/vendors install
$loader->registerNamespaces(array(
...
'FOQ' => __DIR__.'/../vendor/bundles',
'FOS' => __DIR__.'/../vendor/bundles',
));
#### Register the bundle
@ -86,7 +86,7 @@ $ php bin/vendors install
{
return array(
// ...
new FOQ\ElasticaBundle\FOQElasticaBundle(),
new FOS\ElasticaBundle\FOSElasticaBundle(),
// ...
);
}
@ -99,7 +99,7 @@ Elasticsearch client is comparable to a database connection.
Most of the time, you will need only one.
#app/config/config.yml
foq_elastica:
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
@ -108,7 +108,7 @@ Most of the time, you will need only one.
Elasticsearch index is comparable to Doctrine entity manager.
Most of the time, you will need only one.
foq_elastica:
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
@ -117,14 +117,14 @@ Most of the time, you will need only one.
Here we created a "website" index, that uses our "default" client.
Our index is now available as a service: `foq_elastica.index.website`. It is an instance of `Elastica_Index`.
Our index is now available as a service: `fos_elastica.index.website`. It is an instance of `Elastica_Index`.
If you need to have different index name from the service name, for example,
in order to have different indexes for different environments then you can
use the ```index_name``` key to change the index name. The service name will
remain the same across the environments:
foq_elastica:
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
@ -132,13 +132,13 @@ remain the same across the environments:
client: default
index_name: website_qa
The service id will be `foq_elastica.index.website` but the underlying index name is website_qa.
The service id will be `fos_elastica.index.website` but the underlying index name is website_qa.
#### Declare a type
Elasticsearch type is comparable to Doctrine entity repository.
foq_elastica:
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
@ -152,11 +152,11 @@ Elasticsearch type is comparable to Doctrine entity repository.
lastName: { boost: 3 }
aboutMe: ~
Our type is now available as a service: `foq_elastica.index.website.user`. It is an instance of `Elastica_Type`.
Our type is now available as a service: `fos_elastica.index.website.user`. It is an instance of `Elastica_Type`.
### Declaring parent field
foq_elastica:
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
@ -171,7 +171,7 @@ Our type is now available as a service: `foq_elastica.index.website.user`. It is
### Declaring `nested` or `object`
foq_elastica:
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
@ -191,7 +191,7 @@ Our type is now available as a service: `foq_elastica.index.website.user`. It is
### Populate the types
php app/console foq:elastica:populate
php app/console fos:elastica:populate
This command deletes and creates the declared indexes and types.
It applies the configured mappings to the types.
@ -206,7 +206,7 @@ Or, for complete flexibility, go for manual provider.
If we want to index the entities from a Doctrine repository or a Propel query,
some configuration will let ElasticaBundle do it for us.
foq_elastica:
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
@ -262,21 +262,21 @@ You can change this value in the persistence configuration.
#### Manual provider
Create a service with the tag "foq_elastica.provider" and attributes for the
Create a service with the tag "fos_elastica.provider" and attributes for the
index and type for which the service will provide.
<service id="acme.search_provider.user" class="Acme\UserBundle\Search\UserProvider">
<tag name="foq_elastica.provider" index="website" type="user" />
<argument type="service" id="foq_elastica.index.website.user" />
<tag name="fos_elastica.provider" index="website" type="user" />
<argument type="service" id="fos_elastica.index.website.user" />
</service>
Its class must implement `FOQ\ElasticaBundle\Provider\ProviderInterface`.
Its class must implement `FOS\ElasticaBundle\Provider\ProviderInterface`.
<?php
namespace Acme\UserBundle\Provider;
use FOQ\ElasticaBundle\Provider\ProviderInterface;
use FOS\ElasticaBundle\Provider\ProviderInterface;
use Elastica_Type;
class UserProvider implements ProviderInterface
@ -305,14 +305,14 @@ Its class must implement `FOQ\ElasticaBundle\Provider\ProviderInterface`.
}
}
You will find a more complete implementation example in `src/FOQ/ElasticaBundle/Doctrine/AbstractProvider.php`.
You will find a more complete implementation example in `src/FOS/ElasticaBundle/Doctrine/AbstractProvider.php`.
### Search
You can just use the index and type Elastica objects, provided as services, to perform searches.
/** var Elastica_Type */
$userType = $this->container->get('foq_elastica.index.website.user');
$userType = $this->container->get('fos_elastica.index.website.user');
/** var Elastica_ResultSet */
$resultSet = $userType->search('bob');
@ -323,7 +323,7 @@ If your elasticsearch type is bound to a Doctrine entity repository or a Propel
you can get your entities instead of Elastica results when you perform a search.
Declare that you want a Doctrine/Propel finder in your configuration:
foq_elastica:
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
@ -339,10 +339,10 @@ Declare that you want a Doctrine/Propel finder in your configuration:
provider: ~
finder: ~
You can now use the `foq_elastica.finder.website.user` service:
You can now use the `fos_elastica.finder.website.user` service:
/** var FOQ\ElasticaBundle\Finder\TransformedFinder */
$finder = $container->get('foq_elastica.finder.website.user');
/** var FOS\ElasticaBundle\Finder\TransformedFinder */
$finder = $container->get('fos_elastica.finder.website.user');
/** var array of Acme\UserBundle\Entity\User */
$users = $finder->find('bob');
@ -366,7 +366,7 @@ You can also get both the Elastica results and the entities together from the fi
You can then access the score, highlights etc. from the Elastica_Result whilst
still also getting the entity.
/** var array of FOQ\ElasticaBundle\HybridResult */
/** var array of FOS\ElasticaBundle\HybridResult */
$hybridResults = $finder->findHybrid('bob');
foreach ($hybridResults as $hybridResult) {
@ -382,16 +382,16 @@ still also getting the entity.
You can also define a finder that will work on the entire index. Adjust your index
configuration as per below:
foq_elastica:
fos_elastica:
indexes:
website:
client: default
finder: ~
You can now use the index wide finder service `foq_elastica.finder.website`:
You can now use the index wide finder service `fos_elastica.finder.website`:
/** var FOQ\ElasticaBundle\Finder\MappedFinder */
$finder = $container->get('foq_elastica.finder.website');
/** var FOS\ElasticaBundle\Finder\MappedFinder */
$finder = $container->get('fos_elastica.finder.website');
// Returns a mixed array of any objects mapped
$results = $finder->find('bob');
@ -403,10 +403,10 @@ can use a manager service for each driver and get a repository for an entity to
against. This allows you to use the same service rather than the particular finder. For
example:
/** var FOQ\ElasticaBundle\Manager\RepositoryManager */
$repositoryManager = $container->get('foq_elastica.manager.orm');
/** var FOS\ElasticaBundle\Manager\RepositoryManager */
$repositoryManager = $container->get('fos_elastica.manager.orm');
/** var FOQ\ElasticaBundle\Repository */
/** var FOS\ElasticaBundle\Repository */
$repository = $repositoryManager->getRepository('UserBundle:User');
/** var array of Acme\UserBundle\Entity\User */
@ -414,7 +414,7 @@ example:
You can also specify the full name of the entity instead of the shortcut syntax:
/** var FOQ\ElasticaBundle\Repository */
/** var FOS\ElasticaBundle\Repository */
$repository = $repositoryManager->getRepository('Application\UserBundle\Entity\User');
> The **2.0** branch doesn't support using `UserBundle:User` style syntax and you must use the full name of the entity. .
@ -422,21 +422,21 @@ You can also specify the full name of the entity instead of the shortcut syntax:
##### Default Manager
If you are only using one driver then its manager service is automatically aliased
to `foq_elastica.manager`. So the above example could be simplified to:
to `fos_elastica.manager`. So the above example could be simplified to:
/** var FOQ\ElasticaBundle\Manager\RepositoryManager */
$repositoryManager = $container->get('foq_elastica.manager');
/** var FOS\ElasticaBundle\Manager\RepositoryManager */
$repositoryManager = $container->get('fos_elastica.manager');
/** var FOQ\ElasticaBundle\Repository */
/** var FOS\ElasticaBundle\Repository */
$repository = $repositoryManager->getRepository('UserBundle:User');
/** var array of Acme\UserBundle\Entity\User */
$users = $repository->find('bob');
If you use multiple drivers then you can choose which one is aliased to `foq_elastica.manager`
If you use multiple drivers then you can choose which one is aliased to `fos_elastica.manager`
using the `default_manager` parameter:
foq_elastica:
fos_elastica:
default_manager: mongodb #defauults to orm
clients:
default: { host: localhost, port: 9200 }
@ -445,7 +445,7 @@ using the `default_manager` parameter:
##### Custom Repositories
As well as the default repository you can create a custom repository for an entity and add
methods for particular searches. These need to extend `FOQ\ElasticaBundle\Repository` to have
methods for particular searches. These need to extend `FOS\ElasticaBundle\Repository` to have
access to the finder:
```
@ -453,7 +453,7 @@ access to the finder:
namespace Acme\ElasticaBundle\SearchRepository;
use FOQ\ElasticaBundle\Repository;
use FOS\ElasticaBundle\Repository;
class UserRepository extends Repository
{
@ -467,7 +467,7 @@ class UserRepository extends Repository
To use the custom repository specify it in the mapping for the entity:
foq_elastica:
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
@ -486,10 +486,10 @@ To use the custom repository specify it in the mapping for the entity:
Then the custom queries will be available when using the repository returned from the manager:
/** var FOQ\ElasticaBundle\Manager\RepositoryManager */
$repositoryManager = $container->get('foq_elastica.manager');
/** var FOS\ElasticaBundle\Manager\RepositoryManager */
$repositoryManager = $container->get('fos_elastica.manager');
/** var FOQ\ElasticaBundle\Repository */
/** var FOS\ElasticaBundle\Repository */
$repository = $repositoryManager->getRepository('UserBundle:User');
/** var array of Acme\UserBundle\Entity\User */
@ -502,7 +502,7 @@ Alternatively you can specify the custom repository using an annotation in the e
namespace Application\UserBundle\Entity;
use FOQ\ElasticaBundle\Configuration\Search;
use FOS\ElasticaBundle\Configuration\Search;
/**
* @Search(repositoryClass="Acme\ElasticaBundle\SearchRepository\UserRepository")
@ -521,7 +521,7 @@ If you use the Doctrine integration, you can let ElasticaBundle update the index
when an object is added, updated or removed. It uses Doctrine lifecycle events.
Declare that you want to update the index in real time:
foq_elastica:
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
@ -583,7 +583,7 @@ The delete listener disregards the callback.
Any setting can be specified when declaring a type. For example, to enable a custom analyzer, you could write:
foq_elastica:
fos_elastica:
indexes:
doc:
settings:
@ -612,7 +612,7 @@ issuing a request will result in an `Elastica_Exception_Client` being thrown.
Depending on your needs, it may be desirable to suppress these exceptions and
allow searches to fail silently.
One way to achieve this is to override the `foq_elastica.client.class` service
One way to achieve this is to override the `fos_elastica.client.class` service
container parameter with a custom class. In the following example, we override
the `Client::request()` method and return the equivalent of an empty search
response if an exception occurred.
@ -622,7 +622,7 @@ response if an exception occurred.
namespace Acme\ElasticaBundle;
use FOQ\ElasticaBundle\Client as BaseClient;
use FOS\ElasticaBundle\Client as BaseClient;
class Client extends BaseClient
{
@ -648,7 +648,7 @@ Results must match at least one specified `categoryIds`, and should match the
apply to queries against the `title` field.
```php
$finder = $this->container->get('foq_elastica.finder.website.article');
$finder = $this->container->get('fos_elastica.finder.website.article');
$boolQuery = new \Elastica_Query_Bool();
$fieldQuery = new \Elastica_Query_Text();
@ -670,7 +670,7 @@ $data = $finder->find($boolQuery);
Configuration:
```yaml
foq_elastica:
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle;
namespace FOS\ElasticaBundle;
use FOQ\ElasticaBundle\Finder\PaginatedFinderInterface;
use FOS\ElasticaBundle\Finder\PaginatedFinderInterface;
/**
* @author Richard Miller <info@limethinking.co.uk>

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle;
namespace FOS\ElasticaBundle;
/**
* Deletes and recreates indexes

View file

@ -5,71 +5,71 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="foq_elastica.client.class">FOQ\ElasticaBundle\Client</parameter>
<parameter key="foq_elastica.index.class">Elastica_Index</parameter>
<parameter key="foq_elastica.type.class">Elastica_Type</parameter>
<parameter key="foq_elastica.logger.class">FOQ\ElasticaBundle\Logger\ElasticaLogger</parameter>
<parameter key="foq_elastica.data_collector.class">FOQ\ElasticaBundle\DataCollector\ElasticaDataCollector</parameter>
<parameter key="foq_elastica.manager.class">FOQ\ElasticaBundle\Manager\RepositoryManager</parameter>
<parameter key="foq_elastica.elastica_to_model_transformer.collection.class">FOQ\ElasticaBundle\Transformer\ElasticaToModelTransformerCollection</parameter>
<parameter key="foq_elastica.provider_registry.class">FOQ\ElasticaBundle\Provider\ProviderRegistry</parameter>
<parameter key="fos_elastica.client.class">FOS\ElasticaBundle\Client</parameter>
<parameter key="fos_elastica.index.class">Elastica_Index</parameter>
<parameter key="fos_elastica.type.class">Elastica_Type</parameter>
<parameter key="fos_elastica.logger.class">FOS\ElasticaBundle\Logger\ElasticaLogger</parameter>
<parameter key="fos_elastica.data_collector.class">FOS\ElasticaBundle\DataCollector\ElasticaDataCollector</parameter>
<parameter key="fos_elastica.manager.class">FOS\ElasticaBundle\Manager\RepositoryManager</parameter>
<parameter key="fos_elastica.elastica_to_model_transformer.collection.class">FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerCollection</parameter>
<parameter key="fos_elastica.provider_registry.class">FOS\ElasticaBundle\Provider\ProviderRegistry</parameter>
</parameters>
<services>
<service id="foq_elastica.logger" class="%foq_elastica.logger.class%">
<service id="fos_elastica.logger" class="%fos_elastica.logger.class%">
<argument type="service" id="logger" on-invalid="null" />
<argument>%kernel.debug%</argument>
<tag name="monolog.logger" channel="elastica" />
</service>
<service id="foq_elastica.data_collector" class="%foq_elastica.data_collector.class%" public="true">
<tag name="data_collector" template="FOQElasticaBundle:Collector:elastica" id="elastica" />
<argument type="service" id="foq_elastica.logger" />
<service id="fos_elastica.data_collector" class="%fos_elastica.data_collector.class%" public="true">
<tag name="data_collector" template="FOSElasticaBundle:Collector:elastica" id="elastica" />
<argument type="service" id="fos_elastica.logger" />
</service>
<service id="foq_elastica.client" class="%foq_elastica.client.class%">
<service id="fos_elastica.client" class="%fos_elastica.client.class%">
<argument /> <!-- config -->
<call method="setLogger">
<argument type="service" id="foq_elastica.logger" />
<argument type="service" id="fos_elastica.logger" />
</call>
</service>
<service id="foq_elastica.index_manager" class="FOQ\ElasticaBundle\IndexManager">
<service id="fos_elastica.index_manager" class="FOS\ElasticaBundle\IndexManager">
<argument /> <!-- indexes -->
<argument /> <!-- default index -->
</service>
<service id="foq_elastica.resetter" class="FOQ\ElasticaBundle\Resetter">
<service id="fos_elastica.resetter" class="FOS\ElasticaBundle\Resetter">
<argument /> <!-- index configs -->
</service>
<service id="foq_elastica.object_persister.prototype" class="FOQ\ElasticaBundle\Persister\ObjectPersister" abstract="true">
<service id="fos_elastica.object_persister.prototype" class="FOS\ElasticaBundle\Persister\ObjectPersister" abstract="true">
<argument /> <!-- type -->
<argument /> <!-- model to elastica transformer -->
<argument /> <!-- model -->
<argument /> <!-- properties mapping -->
</service>
<service id="foq_elastica.finder.prototype" class="FOQ\ElasticaBundle\Finder\TransformedFinder" public="true" abstract="true">
<service id="fos_elastica.finder.prototype" class="FOS\ElasticaBundle\Finder\TransformedFinder" public="true" abstract="true">
<argument /> <!-- searchable -->
<argument /> <!-- transformer -->
</service>
<service id="foq_elastica.model_to_elastica_transformer.prototype.auto" class="FOQ\ElasticaBundle\Transformer\ModelToElasticaAutoTransformer" public="false" abstract="true">
<service id="fos_elastica.model_to_elastica_transformer.prototype.auto" class="FOS\ElasticaBundle\Transformer\ModelToElasticaAutoTransformer" public="false" abstract="true">
<argument /> <!-- options -->
</service>
<service id="foq_elastica.elastica_to_model_transformer.collection.prototype" class="%foq_elastica.elastica_to_model_transformer.collection.class%" public="true" abstract="true">
<service id="fos_elastica.elastica_to_model_transformer.collection.prototype" class="%fos_elastica.elastica_to_model_transformer.collection.class%" public="true" abstract="true">
<argument type="collection" /> <!-- transformers -->
</service>
<service id="foq_elastica.provider_registry" class="%foq_elastica.provider_registry.class%">
<service id="fos_elastica.provider_registry" class="%fos_elastica.provider_registry.class%">
<call method="setContainer">
<argument type="service" id="service_container" />
</call>
</service>
<service id="foq_elastica.paginator.subscriber" class="FOQ\ElasticaBundle\Subscriber\PaginateElasticaQuerySubscriber">
<service id="fos_elastica.paginator.subscriber" class="FOS\ElasticaBundle\Subscriber\PaginateElasticaQuerySubscriber">
<tag name="knp_paginator.subscriber" />
</service>
</services>

View file

@ -6,27 +6,27 @@
<services>
<service id="foq_elastica.provider.prototype.mongodb" class="FOQ\ElasticaBundle\Doctrine\MongoDB\Provider" public="true" abstract="true">
<service id="fos_elastica.provider.prototype.mongodb" class="FOS\ElasticaBundle\Doctrine\MongoDB\Provider" public="true" abstract="true">
<argument /> <!-- object persister -->
<argument /> <!-- model -->
<argument type="collection" /> <!-- options -->
<argument type="service" id="doctrine_mongodb" />
</service>
<service id="foq_elastica.listener.prototype.mongodb" class="FOQ\ElasticaBundle\Doctrine\MongoDB\Listener" public="false" abstract="true">
<service id="fos_elastica.listener.prototype.mongodb" class="FOS\ElasticaBundle\Doctrine\MongoDB\Listener" public="false" abstract="true">
<argument /> <!-- object persister -->
<argument /> <!-- model -->
<argument type="collection" /> <!-- events -->
<argument/> <!-- identifier -->
</service>
<service id="foq_elastica.elastica_to_model_transformer.prototype.mongodb" class="FOQ\ElasticaBundle\Doctrine\MongoDB\ElasticaToModelTransformer" public="false">
<service id="fos_elastica.elastica_to_model_transformer.prototype.mongodb" class="FOS\ElasticaBundle\Doctrine\MongoDB\ElasticaToModelTransformer" public="false">
<argument type="service" id="doctrine_mongodb" />
<argument /> <!-- model -->
<argument type="collection" /> <!-- options -->
</service>
<service id="foq_elastica.manager.mongodb" class="FOQ\ElasticaBundle\Doctrine\RepositoryManager">
<service id="fos_elastica.manager.mongodb" class="FOS\ElasticaBundle\Doctrine\RepositoryManager">
<argument type="service" id="doctrine_mongodb"/>
<argument type="service" id="annotation_reader"/>
</service>

View file

@ -6,14 +6,14 @@
<services>
<service id="foq_elastica.provider.prototype.orm" class="FOQ\ElasticaBundle\Doctrine\ORM\Provider" public="true" abstract="true">
<service id="fos_elastica.provider.prototype.orm" class="FOS\ElasticaBundle\Doctrine\ORM\Provider" public="true" abstract="true">
<argument /> <!-- object persister -->
<argument /> <!-- model -->
<argument type="collection" /> <!-- options -->
<argument type="service" id="doctrine" />
</service>
<service id="foq_elastica.listener.prototype.orm" class="FOQ\ElasticaBundle\Doctrine\ORM\Listener" public="false" abstract="true">
<service id="fos_elastica.listener.prototype.orm" class="FOS\ElasticaBundle\Doctrine\ORM\Listener" public="false" abstract="true">
<argument /> <!-- object persister -->
<argument /> <!-- model -->
<argument type="collection" /> <!-- events -->
@ -21,13 +21,13 @@
<argument /> <!-- check method -->
</service>
<service id="foq_elastica.elastica_to_model_transformer.prototype.orm" class="FOQ\ElasticaBundle\Doctrine\ORM\ElasticaToModelTransformer" public="false">
<service id="fos_elastica.elastica_to_model_transformer.prototype.orm" class="FOS\ElasticaBundle\Doctrine\ORM\ElasticaToModelTransformer" public="false">
<argument type="service" id="doctrine" />
<argument /> <!-- model -->
<argument type="collection" /> <!-- options -->
</service>
<service id="foq_elastica.manager.orm" class="FOQ\ElasticaBundle\Doctrine\RepositoryManager">
<service id="fos_elastica.manager.orm" class="FOS\ElasticaBundle\Doctrine\RepositoryManager">
<argument type="service" id="doctrine"/>
<argument type="service" id="annotation_reader"/>
</service>

View file

@ -5,18 +5,18 @@
<services>
<service id="foq_elastica.provider.prototype.propel" class="FOQ\ElasticaBundle\Propel\Provider" public="true" abstract="true">
<service id="fos_elastica.provider.prototype.propel" class="FOS\ElasticaBundle\Propel\Provider" public="true" abstract="true">
<argument /> <!-- object persister -->
<argument /> <!-- model -->
<argument type="collection" /> <!-- options -->
</service>
<service id="foq_elastica.elastica_to_model_transformer.prototype.propel" class="FOQ\ElasticaBundle\Propel\ElasticaToModelTransformer" public="false">
<service id="fos_elastica.elastica_to_model_transformer.prototype.propel" class="FOS\ElasticaBundle\Propel\ElasticaToModelTransformer" public="false">
<argument /> <!-- model -->
<argument type="collection" /> <!-- options -->
</service>
<service id="foq_elastica.manager.propel" class="%foq_elastica.manager.class%">
<service id="fos_elastica.manager.propel" class="%fos_elastica.manager.class%">
<argument type="service" id="annotation_reader"/>
</service>

View file

@ -20,7 +20,7 @@
{% block menu %}
<span class="label">
<span class="icon"><img src="{{ asset('bundles/foqelastica/images/elastica.png') }}" alt="" /></span>
<span class="icon"><img src="{{ asset('bundles/foselastica/images/elastica.png') }}" alt="" /></span>
<strong>Elastica</strong>
<span class="count">
<span>{{ collector.querycount }}</span>

View file

@ -1,10 +1,10 @@
<?php
namespace FOQ\ElasticaBundle\Subscriber;
namespace FOS\ElasticaBundle\Subscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Knp\Component\Pager\Event\ItemsEvent;
use FOQ\ElasticaBundle\Paginator\PaginatorAdapterInterface;
use FOS\ElasticaBundle\Paginator\PaginatorAdapterInterface;
class PaginateElasticaQuerySubscriber implements EventSubscriberInterface
{

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Tests\DataCollector;
namespace FOS\ElasticaBundle\Tests\DataCollector;
use FOQ\ElasticaBundle\DataCollector\ElasticaDataCollector;
use FOS\ElasticaBundle\DataCollector\ElasticaDataCollector;
/**
* @author Richard Miller <info@limethinking.co.uk>
@ -20,7 +20,7 @@ class ElasticaDataCollectorTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMock();
$loggerMock = $this->getMockBuilder('FOQ\ElasticaBundle\Logger\ElasticaLogger')
$loggerMock = $this->getMockBuilder('FOS\ElasticaBundle\Logger\ElasticaLogger')
->disableOriginalConstructor()
->getMock();
@ -45,7 +45,7 @@ class ElasticaDataCollectorTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMock();
$loggerMock = $this->getMockBuilder('FOQ\ElasticaBundle\Logger\ElasticaLogger')
$loggerMock = $this->getMockBuilder('FOS\ElasticaBundle\Logger\ElasticaLogger')
->disableOriginalConstructor()
->getMock();
@ -70,7 +70,7 @@ class ElasticaDataCollectorTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMock();
$loggerMock = $this->getMockBuilder('FOQ\ElasticaBundle\Logger\ElasticaLogger')
$loggerMock = $this->getMockBuilder('FOS\ElasticaBundle\Logger\ElasticaLogger')
->disableOriginalConstructor()
->getMock();

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Tests\DependencyInjection\Compiler;
namespace FOS\ElasticaBundle\Tests\DependencyInjection\Compiler;
use FOQ\ElasticaBundle\DependencyInjection\Compiler\RegisterProvidersPass;
use FOS\ElasticaBundle\DependencyInjection\Compiler\RegisterProvidersPass;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@ -15,8 +15,8 @@ class RegisterProvidersPassTest extends \PHPUnit_Framework_TestCase
$registryDefinition = new Definition();
$container->setDefinition('foq_elastica.provider_registry', $registryDefinition);
$container->setAlias('foq_elastica.index', 'foq_elastica.index.foo');
$container->setDefinition('fos_elastica.provider_registry', $registryDefinition);
$container->setAlias('fos_elastica.index', 'fos_elastica.index.foo');
$container->setDefinition('provider.foo.a', $this->createProviderDefinition(array('type' => 'a')));
$container->setDefinition('provider.foo.b', $this->createProviderDefinition(array('index' => 'foo', 'type' => 'b')));
@ -39,8 +39,8 @@ class RegisterProvidersPassTest extends \PHPUnit_Framework_TestCase
$container = new ContainerBuilder();
$pass = new RegisterProvidersPass();
$container->setDefinition('foq_elastica.provider_registry', new Definition());
$container->setAlias('foq_elastica.index', 'foq_elastica.index.foo');
$container->setDefinition('fos_elastica.provider_registry', new Definition());
$container->setAlias('fos_elastica.index', 'fos_elastica.index.foo');
$providerDef = $this->createProviderDefinition();
$providerDef->setClass('stdClass');
@ -58,8 +58,8 @@ class RegisterProvidersPassTest extends \PHPUnit_Framework_TestCase
$container = new ContainerBuilder();
$pass = new RegisterProvidersPass();
$container->setDefinition('foq_elastica.provider_registry', new Definition());
$container->setAlias('foq_elastica.index', 'foq_elastica.index.foo');
$container->setDefinition('fos_elastica.provider_registry', new Definition());
$container->setAlias('fos_elastica.index', 'fos_elastica.index.foo');
$container->setDefinition('provider.foo.a', $this->createProviderDefinition());
@ -68,10 +68,10 @@ class RegisterProvidersPassTest extends \PHPUnit_Framework_TestCase
private function createProviderDefinition(array $attributes = array())
{
$provider = $this->getMock('FOQ\ElasticaBundle\Provider\ProviderInterface');
$provider = $this->getMock('FOS\ElasticaBundle\Provider\ProviderInterface');
$definition = new Definition(get_class($provider));
$definition->addTag('foq_elastica.provider', $attributes);
$definition->addTag('fos_elastica.provider', $attributes);
return $definition;
}

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\Tests\Doctrine;
namespace FOS\ElasticaBundle\Tests\Doctrine;
/**
* @author Richard Miller <info@limethinking.co.uk>
@ -154,7 +154,7 @@ abstract class AbstractListenerTest extends \PHPUnit_Framework_TestCase
*/
public function testInvalidIsIndexableCallbacks($isIndexableCallback)
{
$listener = $this->createListener($this->getMockPersister(), 'FOQ\ElasticaBundle\Tests\Doctrine\Listener\Entity', array());
$listener = $this->createListener($this->getMockPersister(), 'FOS\ElasticaBundle\Tests\Doctrine\Listener\Entity', array());
$listener->setIsIndexableCallback($isIndexableCallback);
}
@ -214,11 +214,11 @@ abstract class AbstractListenerTest extends \PHPUnit_Framework_TestCase
private function getMockPersister()
{
return $this->getMock('FOQ\ElasticaBundle\Persister\ObjectPersisterInterface');
return $this->getMock('FOS\ElasticaBundle\Persister\ObjectPersisterInterface');
}
}
namespace FOQ\ElasticaBundle\Tests\Doctrine\Listener;
namespace FOS\ElasticaBundle\Tests\Doctrine\Listener;
class Entity
{

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\Tests\Doctrine;
namespace FOS\ElasticaBundle\Tests\Doctrine;
class AbstractProviderTest extends \PHPUnit_Framework_TestCase
{
@ -136,11 +136,11 @@ class AbstractProviderTest extends \PHPUnit_Framework_TestCase
}
/**
* @return FOQ\ElasticaBundle\Doctrine\AbstractProvider
* @return FOS\ElasticaBundle\Doctrine\AbstractProvider
*/
private function getMockAbstractProvider()
{
return $this->getMockForAbstractClass('FOQ\ElasticaBundle\Doctrine\AbstractProvider', array(
return $this->getMockForAbstractClass('FOS\ElasticaBundle\Doctrine\AbstractProvider', array(
$this->objectPersister,
$this->objectClass,
$this->options,
@ -157,7 +157,7 @@ class AbstractProviderTest extends \PHPUnit_Framework_TestCase
}
/**
* @return FOQ\ElasticaBundle\Tests\Doctrine\ObjectManager
* @return FOS\ElasticaBundle\Tests\Doctrine\ObjectManager
*/
private function getMockObjectManager()
{
@ -165,11 +165,11 @@ class AbstractProviderTest extends \PHPUnit_Framework_TestCase
}
/**
* @return FOQ\ElasticaBundle\Persister\ObjectPersisterInterface
* @return FOS\ElasticaBundle\Persister\ObjectPersisterInterface
*/
private function getMockObjectPersister()
{
return $this->getMock('FOQ\ElasticaBundle\Persister\ObjectPersisterInterface');
return $this->getMock('FOS\ElasticaBundle\Persister\ObjectPersisterInterface');
}
}

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Tests\Doctrine\MongoDB;
namespace FOS\ElasticaBundle\Tests\Doctrine\MongoDB;
use FOQ\ElasticaBundle\Tests\Doctrine\AbstractListenerTest;
use FOS\ElasticaBundle\Tests\Doctrine\AbstractListenerTest;
class ListenerTest extends AbstractListenerTest
{
@ -25,7 +25,7 @@ class ListenerTest extends AbstractListenerTest
protected function getListenerClass()
{
return 'FOQ\ElasticaBundle\Doctrine\MongoDB\Listener';
return 'FOS\ElasticaBundle\Doctrine\MongoDB\Listener';
}
protected function getObjectManagerClass()

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Tests\Doctrine\ORM;
namespace FOS\ElasticaBundle\Tests\Doctrine\ORM;
use FOQ\ElasticaBundle\Tests\Doctrine\AbstractListenerTest;
use FOS\ElasticaBundle\Tests\Doctrine\AbstractListenerTest;
class ListenerTest extends AbstractListenerTest
{
@ -25,7 +25,7 @@ class ListenerTest extends AbstractListenerTest
protected function getListenerClass()
{
return 'FOQ\ElasticaBundle\Doctrine\ORM\Listener';
return 'FOS\ElasticaBundle\Doctrine\ORM\Listener';
}
protected function getObjectManagerClass()

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Tests\Doctrine;
namespace FOS\ElasticaBundle\Tests\Doctrine;
use FOQ\ElasticaBundle\Doctrine\RepositoryManager;
use FOS\ElasticaBundle\Doctrine\RepositoryManager;
class CustomRepository{}
@ -22,7 +22,7 @@ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
public function testThatGetRepositoryReturnsDefaultRepository()
{
$finderMock = $this->getMockBuilder('FOQ\ElasticaBundle\Finder\TransformedFinder')
$finderMock = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
->disableOriginalConstructor()
->getMock();
@ -34,17 +34,17 @@ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMock();
$entityName = 'FOQ\ElasticaBundle\Tests\Manager\Entity';
$entityName = 'FOS\ElasticaBundle\Tests\Manager\Entity';
$manager = new RepositoryManager($registryMock, $readerMock);
$manager->addEntity($entityName, $finderMock);
$repository = $manager->getRepository($entityName);
$this->assertInstanceOf('FOQ\ElasticaBundle\Repository', $repository);
$this->assertInstanceOf('FOS\ElasticaBundle\Repository', $repository);
}
public function testThatGetRepositoryReturnsCustomRepository()
{
$finderMock = $this->getMockBuilder('FOQ\ElasticaBundle\Finder\TransformedFinder')
$finderMock = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
->disableOriginalConstructor()
->getMock();
@ -56,12 +56,12 @@ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMock();
$entityName = 'FOQ\ElasticaBundle\Tests\Manager\Entity';
$entityName = 'FOS\ElasticaBundle\Tests\Manager\Entity';
$manager = new RepositoryManager($registryMock, $readerMock);
$manager->addEntity($entityName, $finderMock, 'FOQ\ElasticaBundle\Tests\Manager\CustomRepository');
$manager->addEntity($entityName, $finderMock, 'FOS\ElasticaBundle\Tests\Manager\CustomRepository');
$repository = $manager->getRepository($entityName);
$this->assertInstanceOf('FOQ\ElasticaBundle\Tests\Manager\CustomRepository', $repository);
$this->assertInstanceOf('FOS\ElasticaBundle\Tests\Manager\CustomRepository', $repository);
}
/**
@ -69,7 +69,7 @@ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
*/
public function testThatGetRepositoryThrowsExceptionIfEntityNotConfigured()
{
$finderMock = $this->getMockBuilder('FOQ\ElasticaBundle\Finder\TransformedFinder')
$finderMock = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
->disableOriginalConstructor()
->getMock();
@ -81,7 +81,7 @@ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMock();
$entityName = 'FOQ\ElasticaBundle\Tests\Manager\Entity';
$entityName = 'FOS\ElasticaBundle\Tests\Manager\Entity';
$manager = new RepositoryManager($registryMock, $readerMock);
$manager->addEntity($entityName, $finderMock);
@ -93,7 +93,7 @@ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
*/
public function testThatGetRepositoryThrowsExceptionIfCustomRepositoryNotFound()
{
$finderMock = $this->getMockBuilder('FOQ\ElasticaBundle\Finder\TransformedFinder')
$finderMock = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
->disableOriginalConstructor()
->getMock();
@ -105,16 +105,16 @@ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMock();
$entityName = 'FOQ\ElasticaBundle\Tests\Manager\Entity';
$entityName = 'FOS\ElasticaBundle\Tests\Manager\Entity';
$manager = new RepositoryManager($registryMock, $readerMock);
$manager->addEntity($entityName, $finderMock, 'FOQ\ElasticaBundle\Tests\MissingRepository');
$manager->addEntity($entityName, $finderMock, 'FOS\ElasticaBundle\Tests\MissingRepository');
$manager->getRepository('Missing Entity');
}
public function testThatGetRepositoryWorksWithShortEntityName()
{
$finderMock = $this->getMockBuilder('FOQ\ElasticaBundle\Finder\TransformedFinder')
$finderMock = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
->disableOriginalConstructor()
->getMock();
@ -127,9 +127,9 @@ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
->getMock();
$shortEntityName = 'TestBundle:Entity';
$entityName = 'FOQ\ElasticaBundle\Tests\Manager\Entity';
$entityName = 'FOS\ElasticaBundle\Tests\Manager\Entity';
$shortPath = 'TestBundle';
$fullPath = 'FOQ\ElasticaBundle\Tests\Manager';
$fullPath = 'FOS\ElasticaBundle\Tests\Manager';
$registryMock->expects($this->once())
->method('getAliasNamespace')
@ -139,7 +139,7 @@ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
$manager = new RepositoryManager($registryMock, $readerMock);
$manager->addEntity($entityName, $finderMock);
$repository = $manager->getRepository($shortEntityName);
$this->assertInstanceOf('FOQ\ElasticaBundle\Repository', $repository);
$this->assertInstanceOf('FOS\ElasticaBundle\Repository', $repository);
}
}

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Tests\IndexManager;
namespace FOS\ElasticaBundle\Tests\IndexManager;
use FOQ\ElasticaBundle\IndexManager;
use FOS\ElasticaBundle\IndexManager;
class IndexManagerTest extends \PHPUnit_Framework_TestCase
{

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Tests\Logger;
namespace FOS\ElasticaBundle\Tests\Logger;
use FOQ\ElasticaBundle\Logger\ElasticaLogger;
use FOS\ElasticaBundle\Logger\ElasticaLogger;
/**
* @author Richard Miller <info@limethinking.co.uk>

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Tests\Manager;
namespace FOS\ElasticaBundle\Tests\Manager;
use FOQ\ElasticaBundle\Manager\RepositoryManager;
use FOS\ElasticaBundle\Manager\RepositoryManager;
class CustomRepository{}
@ -16,7 +16,7 @@ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
public function testThatGetRepositoryReturnsDefaultRepository()
{
$finderMock = $this->getMockBuilder('FOQ\ElasticaBundle\Finder\TransformedFinder')
$finderMock = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
->disableOriginalConstructor()
->getMock();
@ -24,17 +24,17 @@ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMock();
$entityName = 'FOQ\ElasticaBundle\Tests\Manager\Entity';
$entityName = 'FOS\ElasticaBundle\Tests\Manager\Entity';
$manager = new RepositoryManager($readerMock);
$manager->addEntity($entityName, $finderMock);
$repository = $manager->getRepository($entityName);
$this->assertInstanceOf('FOQ\ElasticaBundle\Repository', $repository);
$this->assertInstanceOf('FOS\ElasticaBundle\Repository', $repository);
}
public function testThatGetRepositoryReturnsCustomRepository()
{
$finderMock = $this->getMockBuilder('FOQ\ElasticaBundle\Finder\TransformedFinder')
$finderMock = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
->disableOriginalConstructor()
->getMock();
@ -42,12 +42,12 @@ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMock();
$entityName = 'FOQ\ElasticaBundle\Tests\Manager\Entity';
$entityName = 'FOS\ElasticaBundle\Tests\Manager\Entity';
$manager = new RepositoryManager($readerMock);
$manager->addEntity($entityName, $finderMock, 'FOQ\ElasticaBundle\Tests\Manager\CustomRepository');
$manager->addEntity($entityName, $finderMock, 'FOS\ElasticaBundle\Tests\Manager\CustomRepository');
$repository = $manager->getRepository($entityName);
$this->assertInstanceOf('FOQ\ElasticaBundle\Tests\Manager\CustomRepository', $repository);
$this->assertInstanceOf('FOS\ElasticaBundle\Tests\Manager\CustomRepository', $repository);
}
/**
@ -55,7 +55,7 @@ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
*/
public function testThatGetRepositoryThrowsExceptionIfEntityNotConfigured()
{
$finderMock = $this->getMockBuilder('FOQ\ElasticaBundle\Finder\TransformedFinder')
$finderMock = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
->disableOriginalConstructor()
->getMock();
@ -63,7 +63,7 @@ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMock();
$entityName = 'FOQ\ElasticaBundle\Tests\Manager\Entity';
$entityName = 'FOS\ElasticaBundle\Tests\Manager\Entity';
$manager = new RepositoryManager($readerMock);
$manager->addEntity($entityName, $finderMock);
@ -75,7 +75,7 @@ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
*/
public function testThatGetRepositoryThrowsExceptionIfCustomRepositoryNotFound()
{
$finderMock = $this->getMockBuilder('FOQ\ElasticaBundle\Finder\TransformedFinder')
$finderMock = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
->disableOriginalConstructor()
->getMock();
@ -83,10 +83,10 @@ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMock();
$entityName = 'FOQ\ElasticaBundle\Tests\Manager\Entity';
$entityName = 'FOS\ElasticaBundle\Tests\Manager\Entity';
$manager = new RepositoryManager($readerMock);
$manager->addEntity($entityName, $finderMock, 'FOQ\ElasticaBundle\Tests\MissingRepository');
$manager->addEntity($entityName, $finderMock, 'FOS\ElasticaBundle\Tests\MissingRepository');
$manager->getRepository('Missing Entity');
}

View file

@ -1,9 +1,9 @@
<?php
namespace FOQ\ElasticaBundle\Tests\ObjectPersister;
namespace FOS\ElasticaBundle\Tests\ObjectPersister;
use FOQ\ElasticaBundle\Persister\ObjectPersister;
use FOQ\ElasticaBundle\Transformer\ModelToElasticaAutoTransformer;
use FOS\ElasticaBundle\Persister\ObjectPersister;
use FOS\ElasticaBundle\Transformer\ModelToElasticaAutoTransformer;
class POPO
{

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Tests\Provider;
namespace FOS\ElasticaBundle\Tests\Provider;
use FOQ\ElasticaBundle\Provider\ProviderRegistry;
use FOS\ElasticaBundle\Provider\ProviderRegistry;
use Symfony\Component\DependencyInjection\ContainerInterface;
class ProviderRegistryTest extends \PHPUnit_Framework_TestCase

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Tests;
namespace FOS\ElasticaBundle\Tests;
use FOQ\ElasticaBundle\Repository;
use FOS\ElasticaBundle\Repository;
/**
* @author Richard Miller <info@limethinking.co.uk>
@ -14,7 +14,7 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase
{
$testQuery = 'Test Query';
$finderMock = $this->getMockBuilder('FOQ\ElasticaBundle\Finder\TransformedFinder')
$finderMock = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
->disableOriginalConstructor()
->getMock();
$finderMock->expects($this->once())
@ -30,7 +30,7 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase
$testQuery = 'Test Query';
$testLimit = 20;
$finderMock = $this->getMockBuilder('FOQ\ElasticaBundle\Finder\TransformedFinder')
$finderMock = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
->disableOriginalConstructor()
->getMock();
$finderMock->expects($this->once())
@ -45,7 +45,7 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase
{
$testQuery = 'Test Query';
$finderMock = $this->getMockBuilder('FOQ\ElasticaBundle\Finder\TransformedFinder')
$finderMock = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
->disableOriginalConstructor()
->getMock();
$finderMock->expects($this->once())
@ -61,7 +61,7 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase
$testQuery = 'Test Query';
$testLimit = 20;
$finderMock = $this->getMockBuilder('FOQ\ElasticaBundle\Finder\TransformedFinder')
$finderMock = $this->getMockBuilder('FOS\ElasticaBundle\Finder\TransformedFinder')
->disableOriginalConstructor()
->getMock();
$finderMock->expects($this->once())

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Tests\Resetter;
namespace FOS\ElasticaBundle\Tests\Resetter;
use FOQ\ElasticaBundle\Resetter;
use FOS\ElasticaBundle\Resetter;
class ResetterTest extends \PHPUnit_Framework_TestCase
{

View file

@ -1,32 +1,32 @@
<?php
namespace FOQ\ElasticaBundle\Tests\Transformer;
namespace FOS\ElasticaBundle\Tests\Transformer;
use FOQ\ElasticaBundle\Transformer\ElasticaToModelTransformerCollection;
use FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerCollection;
class ElasticaToModelTransformerCollectionTest extends \PHPUnit_Framework_TestCase
{
/**
* @var \FOQ\ElasticaBundle\Transformer\ElasticaToModelTransformerCollection
* @var \FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerCollection
*/
protected $collection;
protected $transformers = array();
protected function collectionSetup()
{
$transformer1 = $this->getMock('FOQ\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface');
$transformer1 = $this->getMock('FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface');
$transformer1->expects($this->any())
->method('getObjectClass')
->will($this->returnValue('FOQ\ElasticaBundle\Tests\Transformer\POPO'));
->will($this->returnValue('FOS\ElasticaBundle\Tests\Transformer\POPO'));
$transformer1->expects($this->any())
->method('getIdentifierField')
->will($this->returnValue('id'));
$transformer2 = $this->getMock('FOQ\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface');
$transformer2 = $this->getMock('FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface');
$transformer2->expects($this->any())
->method('getObjectClass')
->will($this->returnValue('FOQ\ElasticaBundle\Tests\Transformer\POPO2'));
->will($this->returnValue('FOS\ElasticaBundle\Tests\Transformer\POPO2'));
$transformer2->expects($this->any())
->method('getIdentifierField')
@ -44,8 +44,8 @@ class ElasticaToModelTransformerCollectionTest extends \PHPUnit_Framework_TestCa
$objectClasses = $this->collection->getObjectClass();
$this->assertEquals(array(
'type1' => 'FOQ\ElasticaBundle\Tests\Transformer\POPO',
'type2' => 'FOQ\ElasticaBundle\Tests\Transformer\POPO2'
'type1' => 'FOS\ElasticaBundle\Tests\Transformer\POPO',
'type2' => 'FOS\ElasticaBundle\Tests\Transformer\POPO2'
), $objectClasses);
}

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Tests\Transformer\ModelToElasticaAutoTransformer;
namespace FOS\ElasticaBundle\Tests\Transformer\ModelToElasticaAutoTransformer;
use FOQ\ElasticaBundle\Transformer\ModelToElasticaAutoTransformer;
use FOS\ElasticaBundle\Transformer\ModelToElasticaAutoTransformer;
class POPO
{

View file

@ -7,7 +7,7 @@ if (file_exists($file = __DIR__.'/../vendor/autoload.php')) {
}
spl_autoload_register(function($class) {
if (0 === strpos($class, 'FOQ\\ElasticaBundle\\')) {
if (0 === strpos($class, 'FOS\\ElasticaBundle\\')) {
$path = __DIR__.'/../'.implode('/', array_slice(explode('\\', $class), 2)).'.php';
if (!stream_resolve_include_path($path)) {
return false;

View file

@ -1,8 +1,8 @@
<?php
namespace FOQ\ElasticaBundle\Transformer;
namespace FOS\ElasticaBundle\Transformer;
use FOQ\ElasticaBundle\HybridResult;
use FOS\ElasticaBundle\HybridResult;
use Symfony\Component\Form\Util\PropertyPath;
/**

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\Transformer;
namespace FOS\ElasticaBundle\Transformer;
/**
* Maps Elastica documents with model objects

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\Transformer;
namespace FOS\ElasticaBundle\Transformer;
/**
* Maps Elastica documents with model objects

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\Transformer;
namespace FOS\ElasticaBundle\Transformer;
use Symfony\Component\Form\Util\PropertyPath;

View file

@ -1,6 +1,6 @@
<?php
namespace FOQ\ElasticaBundle\Transformer;
namespace FOS\ElasticaBundle\Transformer;
/**
* Maps Elastica documents with model objects

View file

@ -1,9 +1,9 @@
{
"name": "exercise/elastica-bundle",
"name": "friendsofsymfony/elastica-bundle",
"type": "symfony-bundle",
"description": "Elasticsearch PHP integration for your Symfony2 project using Elastica",
"keywords": ["doctrine2", "elastica", "elasticsearch", "mongodb", "propel", "search"],
"homepage": "https://github.com/Exercise/FOQElasticaBundle",
"homepage": "https://github.com/FriendsOfSymfony/FOSElasticaBundle",
"license": "MIT",
"authors": [
{ "name": "Thibault Duplessis", "email": "thibault.duplessis@gmail.com" },
@ -28,7 +28,7 @@
"propel/propel1": "1.6.*"
},
"autoload": {
"psr-0": { "FOQ\\ElasticaBundle": "" }
"psr-0": { "FOS\\ElasticaBundle": "" }
},
"target-dir": "FOQ/ElasticaBundle"
"target-dir": "FOS/ElasticaBundle"
}

View file

@ -2,7 +2,7 @@
<phpunit bootstrap="./Tests/bootstrap.php" colors="true">
<testsuites>
<testsuite name="FOQElasticaBundle Test Suite">
<testsuite name="FOSElasticaBundle Test Suite">
<directory>./Tests</directory>
</testsuite>
</testsuites>