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


PHP Field::validateData方法代码示例

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


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

示例1: validateData

 public function validateData(MessageStack $errors, Entry $entry, $data = null)
 {
     if (self::STATUS_OK != parent::validateData($errors, $entry, $data)) {
         return self::STATUS_ERROR;
     }
     if (!isset($data->value)) {
         return self::STATUS_OK;
     }
     if (!is_numeric($data->value)) {
         $errors->append(null, (object) array('message' => __("'%s' must be a number.", array($this->{'name'})), 'code' => self::ERROR_INVALID));
         return self::STATUS_ERROR;
     }
     return self::STATUS_OK;
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:14,代码来源:field.number.php

示例2: validateData

 public function validateData(MessageStack $errors, Entry $entry = null, $data = null)
 {
     if (empty($data)) {
         return self::STATUS_OK;
     }
     if (self::STATUS_OK != parent::validateData($errors, $entry, $data)) {
         return self::STATUS_ERROR;
     }
     if (!is_null($data->value) && strlen(trim($data->value)) > 0 && !self::__isValidDateString($data->value)) {
         $errors->append(null, (object) array('message' => __("The date specified in '%s' is invalid.", array($this->{'publish-label'})), 'code' => self::ERROR_INVALID));
         return self::STATUS_ERROR;
     }
     return self::STATUS_OK;
 }
开发者ID:symphonycms,项目名称:symphony-3,代码行数:14,代码来源:field.date.php

示例3: validateData

 public function validateData(MessageStack $errors, Entry $entry = null, $data = null)
 {
     if (!is_array($data)) {
         $data = array($data);
     }
     $value = NULL;
     foreach ($data as $d) {
         $value .= $d->value;
     }
     return parent::validateData($errors, $entry, $this->processData($value, $entry));
 }
开发者ID:pointybeard,项目名称:symphony-3,代码行数:11,代码来源:field.select.php

示例4: validateData

 public function validateData(MessageStack $errors, Entry $entry, $data = null)
 {
     $length = (int) $this->{'text-length'};
     if (self::STATUS_OK != parent::validateData($errors, $entry, $data)) {
         return self::STATUS_ERROR;
     }
     if (!isset($data->value)) {
         return self::STATUS_OK;
     }
     if (!$this->applyValidationRules($data->value)) {
         $errors->append(null, (object) array('message' => __("'%s' contains invalid data. Please check the contents.", array($this->name)), 'code' => self::ERROR_INVALID));
         return self::STATUS_ERROR;
     }
     if ($length > 0 and $length < strlen($data->value)) {
         $errors->append(null, (object) array('message' => __("'%s' must be no longer than %s characters.", array($this->{'name'}, $length)), 'code' => self::ERROR_INVALID));
         return self::STATUS_ERROR;
     }
     return self::STATUS_OK;
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:19,代码来源:field.textbox.php


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