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


PHP DataSource::save方法代码示例

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


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

示例1: save

 public function save(MessageStack $errors)
 {
     $xsl_errors = new MessageStack();
     if (strlen(trim($this->parameters()->xml)) == 0) {
         $errors->append('xml', __('This is a required field'));
     } elseif (!General::validateXML($this->parameters()->xml, $xsl_errors)) {
         if (XSLProc::hasErrors()) {
             $errors->append('xml', sprintf('XSLT specified is invalid. The following error was returned: "%s near line %s"', $xsl_errors->current()->message, $xsl_errors->current()->line));
         } else {
             $errors->append('xml', 'XSLT specified is invalid.');
         }
     }
     return parent::save($errors);
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:14,代码来源:class.datasource.php

示例2: save

 public function save(MessageStack $errors)
 {
     if (strlen(trim($this->parameters()->url)) == 0) {
         $errors->append('url', __('This is a required field'));
     }
     if (strlen(trim($this->parameters()->xpath)) == 0) {
         $errors->append('xpath', __('This is a required field'));
     }
     //	Cache Lifetime
     if (!is_numeric($this->parameters()->{'cache-lifetime'})) {
         $errors->append('cache-lifetime', __('Must be a valid number'));
     } elseif ($this->parameters()->{'cache-lifetime'} <= 0) {
         $errors->append('cache-lifetime', __('Must be greater than zero'));
     } else {
         $this->parameters()->{'cache-lifetime'} = (int) $this->parameters()->{'cache-lifetime'};
     }
     //	Timeout
     if (!is_numeric($this->parameters()->{'timeout'})) {
         $errors->append('timeout', __('Must be a valid number'));
     } elseif ($this->parameters()->{'timeout'} <= 0) {
         $errors->append('timeout', __('Must be greater than zero'));
     } else {
         $this->parameters()->{'timeout'} = (int) $this->parameters()->{'timeout'};
     }
     return parent::save($errors);
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:26,代码来源:class.datasource.php

示例3: save

 public function save(MessageStack $errors)
 {
     if (strlen(trim($this->parameters()->limit)) == 0 || is_numeric($this->parameters()->limit) && $this->parameters()->limit < 1) {
         $errors->append('limit', __('A result limit must be set'));
     }
     if (strlen(trim($this->parameters()->page)) == 0 || is_numeric($this->parameters()->page) && $this->parameters()->page < 1) {
         $errors->append('page', __('A page number must be set'));
     }
     return parent::save($errors);
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:10,代码来源:class.datasource.php

示例4: save

 public function save(MessageStack $errors)
 {
     $xsl_errors = new MessageStack();
     if (strlen(trim($this->parameters()->{'addresses'})) == 0) {
         $errors->append('addresses', __('This is a required field'));
     }
     return parent::save($errors);
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:8,代码来源:class.datasource.php


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