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

magento/adobe-stock-integration#1467: Introduce Used In Pages filter … #1546

Closed
wants to merge 9 commits into from
Closed

Conversation

ghost
Copy link

@ghost ghost commented Jun 29, 2020

Description (*)

Implement Used In Pages filter. user can filter images by CMS pages

Fixed Issues (if relevant)

  1. Fixes Introduce Used In Pages filter #1467: Introduce Used In Pages filter

Manual testing scenarios (*)

  1. Add image to a specific Cms page
  2. Admin > content > media gallery > click filter & select Pages

@ghost
Copy link
Author

ghost commented Jun 29, 2020

@magento run all tests

Copy link
Contributor

@coderimus coderimus left a comment

Choose a reason for hiding this comment

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

Hi @gregbalonzo ! Thank you for the work you have done in this PR 👍 Please, check my change requests comments below.

[]
);

//print_r($collection->getSelect()->__toString()); die;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, remove this line.

{
$searchCriteria = $this->_searchCriteriaBuilder->create();
$pages = [];

Copy link
Contributor

Choose a reason for hiding this comment

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

Please, remove this empty line.

];
}
} catch (LocalizedException $e) {

Copy link
Contributor

Choose a reason for hiding this comment

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

Think that exception should be thrown in that case. Please, replace $e with $exception

Copy link
Member

Choose a reason for hiding this comment

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

@gregbalonzo thanks for renaming a variable. Why do we need to suppress the exception, though?

Copy link
Author

Choose a reason for hiding this comment

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

@sivaschenko its for my local testing purpose, I can remove it if this is not required.

Copy link
Member

Choose a reason for hiding this comment

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

@gregbalonzo please keep the code for local testing purposes on the local, try to go only with the production-ready code for the push to Github.

killerboduk1 and others added 2 commits June 29, 2020 20:09
/**
* Image source filter options
*/
class Options implements OptionSourceInterface
Copy link
Member

Choose a reason for hiding this comment

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

Description can be updated, to the page filter options

…ld have a description, change protected to private, Add the constructor @param section
@coderimus
Copy link
Contributor

@magento run all tests

Copy link
Member

@sivaschenko sivaschenko left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @gregbalonzo ! Please see my review comments

/**
* Class EntityId
* Used to filter the collection based on the filter selection.
* @package Magento\MediaGalleryUi\Model\SearchCriteria\CollectionProcessor\FilterProcessor
Copy link
Member

Choose a reason for hiding this comment

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

Please remove the Class EntityId and @package lines from the class comments (applicable to all classes)

*/
public function apply(AbstractDb $collection): bool
{
$collection->getSelect()->joinLeft(
Copy link
Member

Choose a reason for hiding this comment

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

This join is going to be added in #1531 no need to join the same table twice

* Used to join table of the collection based on the filter selection.
* @package Magento\MediaGalleryUi\Model\SearchCriteria\CollectionProcessor\JoinProcessor
*/
class EntityId implements CustomJoinInterface
Copy link
Member

Choose a reason for hiding this comment

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

Please rename the class to Page to better reflect it's responsibility

use Magento\Framework\Data\OptionSourceInterface;
use Magento\Framework\Exception\LocalizedException;


Copy link
Member

Choose a reason for hiding this comment

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

unnecessary empty line

];
}
} catch (LocalizedException $e) {

Copy link
Member

Choose a reason for hiding this comment

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

@gregbalonzo thanks for renaming a variable. Why do we need to suppress the exception, though?

/**
* @inheritdoc
*/
public function toOptionArray(): array
Copy link
Member

Choose a reason for hiding this comment

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

It would be great to load the items dynamically, based on the user input

Copy link
Contributor

@gabrieldagama gabrieldagama left a comment

Choose a reason for hiding this comment

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

Hi @gregbalonzo, thanks for the PR! Please follow some comments below:

*/
class Options implements OptionSourceInterface
{
private $PageRepository;
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing php doc block and please make this camelCase.

{
private $PageRepository;

private $SearchCriteriaBuilder;
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing php doc block and please make this camelCase.


private $SearchCriteriaBuilder;

private $FilterBuilder;
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing php doc block and please make this camelCase.

…the join query and replace same as used in used in filter
@sivaschenko
Copy link
Member

Closed in favour to #1593

@ghost
Copy link

ghost commented Jul 13, 2020

Hi @gregbalonzo, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce Used In Pages filter
5 participants