diff --git a/.travis.yml b/.travis.yml index 1d5b6070..d95df8a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,11 +16,11 @@ install: - ./elasticsearch-${ES_VERSION}/bin/elasticsearch -d before_script: - composer require --no-update symfony/framework-bundle:${SYMFONY} - - composer config -g github-oauth.github.com $GITHUB_COMPOSER_AUTH + - if [[ $TRAVIS_SECURE_ENV_VARS = "true" ]]; then composer config -g github-oauth.github.com $GITHUB_COMPOSER_AUTH; fi - composer install --no-interaction --prefer-dist script: - wget -q --waitretry=1 --retry-connrefused -T 10 -O - http://127.0.0.1:9200 - vendor/bin/phpunit --coverage-clover=coverage.clover - vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor/,Tests/app/,var/cache ./ after_script: - - travis_retry php vendor/bin/coveralls \ No newline at end of file + - travis_retry php vendor/bin/coveralls diff --git a/DependencyInjection/Compiler/MappingPass.php b/DependencyInjection/Compiler/MappingPass.php index ad55c62a..3f696a9e 100644 --- a/DependencyInjection/Compiler/MappingPass.php +++ b/DependencyInjection/Compiler/MappingPass.php @@ -62,10 +62,16 @@ private function handleDirectoryMapping(ContainerBuilder $container, string $dir foreach ($this->getNamespaces($dir) as $namespace) { $class = new \ReflectionClass($namespace); + + if (isset($indexesOverride[$namespace]['alias']) && $indexesOverride[$namespace]['alias']) { + $indexAlias = $indexesOverride[$namespace]['alias']; + } else { + $indexAlias = $parser->getIndexAliasName($class); + } + /** @var Index $document */ $document = $parser->getIndexAnnotation($class); $indexMapping = $parser->getIndexMetadata($class); - $indexAlias = $parser->getIndexAliasName($class); $indexMetadata = $parser->getIndexMetadata($class); if (!empty($indexMapping)) { diff --git a/Tests/Functional/Service/IndexServiceTest.php b/Tests/Functional/Service/IndexServiceTest.php index ebb2eb2a..6eb6dc00 100644 --- a/Tests/Functional/Service/IndexServiceTest.php +++ b/Tests/Functional/Service/IndexServiceTest.php @@ -45,7 +45,8 @@ public function indexNameDataProvider() { return [ [ DummyDocument::class, DummyDocument::INDEX_NAME ], - [ DummyDocumentInTheEntityDirectory::class, DummyDocumentInTheEntityDirectory::INDEX_NAME ], + // this alias is overriden in configuration + [ DummyDocumentInTheEntityDirectory::class, 'field-data-index' ], ]; }