-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[Cms] Added a getByIdentifier() method to the BlockRepository #9163
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
Conversation
So you never tried loading a block via its identifier? Try it. It already works. |
* @return \Magento\Cms\Api\Data\BlockInterface | ||
* @throws \Magento\Framework\Exception\NoSuchEntityException | ||
*/ | ||
public function getByIdentifier($blockIdentifier, $storeId); |
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.
Unfortunately, due to backwards compatibility policy, currently we can not add any new methods to the interfaces, specially the ones marked with the @api
annotation. You may extract this method to a separate interface/class, if it is really needed.
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 do you suggest? Should I simply remove this part from the interface and let the implementation in the model ( app/code/Magento/Cms/Model/ResourceModel/Block.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.
Actually, your PR is redundant, as Magento\Cms\Api\BlockRepositoryInterface::getById('my-block-identifier')
already works. As is Magento\Cms\Api\BlockRepositoryInterface::getById(12)
, too.
The resource model I showed you is just the place where the logic decides which route to go: identifier or numeric id? Again, try it yourself.
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.
…in order to avoid to break backward compatibility of the API
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.
Done
@ishakhsuvarov changes are completed. |
Hi @enrico69 Just FYI: we are working on #7417 It should resolve your issue |
[Spartans] Bugfixes Delivery
No description provided.