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


PHP Validator\ExecutionContextInterface类代码示例

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


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

示例1: checkValidDiaporama

 public function checkValidDiaporama($value, ExecutionContextInterface $context)
 {
     $value = intval($value);
     if (is_null(DiaporamaQuery::create()->findOneById($value))) {
         $context->addViolation($this->trans('diaporama.delete.invalid_diaporama %diaporama_id', array('diaporama_id' => $value)));
     }
 }
开发者ID:InformatiqueProg,项目名称:Diaporamas,代码行数:7,代码来源:DiaporamaDeleteForm.php

示例2: isValid

 public function isValid(ExecutionContextInterface $context)
 {
     $is_valid = $this->start <= $this->end;
     if (!$is_valid) {
         $context->addViolationAt('end', 'bladetester_calendar.validation.event_dates', array(), null);
     }
 }
开发者ID:stephylee,项目名称:calendar-bundle,代码行数:7,代码来源:Event.php

示例3: verifyExistingEmail

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

示例4: 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:bobanmilano,项目名称:thelia,代码行数:7,代码来源:NewsletterForm.php

示例5: verifyCountry

 public function verifyCountry($value, ExecutionContextInterface $context)
 {
     $address = CountryQuery::create()->findPk($value);
     if (null === $address) {
         $context->addViolation(Translator::getInstance()->trans("Country ID not found"));
     }
 }
开发者ID:manuelbcd,项目名称:thelia,代码行数:7,代码来源:OrderUpdateAddress.php

示例6: verifyCountryList

 public function verifyCountryList($value, ExecutionContextInterface $context)
 {
     $jsonType = new JsonType();
     if (!$jsonType->isValid($value)) {
         $context->addViolation(Translator::getInstance()->trans("Country list is not valid JSON"));
     }
     $countryList = json_decode($value, true);
     foreach ($countryList as $countryItem) {
         if (is_array($countryItem)) {
             $country = CountryQuery::create()->findPk($countryItem[0]);
             if (null === $country) {
                 $context->addViolation(Translator::getInstance()->trans("Country ID %id not found", ['%id' => $countryItem[0]]));
             }
             if ($countryItem[1] == "0") {
                 continue;
             }
             $state = StateQuery::create()->findPk($countryItem[1]);
             if (null === $state) {
                 $context->addViolation(Translator::getInstance()->trans("State ID %id not found", ['%id' => $countryItem[1]]));
             }
         } else {
             $context->addViolation(Translator::getInstance()->trans("Wrong country definition"));
         }
     }
 }
开发者ID:zorn-v,项目名称:thelia,代码行数:25,代码来源:TaxRuleTaxListUpdateForm.php

示例7: 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:badelas,项目名称:thelia,代码行数:7,代码来源:CustomerLostPasswordForm.php

示例8: verifyExistingLogin

 public function verifyExistingLogin($value, ExecutionContextInterface $context)
 {
     $administrator = AdminQuery::create()->findOneByLogin($value);
     if ($administrator !== null) {
         $context->addViolation("This login already exists");
     }
 }
开发者ID:margery,项目名称:thelia,代码行数:7,代码来源:AdministratorCreationForm.php

示例9:

 function it_does_not_validate_a_non_existent_channel($channelManager, Channel $constraint, ExecutionContextInterface $context)
 {
     $channelManager->getChannelChoices()->willReturn(['mobile' => 'mobile']);
     $context->addViolation(Argument::cetera())->shouldBeCalled();
     $this->initialize($context);
     $this->validate('Magento', $constraint);
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:7,代码来源:ChannelValidatorSpec.php

示例10: validateSlug

 public function validateSlug($blog, ExecutionContextInterface $context)
 {
     $unique = $this->getDoctrineRepo('AppBundle:Blog')->isSlugUnique($blog->getSlug(), $blog->getId());
     if (!$unique) {
         $context->buildViolation('The slug is not unique')->addViolation();
     }
 }
开发者ID:artur-dante,项目名称:heyrentme,代码行数:7,代码来源:BlogController.php

示例11: isDataValid

 public function isDataValid(ExecutionContextInterface $context)
 {
     // valid only on first call
     if (++self::$validationCalls > 1) {
         $context->addViolation('Take this!');
     }
 }
开发者ID:raizeta,项目名称:CraueFormFlowBundle,代码行数:7,代码来源:RevalidatePreviousStepsData.php

示例12: 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:badelas,项目名称:thelia,代码行数:13,代码来源:SaleModificationForm.php

示例13: 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:jantotof,项目名称:thelia,代码行数:7,代码来源:CustomerUpdateForm.php

示例14: checkCityName

 public function checkCityName($value, ExecutionContextInterface $context)
 {
     $isValid = InseeGeoMunicipalityQuery::create()->findOneById($value);
     if (!isset($isValid)) {
         $context->addViolation(Translator::getInstance()->trans('city.error', [], INSEEGeo::DOMAIN_NAME));
     }
 }
开发者ID:enurit,项目名称:INSEEGeo,代码行数:7,代码来源:SelectCityFormType.php

示例15: verifyTaxList

 public function verifyTaxList($value, ExecutionContextInterface $context)
 {
     $jsonType = new JsonType();
     if (!$jsonType->isValid($value)) {
         $context->addViolation(Translator::getInstance()->trans("Tax list is not valid JSON"));
     }
     $taxList = json_decode($value, true);
     /* check we have 2 level max */
     foreach ($taxList as $taxLevel1) {
         if (is_array($taxLevel1)) {
             foreach ($taxLevel1 as $taxLevel2) {
                 if (is_array($taxLevel2)) {
                     $context->addViolation(Translator::getInstance()->trans("Bad tax list JSON"));
                 } else {
                     $taxModel = TaxQuery::create()->findPk($taxLevel2);
                     if (null === $taxModel) {
                         $context->addViolation(Translator::getInstance()->trans("Tax ID not found in tax list JSON"));
                     }
                 }
             }
         } else {
             $taxModel = TaxQuery::create()->findPk($taxLevel1);
             if (null === $taxModel) {
                 $context->addViolation(Translator::getInstance()->trans("Tax ID not found in tax list JSON"));
             }
         }
     }
 }
开发者ID:alex63530,项目名称:thelia,代码行数:28,代码来源:TaxRuleTaxListUpdateForm.php


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