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 alias in grid massaction for eav collections #23452

Merged
merged 4 commits into from
Oct 8, 2019
Merged

Fix alias in grid massaction for eav collections #23452

merged 4 commits into from
Oct 8, 2019

Conversation

thomas-kl1
Copy link
Member

Related to M2.2.x: MAGETWO-96957
Related to M2.3.x: MAGETWO-98617

Description (*)

Impossible to use the massaction on Vanilla grid with an EAV collection.

Fixed Issues (if relevant)

  1. MAGETWO-96957 introduce a new bug #23451: MAGETWO-96957 introduce a new bug

Manual testing scenarios (*)

See related issue #23451

Questions or comments

As all grids should be built with the ui component, this exception should never happen. However, many third-part extension still use the deprecated grid system.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@thomas-kl1 thomas-kl1 requested a review from dyushkin June 27, 2019 15:48
@m2-assistant
Copy link

m2-assistant bot commented Jun 27, 2019

Hi @thomas-kl1. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@ghost ghost assigned sidolov Jun 27, 2019
@sidolov sidolov added the Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests label Jun 27, 2019
@magento-engcom-team
Copy link
Contributor

Hi @sidolov, thank you for the review.
ENGCOM-5367 has been created to process this Pull Request

@engcom-Foxtrot
Copy link
Contributor

engcom-Foxtrot commented Jul 24, 2019

@thomas-kl1, thank you for collaboration. Can you please provide strong motivation why this PR should be merged? It works fine with Product collection, but it's only because of \Magento\Catalog\Model\ResourceModel\Product\Collection::MAIN_TABLE_ALIAS value. I'm not sure if your solution will work in other cases.

@thomas-kl1
Copy link
Member Author

Hi @engcom-Foxtrot
No because it does not exists any public method to retrieve the alias for the mass action ID field.
So anyone who implements a collection with a specific alias cannot use the abstract massaction widget.
I'll be glad to apply changes in the PRs to fix this case. Actually I think the alias argument could be removed, as the alias could be directly concatenate in the field name. What do you think?

@thomas-kl1
Copy link
Member Author

@sidolov Have you any updates? I've seen a similar PR, I don't know what the best and maintainable solution is. Can you advice?

$idsSelect = clone $collection->getSelect();
$idsSelect->reset(\Magento\Framework\DB\Select::ORDER);
$idsSelect->reset(\Magento\Framework\DB\Select::LIMIT_COUNT);
$idsSelect->reset(\Magento\Framework\DB\Select::LIMIT_OFFSET);
$idsSelect->reset(\Magento\Framework\DB\Select::COLUMNS);
$idsSelect->columns($this->getMassactionIdField(), 'main_table');
$idsSelect->columns($this->getMassactionIdField(), $alias);
Copy link
Contributor

Choose a reason for hiding this comment

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

Will it work for both cases if we remove alias at all?

@thomas-kl1
Copy link
Member Author

@magento give me test instance

@magento-engcom-team
Copy link
Contributor

Hi @thomas-kl1. Thank you for your request. I'm working on Magento instance for you

@magento-engcom-team
Copy link
Contributor

Hi @thomas-kl1, here is your new Magento instance.
Admin access: https://pr-23452.instances.magento-community.engineering/admin
Login: admin Password: 123123q

@magento-engcom-team
Copy link
Contributor

Hi @sidolov, thank you for the review.
ENGCOM-5367 has been created to process this Pull Request

@engcom-Foxtrot engcom-Foxtrot added Auto-Tests: Covered All changes in Pull Request is covered by auto-tests and removed Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests labels Oct 1, 2019
@magento-engcom-team magento-engcom-team merged commit ab04d7e into magento:2.3-develop Oct 8, 2019
@m2-assistant
Copy link

m2-assistant bot commented Oct 8, 2019

Hi @thomas-kl1, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

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

Successfully merging this pull request may close these issues.

5 participants