-
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
Add latest products #237
Add latest products #237
Conversation
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.
Awesome!
return $this->viewHandler->handle(View::create($this->productLatestQuery->getLatestProducts( | ||
$request->query->get('channel'), | ||
$request->query->get('locale'), | ||
(int) $request->query->get('limit', 4) |
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.
get -> getInt?
@@ -0,0 +1,5 @@ | |||
shop_api_product_show_latest: | |||
path: /product-latest/ |
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.
/products/latest/
? WDYT? Not sure if it will not collide with some other route.
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 there is a conflict with /shop-api/products/{code}
, any other suggestions?
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.
you are right
use Sylius\ShopApiPlugin\View\ProductListView; | ||
use Webmozart\Assert\Assert; | ||
|
||
class ProductLatestViewRepository implements ProductLatestViewRepositoryInterface |
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 final
private $productViewFactory; | ||
|
||
/** | ||
* ProductLatestViewRepository constructor. |
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.
Redundant
@sdleiw are you willing to apply this small changes? Just small things, but we can make them in one shot. Also, all the files are missing a blank line at the end of file(it is required due to cleaner github diffs) |
Hi @lchrusciel, thanks for the review, I'll take care of them, is there some kind of Code-Style that you use for the project, or just psr-2 |
We have. Mostly Symfony coding standard, PSR's, and our own clean code rules. All of them are put in https://github.com/SyliusLabs/CodingStandard. I just need to check to use them properly. |
Thanks Lei for contributing! :) |
cool, had a lot of fun working on this repo |
I'm glad to hear that :) |
propose this PR to fetch latest products
the API looks like
/shop-api/product-latest/
, with 3 parameterschannel
,locale
andlimit
, wherechannel
is required andlimit
default value is 4, which matches the latest product counts on the demo shopdon't hesitate to leave comments on what's missing or inappropriate