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

Fixes after reviews #15104

Merged
merged 1 commit into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ Feature: Seeing payment method instructions after checkout
And I have product "PHP T-Shirt" in the cart
When I proceed selecting "Offline" payment method
And I confirm my order
And I should be informed with "Offline" payment method instructions
Then I should be informed with "Offline" payment method instructions
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,19 @@ function it_filters_products_by_available_associations(

$queryBuilder->getRootAliases()->willReturn(['o']);
$queryBuilder->addSelect('o')->shouldBeCalled()->willReturn($queryBuilder);

$queryBuilder->addSelect('association')->shouldBeCalled()->willReturn($queryBuilder);
$queryBuilder->leftJoin('o.associations', 'association')->shouldBeCalled()->willReturn($queryBuilder);

$expr->andX(Argument::type(Expr\Comparison::class), Argument::type(Expr\Comparison::class))->willReturn($andx);
$expr->eq('associatedProduct.enabled', 'true')->shouldBeCalled()->willReturn($comparison);
$expr->eq('association.owner', 'o')->shouldBeCalled()->willReturn($comparison);
$queryBuilder->expr()->willReturn($expr->getWrappedObject());
$queryBuilder->leftJoin('association.associatedProducts', 'associatedProduct', 'WITH', Argument::type(Andx::class))->shouldBeCalled()->willReturn($queryBuilder);

$queryBuilder->andWhere('o.associations IS EMPTY OR associatedProduct.id IS NOT NULL')->shouldBeCalled()->willReturn($queryBuilder);
$queryBuilder->andWhere('o.enabled = :enabled')->shouldBeCalled()->willReturn($queryBuilder);

$queryBuilder->setParameter('enabled', true)->shouldBeCalled()->willReturn($queryBuilder);

$this->applyToCollection($queryBuilder, $queryNameGenerator, ProductInterface::class, 'get', []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,11 @@ public function findOneByChannelAndCodeWithAvailableAssociations(ChannelInterfac

if (null === $product) {
$product = $this->findOneByChannelAndCode($channel, $code);
if (null === $product) {
return null;
}

$product?->getAssociations()->clear();
$product->getAssociations()->clear();
}

$this->associationHydrator->hydrateAssociations($product, [
Expand Down