-
Notifications
You must be signed in to change notification settings - Fork 156
Conversation
@@ -5,17 +5,17 @@ | |||
*/ | |||
declare(strict_types=1); | |||
|
|||
namespace Magento\CatalogGraphQl\Model\Resolver\Products\FilterArgument; | |||
namespace Magento\Framework\GraphQl\Query\Resolver\Argument; |
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.
I think Filter
should still be part of the namespace because this class is specifically for filterable fields.
{ | ||
$productTypeSchema = $this->config->getConfigElement('SimpleProduct'); | ||
$productTypeSchema = $this->config->getConfigElement($this->configElementName); |
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 eliminate all product
occurrences in this file since now it is generic.
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.
Because currently we use only the array key
@@ -55,12 +64,12 @@ public function getEntityAttributes() : array | |||
$configElement = $this->config->getConfigElement($interface['interface']); | |||
|
|||
foreach ($configElement->getFields() as $field) { | |||
$fields[$field->getName()] = 'String'; | |||
$fields[$field->getName()] = ''; |
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.
Why this was changed? I believe each filter value must be of a String
type. Same below.
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.
Because currently we use only the array key
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getEntityAttributes() : array | ||
public function getEntityAttributes(): 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.
For now this method will collect filterable fields from interface declarations and from additionalAttributes
defined in di.xml, however it does not seem to collect fields from the entity itself.
{ | ||
$configElements = []; | ||
|
||
if ($type->getInterfaces() === null) { |
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.
Fields should be read from interfaces AND from the main entity, not OR
Hello @larsroettig, Unfortunately, we cannot accept this PR because this class is not used anywhere and is not covered by API-functional tests. So it will lead to class obsolescence. Feel free to reopen with an alternative implementation. It could be an improvement in the current code or it could be some GraphQL scenario described in API-functional tests. Thanks |
Hi @larsroettig, thank you for your contribution! |
Description (*)
Implement a Generic Class for GaphQl Filter
Exsample ussage:
Fixed Issues (if relevant)
Manual testing scenarios (*)
Contribution checklist (*)