Skip to content

Commit

Permalink
Do not export empty carts (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
lruozzi9 committed Aug 7, 2023
1 parent 7518adc commit 3407507
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ parameters:
- src
- tests/Behat

excludes_analyse:
excludePaths:
# Makes PHPStan crash
- 'src/DependencyInjection/Configuration.php'

Expand Down
2 changes: 2 additions & 0 deletions src/Doctrine/ORM/ActiveCampaignOrderRepositoryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ public function findNewCartsNotModifiedSince(DateTimeInterface $terminalDate): a
assert($this instanceof EntityRepository);

return $this->createQueryBuilder('o')
->distinct()
->join('o.customer', 'c')
->join('o.items', 'oi')
->andWhere('o.state = :state')
->andWhere('o.customer IS NOT NULL')
->andWhere('o.activeCampaignId IS NULL')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ App\Entity\Order\Order:
customer: '@customer_bob'
updatedAt: '<(new DateTime("-2 day"))>'
activeCampaignId: null
items:
- '@cart_1_day_old_item_1'
- '@cart_1_day_old_item_2'
cart_1_day_old_without_items:
channel: '@fashion_shop'
state: 'cart'
currency_code: 'EUR'
locale_code: 'en_US'
customer: '@customer_sam'
updatedAt: '<(new DateTime("-2 day"))>'
activeCampaignId: null
cart_new:
channel: '@fashion_shop'
state: 'cart'
Expand All @@ -32,3 +43,24 @@ App\Entity\Order\Order:
updatedAt: '<(new DateTime("now"))>'
activeCampaignId: null

Sylius\Component\Core\Model\OrderItem:
cart_1_day_old_item_1:
order: '@cart_1_day_old'
variant: '@variant_1'
cart_1_day_old_item_2:
order: '@cart_1_day_old'
variant: '@variant_2'

Sylius\Component\Core\Model\ProductVariant:
variant_1:
code: 'variant_1'
product: '@product_1'
variant_2:
code: 'variant_2'
product: '@product_1'

Sylius\Component\Core\Model\Product:
product_1:
code: 'product_1'
variants:
- '@variant_1'

0 comments on commit 3407507

Please sign in to comment.