-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[API] Add Address resources #16240
[API] Add Address resources #16240
Conversation
Wojdylak
commented
May 9, 2024
Q | A |
---|---|
Branch? | api-platform-3 |
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Related tickets | N/A |
License | MIT |
…eryItemExtension into one QueryExtension
Bunnyshell Preview Environment deployment failedCheck https://github.com/Sylius/Sylius/actions/runs/9032584601 for details. Available commands:
|
features/shop/account/customer_account/address_book/setting_default_address.feature
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/ApiBundle/Resources/config/api_platform/resources/Address.xml
Outdated
Show resolved
Hide resolved
<values> | ||
<value name="groups"> | ||
<values> | ||
<value>sylius:admin:address:log_entry:show</value> |
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's a minor thing, but having a collection endpoint with a show
serialization group looks weird
src/Sylius/Bundle/ApiBundle/Resources/config/services/security.xml
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/ApiBundle/spec/Doctrine/QueryExtension/AddressExtensionSpec.php
Outdated
Show resolved
Hide resolved
ebc1dec
to
4b685a9
Compare
Thank you, @Wojdylak! |
uriTemplate="/shop/addresses" | ||
security="is_granted('SYLIUS_SHOP_USER')" | ||
itemUriTemplate="/shop/addresses/{id}" | ||
processor="sylius_api.state_processor.post.address" |
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.
sylius_api.state_processor.address.post
🤔
<operation | ||
class="ApiPlatform\Metadata\Get" | ||
controller="ApiPlatform\Action\NotFoundAction" | ||
read="false" | ||
output="false" | ||
routePrefix="admin" | ||
/> |
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 wonder if it doesn't make sense to also retrieve individually 🤔 but we can think about that in the future, it wasn't possible before either
@@ -10,6 +10,7 @@ parameters: | |||
sylius.api.doctrine_extension.order_visitor_item.filter_cart.allowed_non_get_operations: | |||
- "shop_select_payment_method" | |||
sylius.api.paths_to_hide: | |||
- "%sylius.security.new_api_route%/admin/address-log-entry/{id}" |
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'm afraid it does not work currently on APIP 3 branch if I see correctly
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.
Yes, but I have added it so we wouldn't forget about it.
return false; | ||
} | ||
|
||
public function supportsAttribute(string $attribute): bool |
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 would be for putting public methods before protected ones
if (self::SYLIUS_SHOP_USER === $attribute) { | ||
return true; | ||
} | ||
|
||
return false; |
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.
Simply:
return self::SYLIUS_SHOP_USER === $attribute;
or even use supportsAttribute
method