本文整理汇总了PHP中Tinebase_Record_Abstract::isValid方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Record_Abstract::isValid方法的具体用法?PHP Tinebase_Record_Abstract::isValid怎么用?PHP Tinebase_Record_Abstract::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_Record_Abstract
的用法示例。
在下文中一共展示了Tinebase_Record_Abstract::isValid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _importRecord
/**
* import single record
*
* @param Tinebase_Record_Abstract $_record
* @param string $_resolveStrategy
* @param array $_recordData not needed here but in other import classes (i.a. Admin_Import_Csv)
* @return Tinebase_Record_Abstract the imported record
* @throws Tinebase_Exception_Record_Validation
*/
protected function _importRecord($_record, $_resolveStrategy = NULL, $_recordData = array())
{
$_record->isValid(TRUE);
if ($this->_options['dryrun']) {
Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
}
$this->_handleTags($_record, $_resolveStrategy);
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Record to import: ' . print_r($_record->toArray(), true));
}
$importedRecord = $this->_importAndResolveConflict($_record, $_resolveStrategy);
$this->_importResult['results']->addRecord($importedRecord);
if ($this->_options['dryrun']) {
Tinebase_TransactionManager::getInstance()->rollBack();
} else {
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Successfully imported record with id ' . $importedRecord->getId());
}
}
$this->_importResult['totalcount']++;
return $importedRecord;
}
示例2: isValid
/**
* validate and filter the the internal data
*
* @param $_throwExceptionOnInvalidData
* @return bool
* @throws Tinebase_Exception_Record_Validation
*/
public function isValid($_throwExceptionOnInvalidData = false)
{
$isValid = parent::isValid($_throwExceptionOnInvalidData);
if (isset($this->_properties['count']) && isset($this->_properties['until'])) {
$isValid = $this->_isValidated = false;
if ($_throwExceptionOnInvalidData) {
$e = new Tinebase_Exception_Record_Validation('count and until can not be set both');
Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . $e);
throw $e;
}
}
return $isValid;
}
示例3: isValid
/**
* additional validation
*
* @param $_throwExceptionOnInvalidData
* @return bool
* @throws Tinebase_Exception_Record_Validation
* @see Tinebase_Record_Abstract::isValid()
*/
function isValid($_throwExceptionOnInvalidData = false)
{
if (!$this->__get('org_name') && !$this->__get('n_family')) {
array_push($this->_validationErrors, array('id' => 'org_name', 'msg' => 'either "org_name" or "n_family" must be given!'));
array_push($this->_validationErrors, array('id' => 'n_family', 'msg' => 'either "org_name" or "n_family" must be given!'));
$valid = false;
} else {
$valid = true;
}
$parentException = false;
$parentValid = false;
try {
$parentValid = parent::isValid($_throwExceptionOnInvalidData);
} catch (Tinebase_Exception_Record_Validation $e) {
$parentException = $e;
}
if ($_throwExceptionOnInvalidData && (!$valid || !$parentValid)) {
if (!$valid) {
$message = 'either "org_name" or "n_family" must be given!';
}
if ($parentException) {
$message .= ', ' . $parentException->getMessage();
}
$e = new Tinebase_Exception_Record_Validation($message);
if (!$valid) {
Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ":\n" . print_r($this->_validationErrors, true) . $e);
}
throw $e;
}
return $parentValid && $valid;
}