當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。