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

Fix pre 7.2 endpoint class name with aliases + reapply fix #947 #968

Merged
merged 5 commits into from
Nov 26, 2019
Merged

Fix pre 7.2 endpoint class name with aliases + reapply fix #947 #968

merged 5 commits into from
Nov 26, 2019

Conversation

ezimuel
Copy link
Contributor

@ezimuel ezimuel commented Nov 20, 2019

This PR fixes #967 introducing a class alias to all the previous endpoint namespaces present in elasticsearch-php 7.2.

I generated the class name for all the endpoints in 7.2 branch and I produced an alias in src/autoload.php (I removed the outdated endpoints, not available anymore in Elasticsearch 7).
I added the autoload.php file in composer.
NOTE: This file will be removed in the next major version (8.0.0).

I also reapplied the fix #947 for IndicesNamespace::getAliases().

src/autoload.php Outdated
class_alias('\Elasticsearch\Endpoints\GetSource', '\Elasticsearch\Endpoints\Source\Get');
class_alias('\Elasticsearch\Endpoints\ExistsSource', '\Elasticsearch\Endpoints\Source\Exists');
class_alias('\Elasticsearch\Endpoints\Tasks\ListTasks', '\Elasticsearch\Endpoints\Tasks\TasksList');
class_alias('\Elasticsearch\Endpoints\Termvectors', '\Elasticsearch\Endpoints\TermVectors');
Copy link
Contributor

Choose a reason for hiding this comment

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

The alias is not needed, same name on both sides

Copy link

Choose a reason for hiding this comment

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

Case has changed. But I'm not sure if class names are case sensitive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@thePanz is right here. The alias cannot be done for case sensitive, since classes are case insensitive in PHP (even if the autoloading of composer is case sensitive). I'll just reuse the old class naming convention here.

*/

class_alias('\Elasticsearch\Endpoints\Nodes\Info', '\Elasticsearch\Endpoints\Cluster\Nodes\Info');
class_alias('\Elasticsearch\Endpoints\Nodes\Stats', '\Elasticsearch\Endpoints\Cluster\Nodes\Stats');
Copy link

Choose a reason for hiding this comment

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

What about previous classes:

  • Elasticsearch\Endpoints\Cluster\Nodes\HotThreads
  • Elasticsearch\Endpoints\Cluster\Nodes\Usage
  • Elasticsearch\Endpoints\Cluster\Nodes\ReloadSecureSettings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You right, just added it. Thanks for this code review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compatibility issues with version 7.4.0
3 participants