-
Notifications
You must be signed in to change notification settings - Fork 974
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
Conversation
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'); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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!
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()
.