-
-
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
[Product] VariantFactory naming changes #4065
Conversation
{ | ||
if (null === $product = $this->productRepository->find($productId)) { | ||
throw new \InvalidArgumentException(sprintf('Product with id "%s" does not exist.', $productId)); | ||
if (null === $product = $this->productRepository->find($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.
Can we extract the assignment before the if
?
So we should first agree on that convention and then rename the factory if needed. I'd vote for leaving out the Product prefix here, cause it seems to be duplicated when we have Product in the namespace already. If we ever end up with 2 Variant concepts in that namespace (I doubt) then it is a much bigger problem than prefixing/not-prefixing stuff.
Saying "Create variant based on product id" may sound reasonable but in reality we are "Creating a variant of a product with ID", but |
|
Let's hear few more opinions on the naming because we will go with that convention for other factories as well. :) |
I'm for adding subject to the name of generic classes like |
8eb4266
to
c94a12c
Compare
Ok, so finally after hours of discussion we decided to stay with |
[Product] VariantFactory naming changes
Thanks Mateusz! 👍 |
VariantFactory
intoProductVariantFactory
, as it's placed in Product component and creates onlyProductVariant
objectscreateForProduct
method intocreateBasedOnProductId