Last active
May 27, 2024 08:48
-
-
Save lchrusciel/dbafc8a89c0c1a25352bda43e338325a to your computer and use it in GitHub Desktop.
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\Bundle\PromotionBundle\Attribute\AsPromotionAction; | |
use Sylius\Component\Promotion\Action\PromotionActionCommandInterface; | |
use Sylius\Component\Promotion\Model\PromotionInterface; | |
use Sylius\Component\Promotion\Model\PromotionSubjectInterface; | |
use App\Form\Type\Promotion\Action\FreeItemConfigurationType; | |
#[AsPromotionAction( | |
type: 'free_item', | |
label: 'app.form.promotion_action.free_item', | |
formType: FreeItemConfigurationType::class | |
)] | |
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 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment