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


PHP InputException::wasErrorAdded方法代码示例

本文整理汇总了PHP中Magento\Framework\Exception\InputException::wasErrorAdded方法的典型用法代码示例。如果您正苦于以下问题:PHP InputException::wasErrorAdded方法的具体用法?PHP InputException::wasErrorAdded怎么用?PHP InputException::wasErrorAdded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\Exception\InputException的用法示例。


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

示例1: testAddErrorWithSameMessage

 /**
  * Verify the message and params are not used to determine the call count
  *
  * @return void
  */
 public function testAddErrorWithSameMessage()
 {
     $rawMessage = 'Foo "%var"';
     $params = ['var' => 'Bar'];
     $expectedProcessedMessage = 'Foo "Bar"';
     $inputException = new InputException(new Phrase($rawMessage, $params));
     $this->assertEquals($rawMessage, $inputException->getRawMessage());
     $this->assertEquals($expectedProcessedMessage, $inputException->getMessage());
     $this->assertEquals($expectedProcessedMessage, $inputException->getLogMessage());
     $this->assertFalse($inputException->wasErrorAdded());
     $this->assertCount(0, $inputException->getErrors());
     $inputException->addError(new Phrase($rawMessage, $params));
     $this->assertEquals($expectedProcessedMessage, $inputException->getMessage());
     $this->assertEquals($expectedProcessedMessage, $inputException->getLogMessage());
     $this->assertTrue($inputException->wasErrorAdded());
     $this->assertCount(0, $inputException->getErrors());
     $inputException->addError(new Phrase($rawMessage, $params));
     $this->assertEquals($expectedProcessedMessage, $inputException->getMessage());
     $this->assertEquals($expectedProcessedMessage, $inputException->getLogMessage());
     $this->assertTrue($inputException->wasErrorAdded());
     $errors = $inputException->getErrors();
     $this->assertCount(2, $errors);
     $this->assertEquals($expectedProcessedMessage, $errors[0]->getMessage());
     $this->assertEquals($expectedProcessedMessage, $errors[0]->getLogMessage());
     $this->assertEquals($expectedProcessedMessage, $errors[1]->getMessage());
     $this->assertEquals($expectedProcessedMessage, $errors[1]->getLogMessage());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:32,代码来源:InputExceptionTest.php

示例2: validate

 /**
  * Validate user credentials
  *
  * @param string $username
  * @param string $password
  * @throws InputException
  * @return void
  */
 public function validate($username, $password)
 {
     $exception = new InputException();
     if (!is_string($username) || strlen($username) == 0) {
         $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'username']));
     }
     if (!is_string($password) || strlen($password) == 0) {
         $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'password']));
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:21,代码来源:CredentialsValidator.php

示例3: validate

 private function validate(PostInterface $post)
 {
     $exception = new InputException();
     if (!\Zend_Validate::is(trim($post->getTitle()), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'title']));
     }
     if (!\Zend_Validate::is(trim($post->getUrlKey()), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'url_key']));
     }
     $id = $this->_resourceModel->checkUrlKey($post->getUrlKey());
     if ($id && $id != $post->getId()) {
         $exception->addError(__(InputException::DEFAULT_MESSAGE));
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:swnsma,项目名称:practice,代码行数:17,代码来源:PostRepository.php

示例4: validateTaxClassData

 /**
  * Validate TaxClass Data
  *
  * @param \Magento\Tax\Api\Data\TaxClassInterface $taxClass
  * @return void
  * @throws InputException
  */
 protected function validateTaxClassData(\Magento\Tax\Api\Data\TaxClassInterface $taxClass)
 {
     $exception = new InputException();
     if (!\Zend_Validate::is(trim($taxClass->getClassName()), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => TaxClassInterface::KEY_NAME]));
     }
     $classType = $taxClass->getClassType();
     if (!\Zend_Validate::is(trim($classType), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => TaxClassInterface::KEY_TYPE]));
     } elseif ($classType !== TaxClassManagementInterface::TYPE_CUSTOMER && $classType !== TaxClassManagementInterface::TYPE_PRODUCT) {
         $exception->addError(__(InputException::INVALID_FIELD_VALUE, ['fieldName' => TaxClassInterface::KEY_TYPE, 'value' => $classType]));
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:23,代码来源:Repository.php

示例5: validate

 /**
  * Validate tax rule
  *
  * @param TaxRule $rule
  * @return void
  * @throws InputException
  *
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 private function validate(TaxRule $rule)
 {
     $exception = new InputException();
     if (!\Zend_Validate::is(trim($rule->getSortOrder()), 'GreaterThan', [-1])) {
         $exception->addError(InputException::INVALID_FIELD_MIN_VALUE, ['fieldName' => TaxRule::SORT_ORDER, 'value' => $rule->getSortOrder(), 'minValue' => 0]);
     }
     if (!\Zend_Validate::is(trim($rule->getPriority()), 'GreaterThan', [-1])) {
         $exception->addError(InputException::INVALID_FIELD_MIN_VALUE, ['fieldName' => TaxRule::PRIORITY, 'value' => $rule->getPriority(), 'minValue' => 0]);
     }
     // Code is required
     if (!\Zend_Validate::is(trim($rule->getCode()), 'NotEmpty')) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => TaxRule::CODE]);
     }
     // customer tax class ids is required
     if ($rule->getCustomerTaxClassIds() === null || !$rule->getCustomerTaxClassIds()) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => TaxRule::CUSTOMER_TAX_CLASS_IDS]);
     }
     // product tax class ids is required
     if ($rule->getProductTaxClassIds() === null || !$rule->getProductTaxClassIds()) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => TaxRule::PRODUCT_TAX_CLASS_IDS]);
     }
     // tax rate ids is required
     if ($rule->getTaxRateIds() === null || !$rule->getTaxRateIds()) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => TaxRule::TAX_RATE_IDS]);
     }
     // throw exception if errors were found
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:40,代码来源:TaxRuleService.php

示例6: validate

 /**
  * Validate thesaurus values
  *
  * @param \Smile\ElasticsuiteThesaurus\Api\Data\ThesaurusInterface $thesaurus the thesaurus to validate
  *
  * @return void
  * @throws \Magento\Framework\Exception\InputException
  */
 protected function validate(\Smile\ElasticsuiteThesaurus\Api\Data\ThesaurusInterface $thesaurus)
 {
     $exception = new \Magento\Framework\Exception\InputException();
     $validator = new \Zend_Validate();
     if (!$validator->is(trim($thesaurus->getName()), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'name']));
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:smile-sa,项目名称:elasticsuite,代码行数:19,代码来源:ThesaurusRepository.php

示例7: processInputError

 /**
  * Process an input error
  *
  * @param array $inputError
  * @return void
  * @throws InputException
  */
 protected function processInputError($inputError)
 {
     if (!empty($inputError)) {
         $exception = new InputException();
         foreach ($inputError as $errorParamField) {
             $exception->addError(new Phrase(InputException::REQUIRED_FIELD, ['fieldName' => $errorParamField]));
         }
         if ($exception->wasErrorAdded()) {
             throw $exception;
         }
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:19,代码来源:ServiceInputProcessor.php

示例8: _validate

 /**
  * Validate group values.
  *
  * @param \Magento\Customer\Api\Data\GroupInterface $group
  * @throws InputException
  * @return void
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 private function _validate($group)
 {
     $exception = new InputException();
     if (!\Zend_Validate::is($group->getCode(), 'NotEmpty')) {
         $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'code']));
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:20,代码来源:GroupRepository.php

示例9: validate

 /**
  * Validate tax rate
  *
  * @param \Magento\Tax\Api\Data\TaxRateInterface $taxRate
  * @throws InputException
  * @return void
  *
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 private function validate(\Magento\Tax\Api\Data\TaxRateInterface $taxRate)
 {
     $exception = new InputException();
     $countryCode = $taxRate->getTaxCountryId();
     if (!\Zend_Validate::is($countryCode, 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'country_id']));
     } elseif (!\Zend_Validate::is($this->countryFactory->create()->loadByCode($countryCode)->getId(), 'NotEmpty')) {
         $exception->addError(__(InputException::INVALID_FIELD_VALUE, ['fieldName' => 'country_id', 'value' => $countryCode]));
     }
     $regionCode = $taxRate->getTaxRegionId();
     // if regionCode eq 0 (all regions *), do not validate with existing region list
     if (\Zend_Validate::is($regionCode, 'NotEmpty') && $regionCode != "0" && !\Zend_Validate::is($this->regionFactory->create()->load($regionCode)->getId(), 'NotEmpty')) {
         $exception->addError(__(InputException::INVALID_FIELD_VALUE, ['fieldName' => 'region_id', 'value' => $regionCode]));
     }
     if (!\Zend_Validate::is($taxRate->getRate(), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'percentage_rate']));
     }
     if (!\Zend_Validate::is(trim($taxRate->getCode()), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'code']));
     }
     if ($taxRate->getZipIsRange()) {
         $zipRangeFromTo = ['zip_from' => $taxRate->getZipFrom(), 'zip_to' => $taxRate->getZipTo()];
         foreach ($zipRangeFromTo as $key => $value) {
             if (!is_numeric($value) || $value < 0) {
                 $exception->addError(__(InputException::INVALID_FIELD_VALUE, ['fieldName' => $key, 'value' => $value]));
             }
         }
         if ($zipRangeFromTo['zip_from'] > $zipRangeFromTo['zip_to']) {
             $exception->addError(__('Range To should be equal or greater than Range From.'));
         }
     } else {
         if (!\Zend_Validate::is(trim($taxRate->getTaxPostcode()), 'NotEmpty')) {
             $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'postcode']));
         }
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:opexsw,项目名称:magento2,代码行数:49,代码来源:RateRepository.php

示例10: process

    /**
     * Convert the input array from key-value format to a list of parameters suitable for the specified class / method.
     *
     * The input array should have the field name as the key, and the value will either be a primitive or another
     * key-value array.  The top level of this array needs keys that match the names of the parameters on the
     * service method.
     *
     * Mismatched types are caught by the PHP runtime, not explicitly checked for by this code.
     *
     * @param string $serviceClassName name of the service class that we are trying to call
     * @param string $serviceMethodName name of the method that we are trying to call
     * @param array $inputArray data to send to method in key-value format
     * @return array list of parameters that can be used to call the service method
     * @throws InputException if no value is provided for required parameters
     */
    public function process($serviceClassName, $serviceMethodName, array $inputArray)
    {
        $inputData = [];
        $inputError = [];
        foreach ($this->getMethodParams($serviceClassName, $serviceMethodName) as $param) {
            $paramName = $param['name'];
            $snakeCaseParamName = strtolower(preg_replace("/(?<=\\w)(?=[A-Z])/", "_$1", $paramName));
            if (isset($inputArray[$paramName]) || isset($inputArray[$snakeCaseParamName])) {
                $paramValue = isset($inputArray[$paramName])
                    ? $inputArray[$paramName]
                    : $inputArray[$snakeCaseParamName];

                $inputData[] = $this->_convertValue($paramValue, $param['type']);
            } else {
                if ($param['isDefaultValueAvailable']) {
                    $inputData[] = $param['defaultValue'];
                } else {
                    $inputError[] = $paramName;
                }
            }
        }

        if (!empty($inputError)) {
            $exception = new InputException();
            foreach ($inputError as $errorParamField) {
                $exception->addError(new Phrase(InputException::REQUIRED_FIELD, ['fieldName' => $errorParamField]));
            }
            if ($exception->wasErrorAdded()) {
                throw $exception;
            }
        }

        return $inputData;
    }
开发者ID:nja78,项目名称:magento2,代码行数:49,代码来源:ServiceInputProcessor.php

示例11: validate

 /**
  * Validate customer attribute values.
  *
  * @param CustomerModel $customerModel
  * @throws InputException
  * @return void
  *
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 private function validate(CustomerModel $customerModel)
 {
     $exception = new InputException();
     if (!\Zend_Validate::is(trim($customerModel->getFirstname()), 'NotEmpty')) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'firstname']);
     }
     if (!\Zend_Validate::is(trim($customerModel->getLastname()), 'NotEmpty')) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'lastname']);
     }
     if (!\Zend_Validate::is($customerModel->getEmail(), 'EmailAddress')) {
         $exception->addError(InputException::INVALID_FIELD_VALUE, ['fieldName' => 'email', 'value' => $customerModel->getEmail()]);
     }
     $dob = $this->getAttributeMetadata('dob');
     if (!is_null($dob) && $dob->isRequired() && '' == trim($customerModel->getDob())) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'dob']);
     }
     $taxvat = $this->getAttributeMetadata('taxvat');
     if (!is_null($taxvat) && $taxvat->isRequired() && '' == trim($customerModel->getTaxvat())) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'taxvat']);
     }
     $gender = $this->getAttributeMetadata('gender');
     if (!is_null($gender) && $gender->isRequired() && '' == trim($customerModel->getGender())) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'gender']);
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:38,代码来源:CustomerAccountService.php

示例12: _validate

 /**
  * Validate group values.
  *
  * @param \Magento\Customer\Api\Data\GroupInterface $group
  * @throws InputException
  * @return void
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 private function _validate($group)
 {
     $exception = new InputException();
     if (!\Zend_Validate::is($group->getCode(), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'code']));
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:nja78,项目名称:magento2,代码行数:20,代码来源:GroupRepository.php

示例13: validate

 /**
  * Validate tax rate
  *
  * @param TaxRateDataObject $taxRate
  * @throws InputException
  * @return void
  *
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 private function validate(TaxRateDataObject $taxRate)
 {
     $exception = new InputException();
     $countryCode = $taxRate->getCountryId();
     if (!\Zend_Validate::is($countryCode, 'NotEmpty')) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'country_id']);
     } else {
         if (!\Zend_Validate::is($this->countryFactory->create()->loadByCode($countryCode)->getId(), 'NotEmpty')) {
             $exception->addError(InputException::INVALID_FIELD_VALUE, ['fieldName' => 'country_id', 'value' => $countryCode]);
         }
     }
     $regionCode = $taxRate->getRegionId();
     if (\Zend_Validate::is($regionCode, 'NotEmpty') && !\Zend_Validate::is($this->regionFactory->create()->load($regionCode)->getId(), 'NotEmpty')) {
         $exception->addError(InputException::INVALID_FIELD_VALUE, ['fieldName' => 'region_id', 'value' => $regionCode]);
     }
     if (!\Zend_Validate::is($taxRate->getPercentageRate(), 'NotEmpty')) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'percentage_rate']);
     }
     if (!\Zend_Validate::is(trim($taxRate->getCode()), 'NotEmpty')) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'code']);
     }
     if ($taxRate->getZipRange()) {
         $zipRangeFromTo = ['zip_from' => $taxRate->getZipRange()->getFrom(), 'zip_to' => $taxRate->getZipRange()->getTo()];
         foreach ($zipRangeFromTo as $key => $value) {
             if (!is_numeric($value) || $value < 0) {
                 $exception->addError(InputException::INVALID_FIELD_VALUE, ['fieldName' => $key, 'value' => $value]);
             }
         }
         if ($zipRangeFromTo['zip_from'] > $zipRangeFromTo['zip_to']) {
             $exception->addError('Range To should be equal or greater than Range From.');
         }
     } else {
         if (!\Zend_Validate::is(trim($taxRate->getPostcode()), 'NotEmpty')) {
             $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'postcode']);
         }
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:aiesh,项目名称:magento2,代码行数:50,代码来源:TaxRateService.php

示例14: validate

 /**
  * Validate tax rule
  *
  * @param TaxRule $rule
  * @return void
  * @throws InputException
  *
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 private function validate(TaxRule $rule)
 {
     $exception = new InputException();
     // SortOrder is required and must be 0 or greater
     if (!\Zend_Validate::is(trim($rule->getSortOrder()), 'NotEmpty')) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => TaxRule::SORT_ORDER]);
     }
     if (!\Zend_Validate::is(trim($rule->getSortOrder()), 'GreaterThan', [-1])) {
         $exception->addError(InputException::INVALID_FIELD_MIN_VALUE, ['fieldName' => TaxRule::SORT_ORDER, 'value' => $rule->getSortOrder(), 'minValue' => 0]);
     }
     // Priority is required and must be 0 or greater
     if (!\Zend_Validate::is(trim($rule->getPriority()), 'NotEmpty')) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => TaxRule::PRIORITY]);
     }
     if (!\Zend_Validate::is(trim($rule->getPriority()), 'GreaterThan', [-1])) {
         $exception->addError(InputException::INVALID_FIELD_MIN_VALUE, ['fieldName' => TaxRule::PRIORITY, 'value' => $rule->getPriority(), 'minValue' => 0]);
     }
     // Code is required
     if (!\Zend_Validate::is(trim($rule->getCode()), 'NotEmpty')) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => TaxRule::CODE]);
     }
     // customer tax class ids is required
     if ($rule->getCustomerTaxClassIds() === null || !$rule->getCustomerTaxClassIds()) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => TaxRule::CUSTOMER_TAX_CLASS_IDS]);
     } else {
         // see if the customer tax class ids exist
         $customerTaxClassIds = $rule->getCustomerTaxClassIds();
         foreach ($customerTaxClassIds as $customerTaxClassId) {
             try {
                 $taxClass = $this->taxClassService->getTaxClass($customerTaxClassId);
                 if (is_null($taxClass) || !($taxClass->getClassType() == TaxClassModel::TAX_CLASS_TYPE_CUSTOMER)) {
                     $exception->addError(NoSuchEntityException::MESSAGE_SINGLE_FIELD, ['fieldName' => TaxRule::CUSTOMER_TAX_CLASS_IDS, 'value' => $customerTaxClassId]);
                 }
             } catch (NoSuchEntityException $e) {
                 $exception->addError($e->getRawMessage(), $e->getParameters());
             }
         }
     }
     // product tax class ids is required
     if ($rule->getProductTaxClassIds() === null || !$rule->getProductTaxClassIds()) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => TaxRule::PRODUCT_TAX_CLASS_IDS]);
     } else {
         // see if the product tax class ids exist
         $productTaxClassIds = $rule->getProductTaxClassIds();
         foreach ($productTaxClassIds as $productTaxClassId) {
             try {
                 $taxClass = $this->taxClassService->getTaxClass($productTaxClassId);
                 if (is_null($taxClass) || !($taxClass->getClassType() == TaxClassModel::TAX_CLASS_TYPE_PRODUCT)) {
                     $exception->addError(NoSuchEntityException::MESSAGE_SINGLE_FIELD, ['fieldName' => TaxRule::PRODUCT_TAX_CLASS_IDS, 'value' => $productTaxClassId]);
                 }
             } catch (NoSuchEntityException $e) {
                 $exception->addError($e->getRawMessage(), $e->getParameters());
             }
         }
     }
     // tax rate ids is required
     if ($rule->getTaxRateIds() === null || !$rule->getTaxRateIds()) {
         $exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => TaxRule::TAX_RATE_IDS]);
     }
     // throw exception if errors were found
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:aiesh,项目名称:magento2,代码行数:74,代码来源:TaxRuleService.php

示例15: _validate

 /**
  * Validate Slider Item values.
  *
  * @param \Stepzerosolutions\Tbslider\Api\Data\SlideritemsInterface $slider
  * @throws InputException
  * @return void
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 private function _validate($slider)
 {
     $exception = new InputException();
     if (!\Zend_Validate::is($slider->getSlideritemTitle(), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'slideritem_title']));
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }
开发者ID:stepzerosolutions,项目名称:tbslider,代码行数:20,代码来源:ItemsRepository.php


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