Skip to content

Commit 52b67a8

Browse files
authored
Merge pull request #869 from ongr-io/6.0-dev
6.0 major version release
2 parents c817dc5 + 0f4b9af commit 52b67a8

File tree

153 files changed

+3460
-9555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+3460
-9555
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
<!-- Please describe your problem/feature request here. -->
22

33
<!--
4-
If you are creating a problem issue don't forget to include your code snippet that
5-
we could recreate problem. Please include:
6-
- Your PHP version
4+
If you are creating an issue because you got some error or smth,
5+
don't forget to include your code snippet that
6+
we could help us to recreate the problem.
7+
8+
Please include:
9+
- PHP version
710
- Elasticsearch version
811
- Bundle version
12+
- Symfony version
913
-->

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
/Tests/app/cache/
33
/Tests/app/logs/
44
/Tests/app/build/
5+
/var/cache/test
56
/phpunit.xml
67
/composer.lock
8+
/coverage.clover

.travis.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,26 @@
11
sudo: false
22
language: php
33
php:
4-
- 5.6
5-
- 7.0
64
- 7.1
75
- 7.2
6+
- 7.3
87
env:
98
global:
10-
- ES_VERSION=5.6.8 ES_DOWNLOAD_URL=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz
9+
- ES_VERSION=6.2.3 ES_DOWNLOAD_URL=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz
1110
matrix:
12-
- SYMFONY="~2.8"
13-
- SYMFONY="~3.0"
14-
- SYMFONY="~3.1"
15-
- SYMFONY="~3.2"
16-
- SYMFONY="~3.3"
1711
- SYMFONY="~3.4"
12+
- SYMFONY="^4.1"
1813
install:
1914
- wget ${ES_DOWNLOAD_URL}
2015
- tar -xzf elasticsearch-${ES_VERSION}.tar.gz
2116
- ./elasticsearch-${ES_VERSION}/bin/elasticsearch -d
2217
before_script:
23-
- echo 'memory_limit=-1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
24-
- composer require --no-update symfony/symfony:${SYMFONY}
18+
- composer require --no-update symfony/framework-bundle:${SYMFONY}
2519
- composer config -g github-oauth.github.com $GITHUB_COMPOSER_AUTH
2620
- composer install --no-interaction --prefer-dist
27-
2821
script:
2922
- wget -q --waitretry=1 --retry-connrefused -T 10 -O - http://127.0.0.1:9200
3023
- vendor/bin/phpunit --coverage-clover=coverage.clover
31-
- vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor/,Tests/app/ ./
24+
- vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor/,Tests/app/,var/cache ./
3225
after_script:
3326
- travis_retry php vendor/bin/coveralls

Annotation/Object.php renamed to Annotation/AbstractAnnotation.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111

1212
namespace ONGR\ElasticsearchBundle\Annotation;
1313

14-
if (version_compare(PHP_VERSION, '7.2.0') < 0) {
15-
class_alias('ONGR\ElasticsearchBundle\Annotation\ObjectType', 'ONGR\ElasticsearchBundle\Annotation\Object', false);
16-
class_exists('ONGR\ElasticsearchBundle\Annotation\ObjectType');
14+
abstract class AbstractAnnotation
15+
{
16+
public $settings = [];
17+
18+
public function getSettings(): array
19+
{
20+
return $this->settings;
21+
}
1722
}

Annotation/Document.php

Lines changed: 0 additions & 44 deletions
This file was deleted.

Annotation/Embedded.php

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@
1111

1212
namespace ONGR\ElasticsearchBundle\Annotation;
1313

14-
use ONGR\ElasticsearchBundle\Mapping\Caser;
15-
1614
/**
17-
* Annotation for property which points to inner object.
18-
*
1915
* @Annotation
2016
* @Target("PROPERTY")
2117
*/
22-
final class Embedded
18+
final class Embedded extends AbstractAnnotation implements PropertiesAwareInterface
2319
{
20+
use NameAwareTrait;
21+
2422
/**
2523
* Inner object class name.
2624
*
@@ -29,54 +27,4 @@ final class Embedded
2927
* @Doctrine\Common\Annotations\Annotation\Required
3028
*/
3129
public $class;
32-
33-
/**
34-
* Name of the type field. Defaults to normalized property name.
35-
*
36-
* @var string
37-
*/
38-
public $name;
39-
40-
/**
41-
* Defines if related value will store a single object or an array of objects
42-
*
43-
* If this value is set to true, in the result ObjectIterator will be provided,
44-
* otherwise you will get single object.
45-
*
46-
* @var bool Object or ObjectIterator
47-
*/
48-
public $multiple;
49-
50-
/**
51-
* In this field you can define options.
52-
*
53-
* @var array
54-
*/
55-
public $options;
56-
57-
/**
58-
* {@inheritdoc}
59-
*/
60-
public function dump(array $exclude = [])
61-
{
62-
$array = array_diff_key(
63-
array_filter(
64-
get_object_vars($this),
65-
function ($value) {
66-
return $value || is_bool($value);
67-
}
68-
),
69-
array_flip(array_merge(['class', 'name', 'multiple'], $exclude))
70-
);
71-
72-
return array_combine(
73-
array_map(
74-
function ($key) {
75-
return Caser::snake($key);
76-
},
77-
array_keys($array)
78-
),
79-
array_values($array)
80-
);
81-
}
8230
}

Annotation/HashMap.php

Lines changed: 0 additions & 71 deletions
This file was deleted.

Annotation/Id.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,12 @@
1717
* @Annotation
1818
* @Target("PROPERTY")
1919
*/
20-
final class Id implements MetaField
20+
final class Id extends AbstractAnnotation implements MetaFieldInterface, PropertiesAwareInterface
2121
{
2222
const NAME = '_id';
2323

24-
/**
25-
* {@inheritdoc}
26-
*/
27-
public function getName()
24+
public function getName(): ?string
2825
{
2926
return self::NAME;
3027
}
31-
32-
/**
33-
* {@inheritdoc}
34-
*/
35-
public function getSettings()
36-
{
37-
return [];
38-
}
3928
}

Annotation/Index.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the ONGR package.
5+
*
6+
* (c) NFQ Technologies UAB <info@nfq.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace ONGR\ElasticsearchBundle\Annotation;
13+
14+
use Doctrine\Common\Annotations\Annotation\Attributes;
15+
16+
/**
17+
* Annotation to mark a class as an Elasticsearch index.
18+
*
19+
* @Annotation
20+
* @Target("CLASS")
21+
*/
22+
final class Index extends AbstractAnnotation
23+
{
24+
/**
25+
* Index alias name. By default the index name will be created with the timestamp appended to the alias.
26+
*/
27+
public $alias;
28+
29+
/**
30+
* Index alias name. By default the index name will be created with the timestamp appended to the alias.
31+
*/
32+
public $hosts = [
33+
'127.0.0.1:9200'
34+
];
35+
36+
public $numberOfShards = 5;
37+
38+
public $numberOfReplicas = 1;
39+
40+
/**
41+
* We strongly recommend to not use this parameter in the index annotation. By default it will be set as `_doc`
42+
* type name. Eventually it will be removed.
43+
*
44+
* @deprecated will be removed in v7 since there will be no more types in the indexes.
45+
*/
46+
public $typeName = '_doc';
47+
48+
/**
49+
* You can select one of your indexes to be default. Useful for cli commands when you don't
50+
* need to define an alias name. If default is not set the first index found will be set as default one.
51+
*/
52+
public $default = false;
53+
}

Annotation/MetaField.php renamed to Annotation/MetaFieldInterface.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,6 @@
1414
/**
1515
* All meta-field annotations must implement this interface.
1616
*/
17-
interface MetaField
17+
interface MetaFieldInterface
1818
{
19-
/**
20-
* Returns meta-field name.
21-
*
22-
* @return string
23-
*/
24-
public function getName();
25-
26-
/**
27-
* Returns meta-field settings.
28-
*
29-
* @return array
30-
*/
31-
public function getSettings();
3219
}

0 commit comments

Comments
 (0)