Created
May 15, 2024 19:16
-
-
Save lchrusciel/29c498b2b590536a3422471e9f95f951 to your computer and use it in GitHub Desktop.
Sample configuration of new promotion action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// src/Promotion/Action/FreeItemPromotionActionCommand.php | |
declare(strict_types=1); | |
namespace App\Promotion\Action; | |
use Sylius\Component\Promotion\Action\PromotionActionCommandInterface; | |
use Sylius\Component\Promotion\Model\PromotionInterface; | |
use Sylius\Component\Promotion\Model\PromotionSubjectInterface; | |
final class FreeItemPromotionActionCommand implements PromotionActionCommandInterface | |
{ | |
public function execute(PromotionSubjectInterface $subject, array $configuration, PromotionInterface $promotion): bool | |
{ | |
// Promotion logic | |
} | |
public function revert(PromotionSubjectInterface $subject, array $configuration, PromotionInterface $promotion): void | |
{ | |
// Promotion reverting logic | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
# other definitions | |
App\Promotion\Action\FreeItemPromotionActionCommand: | |
tags: | |
- { | |
name: sylius.promotion_action, | |
type: free_item, | |
label: 'app.form.promotion_action.free_item', | |
form_type: App\Form\Type\Promotion\Action\FreeItemConfigurationType | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment