Skip to content

Commit

Permalink
Add WbMaximumClicks strategy to DynamicTextCampaignSearchStrategy
Browse files Browse the repository at this point in the history
  • Loading branch information
SonicGD committed Aug 11, 2021
1 parent 8660ba5 commit 96a45da
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ class DynamicTextCampaignSearchStrategy extends Model implements ICallbackValida
*/
public $BiddingStrategyType;

/**
* @var StrategyMaximumClicksAdd
* @Assert\Valid()
* @Assert\Type(type="directapi\services\campaigns\models\strategies\StrategyMaximumClicksAdd")
*/
public $WbMaximumClicks;

/**
* @var StrategyMaximumConversionRateAdd
* @Assert\Valid()
Expand Down Expand Up @@ -74,6 +81,11 @@ class DynamicTextCampaignSearchStrategy extends Model implements ICallbackValida
*/
public function isValid(ExecutionContextInterface $context): void
{
if ($this->BiddingStrategyType === TextCampaignSearchStrategyTypeEnum::WB_MAXIMUM_CLICKS && !$this->WbMaximumClicks) {
$context->buildViolation('Свойство WbMaximumClicks должно быть указано, если BiddingStrategyType=WB_MAXIMUM_CLICKS')
->atPath('WbMaximumClicks')->addViolation();
}

if ($this->BiddingStrategyType === TextCampaignSearchStrategyTypeEnum::WB_MAXIMUM_CONVERSION_RATE && !$this->WbMaximumConversionRate) {
$context->buildViolation('Свойство WbMaximumConversionRate должно быть указано, если BiddingStrategyType=WB_MAXIMUM_CONVERSION_RATE')
->atPath('WbMaximumConversionRate')->addViolation();
Expand Down

0 comments on commit 96a45da

Please sign in to comment.