本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}