Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest version class #897

Merged
merged 2 commits into from
Jul 28, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/Elastica/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Elastica\QueryBuilder\DSL;
use Elastica\QueryBuilder\Facade;
use Elastica\QueryBuilder\Version;
use Elastica\QueryBuilder\Version\Version150;

/**
* Query Builder.
Expand All @@ -31,7 +30,7 @@ class QueryBuilder
*/
public function __construct(Version $version = null)
{
$this->_version = $version ?: new Version150();
$this->_version = $version ?: new Version\Latest();

$this->addDSL(new DSL\Query());
$this->addDSL(new DSL\Filter());
Expand Down
14 changes: 14 additions & 0 deletions lib/Elastica/QueryBuilder/Version/Latest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
namespace Elastica\QueryBuilder\Version;

/**
* Latest elasticsearch DSL.
*
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@webdevsHub Here I would add a comment: Latest always refer to the version mentioned in README.md

Like this it never has to be updated here :-)

*
* @author Manuel Andreo Garcia <[email protected]>
*/
class Latest extends Version140
{
// this class always points to the latest valid DSL version
}
2 changes: 2 additions & 0 deletions lib/Elastica/QueryBuilder/Version/Version150.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* @link http://www.elastic.co/guide/en/elasticsearch/reference/1.5/index.html
*
* @author Igor Denisenko <[email protected]>
*
* @deprecated deprecated in favor of Elastica\QueryBuilder\Version\Latest
*/
class Version150 extends Version140
{
Expand Down
1 change: 1 addition & 0 deletions test/lib/Elastica/Test/QueryBuilder/VersionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function testVersions()
new Version\Version130(),
new Version\Version140(),
new Version\Version150(),
new Version\Latest(),
);

foreach ($versions as $version) {
Expand Down