-
Notifications
You must be signed in to change notification settings - Fork 89
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
Adds an endpoint to get a list of countries, and provinces by country #722
Conversation
First of all thank you for your contribution in adding those endpoints. As I see the endpoints you added provide a list of countries and a list of provinces by country code. In this case I would suggest to not use a custom controller but rather use the default Sylius controller like If you want to have a look where this is already in use then have a look at the address_book configuration file: |
Thanks for your comment! |
Controllers for both countries and provinces are available as services |
You're right! Thanks, I know better now. I just looked into it and tested using their controllers instead of mines. However, I don't think
But... |
After some more investigation, I think we should use a custom Controller instead of |
So if I understand you correctly you have the problem that one endpoint has "too much" info and the other has too little. I think those things both can be relegated with some serialization information. This can be defined in the yaml files, see the Address and Addressbook for reference. The other issue is that the endpoint is paginated. But that is fixed easily. In the route definition of Sylius Resources you can disable it: https://github.com/Sylius/SyliusResourceBundle/blob/0bb5ab5dd36edc2e6402d22f0431f2d600efe488/docs/index_resources.md#disabling-pagination---getting-a-simple-collection |
Thank you @mamazu! This is the very last thing blocking me. Do you have any idea about how to fix this ? |
Just off the top of my head serialization should has option to specify getter method to get your property and if it won't work, then there is virtual method option as well. |
@mamazu There was no way to specify a getter but it worked like a charm with virtual methods. The PR is now ready again for review. |
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.
Looks good. Let's see if the pipeline says.
Thanks you two for the combined effort. This solution looks much cleaner (no code is fewer things that can break). I am not sure about when the pipeline is going to run, but when they are all green I'll merge it. |
Hey folks! Lack of the builds was slightly my mistake. It is good now 👍 |
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.
@medteck my congratulation for your first contribution 👍 I hope it won't be last.
Also, I need to 👏 for the cooperation that happen over this PR :)
|
||
|
||
namespace Tests\Sylius\ShopApiPlugin\Controller\Checkout; | ||
|
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 license block
Removes unnecessary line Co-authored-by: Łukasz Chruściel <lchrusciel@gmail.com>
Makes CountriesApiTest final Co-authored-by: Łukasz Chruściel <lchrusciel@gmail.com>
So the only thing that is missing is the license block. I think that this should be part of the coding style configuration of this project so that it is the same license everywhere. |
I have added the license block to the master branch. Just rebase onto it and then run the codestyle ( |
I tried to add the license block with Here's my output :
Thus, I don't see any license block in other files. |
Yeah, the ECS package is broken. (Because the Yaml Interpreter it is based on changed). But what you can do is do the following: $serviceKeywordsProperty = (new ReflectionClass(YamlFileLoader::class))
->getStaticProperties()['serviceKeywords']; with $serviceKeywordsProperty = ['services']; This should fix it as long as you don't update it. :D But in the end we need to migrate to php configuration for the ECS anyways. |
@mamazu
|
Are those the most recent dependencies, that's the only issue I have got. If they are can you maybe provide me with the composer.lock file so that I can reproduce the issue? |
Look like the pipeline is green now. I will merge it in the next few days. |
Resolves #519