当前位置: 首页>>代码示例>>PHP>>正文


PHP Context\ExecutionContextInterface类代码示例

本文整理汇总了PHP中Symfony\Component\Validator\Context\ExecutionContextInterface的典型用法代码示例。如果您正苦于以下问题:PHP ExecutionContextInterface类的具体用法?PHP ExecutionContextInterface怎么用?PHP ExecutionContextInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ExecutionContextInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: verifyExistingEmail

 public function verifyExistingEmail($value, ExecutionContextInterface $context)
 {
     $customer = NewsletterQuery::create()->filterByUnsubscribed(false)->findOneByEmail($value);
     if ($customer) {
         $context->addViolation(Translator::getInstance()->trans("You are already registered!"));
     }
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:7,代码来源:NewsletterForm.php

示例2: isValidUppMsgType

 /**
  * @param ExecutionContextInterface $context
  */
 public function isValidUppMsgType(ExecutionContextInterface $context)
 {
     $uppMsgType = $this->getUppMsgType();
     if (self::MSGTYPE_GET !== $uppMsgType) {
         $context->addViolationAt('status', "Invalid uppMsgType '{$uppMsgType}' given!");
     }
 }
开发者ID:ibrows,项目名称:datatrans,代码行数:10,代码来源:CancelAuthorizationResponse.php

示例3: verifyExistingCode

 public function verifyExistingCode($value, ExecutionContextInterface $context)
 {
     $coupon = CouponQuery::create()->findOneByCode($value);
     if (null === $coupon) {
         $context->addViolation(Translator::getInstance()->trans("This coupon does not exists"));
     }
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:7,代码来源:CouponCode.php

示例4: isDataValid

 /**
  * @Assert\Callback(groups={"flow_revalidatePreviousSteps_step1"})
  */
 public function isDataValid(ExecutionContextInterface $context)
 {
     // valid only on first call
     if (++self::$validationCalls > 1) {
         $context->addViolation('Take this!');
     }
 }
开发者ID:Nairebis,项目名称:CraueFormFlowBundle,代码行数:10,代码来源:RevalidatePreviousStepsData.php

示例5: verifyTaxId

 public function verifyTaxId($value, ExecutionContextInterface $context)
 {
     $tax = TaxQuery::create()->findPk($value);
     if (null === $tax) {
         $context->addViolation("Tax ID not found");
     }
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:7,代码来源:TaxModificationForm.php

示例6: verifyExistingEmail

 public function verifyExistingEmail($value, ExecutionContextInterface $context)
 {
     $customer = CustomerQuery::getCustomerByEmail($value);
     if ($customer) {
         $context->addViolation(Translator::getInstance()->trans("This email already exists."));
     }
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:7,代码来源:CustomerCreateForm.php

示例7: checkDate

 /**
  * Validate a date entered with the current edition Language date format.
  *
  * @param string                    $value
  * @param ExecutionContextInterface $context
  */
 public function checkDate($value, ExecutionContextInterface $context)
 {
     $format = self::PHP_DATE_FORMAT;
     if (!empty($value) && false === \DateTime::createFromFormat($format, $value)) {
         $context->addViolation(Translator::getInstance()->trans("Date '%date' is invalid, please enter a valid date using %fmt format", ['%fmt' => self::MOMENT_JS_DATE_FORMAT, '%date' => $value]));
     }
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:13,代码来源:SaleModificationForm.php

示例8: checkDuplicateCode

 public function checkDuplicateCode($value, ExecutionContextInterface $context)
 {
     $currency = CurrencyQuery::create()->findOneByCode($value);
     if ($currency) {
         $context->addViolation(Translator::getInstance()->trans('A currency with code "%name" already exists.', ['%name' => $value]));
     }
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:7,代码来源:CurrencyCreationForm.php

示例9: verifyEmailField

 public function verifyEmailField($value, ExecutionContextInterface $context)
 {
     $data = $context->getRoot()->getData();
     if (isset($data["email_confirm"]) && $data["email"] != $data["email_confirm"]) {
         $context->addViolation(Translator::getInstance()->trans("email confirmation is not the same as email field"));
     }
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:7,代码来源:CustomerUpdateForm.php

示例10: verifyExistingEmail

 public function verifyExistingEmail($value, ExecutionContextInterface $context)
 {
     $customer = CustomerQuery::create()->findOneByEmail($value);
     if (null === $customer) {
         $context->addViolation(Translator::getInstance()->trans("This email does not exists"));
     }
 }
开发者ID:gillesbourgeat,项目名称:core,代码行数:7,代码来源:CustomerLostPasswordForm.php

示例11: verifyPasswordField

 public function verifyPasswordField($value, ExecutionContextInterface $context)
 {
     $data = $context->getRoot()->getData();
     if ($data["password"] != $data["password_confirm"]) {
         $context->addViolation(Translator::getInstance()->trans("password confirmation is not the same as password field"));
     }
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:7,代码来源:CustomerPasswordUpdateForm.php

示例12: checkPassword

 public function checkPassword(ExecutionContextInterface $context)
 {
     if (!$this->user->checkPassword($this->encoderFactory, $this->password)) {
         $context->buildViolation('The specified password is invalid.')->atPath('password')->addViolation();
         return false;
     }
 }
开发者ID:zyxist,项目名称:cantiga,代码行数:7,代码来源:EmailChangeIntent.php

示例13: checkRefDifferent

 public function checkRefDifferent($value, ExecutionContextInterface $context)
 {
     $originalRef = ProductQuery::create()->filterByRef($value, Criteria::EQUAL)->count();
     if ($originalRef !== 0) {
         $context->addViolation($this->translator->trans('This product reference is already assigned to another product.'));
     }
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:7,代码来源:ProductCloneForm.php

示例14: checkDuplicateName

 public function checkDuplicateName($value, ExecutionContextInterface $context)
 {
     $config = ConfigQuery::create()->findOneByName($value);
     if ($config) {
         $context->addViolation(Translator::getInstance()->trans('A variable with name "%name" already exists.', array('%name' => $value)));
     }
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:7,代码来源:ConfigCreationForm.php

示例15: checkDuplicateRef

 public function checkDuplicateRef($value, ExecutionContextInterface $context)
 {
     $count = ProductQuery::create()->filterByRef($value)->count();
     if ($count > 0) {
         $context->addViolation(Translator::getInstance()->trans("A product with reference %ref already exists. Please choose another reference.", array('%ref' => $value)));
     }
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:7,代码来源:ProductCreationForm.php


注:本文中的Symfony\Component\Validator\Context\ExecutionContextInterface类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。