/** * Validation function for optional constraints * * @param RentRecoveryPlusMta $mta * @param ExecutionContextInterface $context */ public function checkRateBandLimits($mta, ExecutionContextInterface $context) { if (ReferenceTypes::isOnlyAllowBandA($mta->getReferenceType()) && $mta->getPropertyRental() > RentRecoveryPlus::BAND_A_LIMIT) { $context->addViolationAt('propertyRental', 'Monthly rental amount cannot be greater than £' . RentRecoveryPlus::BAND_A_LIMIT, array(), null); } else { if ($mta->getPropertyRental() > RentRecoveryPlus::BAND_B_LIMIT) { $context->addViolationAt('propertyRental', 'Monthly rental amount cannot be greater than £' . RentRecoveryPlus::BAND_B_LIMIT, array(), null); } } }