-
Notifications
You must be signed in to change notification settings - Fork 91
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
Conversation
…r. user can filter images by pages
@magento run all tests |
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.
Hi @gregbalonzo ! Thank you for the work you have done in this PR 👍 Please, check my change requests comments below.
MediaGalleryUi/Model/SearchCriteria/CollectionProcessor/FilterProcessor/EntityId.php
Outdated
Show resolved
Hide resolved
MediaGalleryUi/Model/SearchCriteria/CollectionProcessor/FilterProcessor/EntityId.php
Outdated
Show resolved
Hide resolved
MediaGalleryUi/Model/SearchCriteria/CollectionProcessor/FilterProcessor/EntityId.php
Outdated
Show resolved
Hide resolved
[] | ||
); | ||
|
||
//print_r($collection->getSelect()->__toString()); die; |
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.
Please, remove this line.
{ | ||
$searchCriteria = $this->_searchCriteriaBuilder->create(); | ||
$pages = []; | ||
|
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.
Please, remove this empty line.
]; | ||
} | ||
} catch (LocalizedException $e) { | ||
|
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.
Think that exception should be thrown in that case. Please, replace $e
with $exception
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.
@gregbalonzo thanks for renaming a variable. Why do we need to suppress the exception, though?
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.
@sivaschenko its for my local testing purpose, I can remove it if this is not required.
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.
@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.
MediaGalleryUi/Model/SearchCriteria/CollectionProcessor/JoinProcessor/EntityId.php
Outdated
Show resolved
Hide resolved
…Processor/EntityId.php Co-authored-by: Alexander Shkurko <[email protected]>
…(strict_types=1); & remove empty line
MediaGalleryUi/view/adminhtml/ui_component/standalone_media_gallery_listing.xml
Outdated
Show resolved
Hide resolved
/** | ||
* Image source filter options | ||
*/ | ||
class Options implements OptionSourceInterface |
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.
Description can be updated, to the page filter options
MediaGalleryUi/view/adminhtml/ui_component/standalone_media_gallery_listing.xml
Outdated
Show resolved
Hide resolved
…hange placeholder
…ld have a description, change protected to private, Add the constructor @param section
@magento run all tests |
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.
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 |
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.
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( |
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.
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 |
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.
Please rename the class to Page
to better reflect it's responsibility
use Magento\Framework\Data\OptionSourceInterface; | ||
use Magento\Framework\Exception\LocalizedException; | ||
|
||
|
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.
unnecessary empty line
]; | ||
} | ||
} catch (LocalizedException $e) { | ||
|
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.
@gregbalonzo thanks for renaming a variable. Why do we need to suppress the exception, though?
/** | ||
* @inheritdoc | ||
*/ | ||
public function toOptionArray(): array |
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.
It would be great to load the items dynamically, based on the user input
…de & renamed php class
…uery because its not accurate when searching by pages
…eryUi/Ui/Component/Listing/Columns/Pages/Options.php
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.
Hi @gregbalonzo, thanks for the PR! Please follow some comments below:
MediaGalleryUi/view/adminhtml/ui_component/standalone_media_gallery_listing.xml
Outdated
Show resolved
Hide resolved
MediaGalleryUi/Model/SearchCriteria/CollectionProcessor/JoinProcessor/Page.php
Outdated
Show resolved
Hide resolved
*/ | ||
class Options implements OptionSourceInterface | ||
{ | ||
private $PageRepository; |
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.
Missing php doc block and please make this camelCase.
{ | ||
private $PageRepository; | ||
|
||
private $SearchCriteriaBuilder; |
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.
Missing php doc block and please make this camelCase.
|
||
private $SearchCriteriaBuilder; | ||
|
||
private $FilterBuilder; |
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.
Missing php doc block and please make this camelCase.
…the join query and replace same as used in used in filter
Closed in favour to #1593 |
Hi @gregbalonzo, thank you for your contribution! |
Description (*)
Implement Used In Pages filter. user can filter images by CMS pages
Fixed Issues (if relevant)
Manual testing scenarios (*)