Skip to content
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

[Variation] Reusable Set Builders for generating variants + VariantGenerator spec coverage #2198

Merged
merged 1 commit into from
Jan 13, 2015

Conversation

adamelso
Copy link
Contributor

Q A
Bug fix? no
New feature? yes
BC breaks? yes
Deprecations? no
Fixed tickets -
License MIT
Doc PR Sylius/Sylius-Docs#232

Whilst working on writing specs for the VariantGenerator, I could see why there weren't any to begin with.
Now the most complicated logic has been extracted out to a new class CartesianSetBuilder, which implements SetBuilderInterface, so this has the added benefit of allowing developers to define their own strategies for generating variants.

Unfortunately, the disadvantage of this being that the set builder has to be explicitly passed to the constructor of VariantGenerator, and only math boffins would be aware of what a set builder and the Cartesian product are.

@pjedrzejewski
Copy link
Member

Nice, let's wait for the build. :)

I think it is not a problem if someone does not know what a Cartesian product is. With these changes, the design is better and generation easier to change, so 👍.

@adamelso adamelso changed the title Reusable Set Builders for generating variants with VariantGenerator spec coverage [Variation] Reusable Set Builders for generating variants + VariantGenerator spec coverage Dec 1, 2014
@@ -0,0 +1,62 @@
<?php

namespace Sylius\Component\Variation\SetBuilder;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing license note.

@adamelso
Copy link
Contributor Author

@stloyd Thanks, I've addressed your comments and have squashed the commits.


if (1 === $countArrays) {
return reset($setTuples);
} elseif (0 === $countArrays) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be just if as you call return in previous one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@stloyd
Copy link
Contributor

stloyd commented Jan 13, 2015

@pjedrzejewski ping...

pjedrzejewski pushed a commit that referenced this pull request Jan 13, 2015
[Variation] Reusable Set Builders for generating variants + VariantGenerator spec coverage
@pjedrzejewski pjedrzejewski merged commit a606310 into Sylius:master Jan 13, 2015
@pjedrzejewski
Copy link
Member

Thank you Adam! 👍

pamil pushed a commit to pamil/Sylius that referenced this pull request May 7, 2019
[Variation] Reusable Set Builders for generating variants + VariantGenerator spec coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants