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

Stateless cart provider #3637

Merged
merged 1 commit into from
Nov 29, 2015
Merged

Conversation

PWalkow
Copy link
Contributor

@PWalkow PWalkow commented Nov 26, 2015

Services should be stateless. CartProvider holding cart was just premature optimisation and just wrong.

@@ -48,11 +48,11 @@ class CartProvider implements CartProviderInterface
protected $cartFactory;

/**
* Cart repository.
* Cart Repository.
Copy link
Member

Choose a reason for hiding this comment

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

Quite obvious, don't you think?

@pjedrzejewski pjedrzejewski added RFC Discussions about potential changes or new features. Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.). labels Nov 26, 2015
$eventDispatcher->dispatch(SyliusCartEvents::CART_INITIALIZE, Argument::any())->shouldBeCalled();
$cartRepository->find()->shouldNotBeCalled();

$this->initialize_cart_should_be_called_on($eventDispatcher);
Copy link
Member

Choose a reason for hiding this comment

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

Spec's are not the classes, so it is not a good practice to remove duplications. I found it less readable with this private method. And instead of reading what it should do, I have to jump to private declaration. And it is used only twice. Remove this method.

@PWalkow PWalkow force-pushed the stateless-cart-provider branch 5 times, most recently from e4bba40 to 20ee12c Compare November 26, 2015 14:48
@PWalkow PWalkow changed the title [WIP] Stateless cart provider Stateless cart provider Nov 26, 2015
@PWalkow
Copy link
Contributor Author

PWalkow commented Nov 26, 2015

Ready.

@peteward
Copy link

Feedback please, this is underpinning sorting out finances.

pjedrzejewski pushed a commit that referenced this pull request Nov 29, 2015
@pjedrzejewski pjedrzejewski merged commit 1903730 into Sylius:master Nov 29, 2015
@pjedrzejewski
Copy link
Member

@peteward @PWalkow 👍 Thank you Piotr and Peter. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.). RFC Discussions about potential changes or new features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants