Skip to content

Commit

Permalink
ElasticSearch compatibility (#26)
Browse files Browse the repository at this point in the history
* Remove useless code
* Use registered bundles to detect ElasticSearch
  • Loading branch information
jmleroux authored May 10, 2017
1 parent 4828c58 commit ad373ba
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 71 deletions.
5 changes: 1 addition & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@ def launchIntegrationTests = "yes"

class Globals {
static pimVersion = "1.6"
static extensionBranch = "dev-master"
static extensionBranch = "1.0.x-dev@dev"
}

stage("Checkout") {
milestone 1
if (env.BRANCH_NAME =~ /^PR-/) {
userInput = input(message: 'Launch tests?', parameters: [
choice(choices: '1.6\n1.7', description: 'PIM version to use', name: 'pimVersion'),
choice(choices: 'yes\nno', description: 'Run unit tests', name: 'launchUnitTests'),
choice(choices: 'yes\nno', description: 'Run integration tests', name: 'launchIntegrationTests'),
])

Globals.pimVersion = userInput['pimVersion']
launchUnitTests = userInput['launchUnitTests']
launchIntegrationTests = userInput['launchIntegrationTests']
}
Expand Down Expand Up @@ -49,7 +47,6 @@ if (launchUnitTests.equals("yes")) {
def tasks = [:]

tasks["phpspec-5.6"] = {runPhpSpecTest("5.6")}
tasks["phpspec-7.1"] = {runPhpSpecTest("7.1")}
tasks["php-cs-fixer-5.6"] = {runPhpCsFixerTest("5.6")}

parallel tasks
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
},
"extra": {
"branch-alias": {
"dev-master": "0.1.x-dev"
"dev-master": "1.1.x-dev",
"dev-1.0": "1.0.x-dev"
}
}
}
11 changes: 5 additions & 6 deletions src/DependencyInjection/PimExtendedAttributeTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Pim\Bundle\ExtendedAttributeTypeBundle\DependencyInjection;

use Pim\Bundle\ElasticSearchBundle\Query\ProductQueryUtility;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand All @@ -28,7 +29,6 @@ public function load(array $config, ContainerBuilder $container)
$loader->load('comparators.yml');
$loader->load('completeness.yml');
$loader->load('form_types.yml');
$loader->load('normalizers.yml');
$loader->load('denormalizers.yml');
$loader->load('providers.yml');
$loader->load('query_builders.yml');
Expand All @@ -38,14 +38,13 @@ public function load(array $config, ContainerBuilder $container)
$loader->load('datagrid/attribute_types.yml');
$loader->load('datagrid/filters.yml');
$loader->load('datagrid/formatters.yml');
$loader->load('datagrid/selectors.yml');

$this->loadAttributeIcons($loader, $container);

// Enterprise Edition
$loader->load('enterprise/denormalizers.yml');
$loader->load('enterprise/presenters.yml');
$loader->load('enterprise/publishers.yml');
$registeredBundles = $container->getParameter('kernel.bundles');
if (array_key_exists('PimElasticSearchBundle', $registeredBundles)) {
$loader->load('storage_driver/doctrine/elasticsearch.yml');
}
}

/**
Expand Down
11 changes: 11 additions & 0 deletions src/PimExtendedAttributeTypeBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Pim\Bundle\ExtendedAttributeTypeBundle;

use Pim\Bundle\ElasticSearchBundle\Query\ProductQueryUtility;
use Pim\Bundle\ExtendedAttributeTypeBundle\AttributeType\ExtendedAttributeTypes;
use Symfony\Component\HttpKernel\Bundle\Bundle;

/**
Expand All @@ -11,4 +13,13 @@
*/
class PimExtendedAttributeTypeBundle extends Bundle
{
public function boot()
{
parent::boot();

$registeredBundles = $this->container->getParameter('kernel.bundles');
if (array_key_exists('PimElasticSearchBundle', $registeredBundles)) {
ProductQueryUtility::addTypeSuffix(ExtendedAttributeTypes::TEXT_COLLECTION, ProductQueryUtility::SUFFIX_TEXT);
}
}
}
10 changes: 0 additions & 10 deletions src/Resources/config/datagrid/selectors.yml

This file was deleted.

8 changes: 0 additions & 8 deletions src/Resources/config/enterprise/denormalizers.yml

This file was deleted.

11 changes: 0 additions & 11 deletions src/Resources/config/enterprise/presenters.yml

This file was deleted.

8 changes: 0 additions & 8 deletions src/Resources/config/enterprise/publishers.yml

This file was deleted.

3 changes: 0 additions & 3 deletions src/Resources/config/normalizers.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
pim_elastic_search.query.filter.text_collection:
class: %pim_elastic_search.query.filter.string.class%
arguments:
- @pim_catalog.validator.helper.attribute
- ['pim_catalog_text_collection']
- ['CONTAINS', 'DOES NOT CONTAIN', 'EMPTY', 'NOT EMPTY']
tags:
- { name: 'pim_elastic_search.query.filter', priority: 30 }
16 changes: 0 additions & 16 deletions src/Resources/config/storage_driver/doctrine/mongodb-odm.yml
Original file line number Diff line number Diff line change
@@ -1,16 +0,0 @@
parameters:
# pim_extended_attribute_type.doctrine.query.filter.range.class: Pim\Bundle\ExtendedAttributeTypeBundle\Doctrine\MongoDBODM\Filter\RangeFilter

services:
# pim_extended_attribute_type.mongodb.normalizer.normalized_data.range:
# class: Pim\Bundle\ExtendedAttributeTypeBundle\MongoDB\Normalizer\NormalizedData\RangeNormalizer
# public: false
# tags:
# - { name: pim_serializer.normalizer }
#
# pim_catalog.mongodb.normalizer.document.range:
# class: Pim\Bundle\ExtendedAttributeTypeBundle\MongoDB\Normalizer\Document\RangeNormalizer
# arguments:
# - '@pim_catalog.mongodb.mongo_objects_factory'
# tags:
# - { name: pim_serializer.normalizer, priority: 100 }
2 changes: 0 additions & 2 deletions src/Resources/config/storage_driver/doctrine/orm.yml

This file was deleted.

2 changes: 0 additions & 2 deletions src/Resources/config/validators.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
parameters:

services:
pim_extended_attribute_type.validator.constraint_guesser.text_collection:
public: false
Expand Down

0 comments on commit ad373ba

Please sign in to comment.