當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Core_DAO::objectExists方法代碼示例

本文整理匯總了PHP中CRM_Core_DAO::objectExists方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Core_DAO::objectExists方法的具體用法?PHP CRM_Core_DAO::objectExists怎麽用?PHP CRM_Core_DAO::objectExists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_Core_DAO的用法示例。


在下文中一共展示了CRM_Core_DAO::objectExists方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: formRule

 /**
  * global form rule
  *
  * @param array $fields  the input form values
  *
  * @return true if no errors, else array of errors
  * @access public
  * @static
  */
 static function formRule(&$fields, $files, $self)
 {
     $errors = array();
     if ($self->_id) {
         $contactName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_ContactType', $self->_id, 'name');
     } else {
         $contactName = ucfirst(CRM_Utils_String::munge($fields['label']));
     }
     if (!CRM_Core_DAO::objectExists($contactName, 'CRM_Contact_DAO_ContactType', $self->_id)) {
         $errors['label'] = ts('This contact type name already exists in database. Contact type names must be unique.');
     }
     return empty($errors) ? true : $errors;
 }
開發者ID:bhirsch,項目名稱:voipdev,代碼行數:22,代碼來源:ContactType.php

示例2: objectExists

 /**
  * Check if there is a record with the same name in the db
  *
  * @param string $value     the value of the field we are checking
  * @param array  $options   the daoName and fieldName (optional )
  *
  * @return boolean     true if object exists
  * @access public
  * @static
  */
 static function objectExists($value, $options)
 {
     $name = 'name';
     if (isset($options[2])) {
         $name = $options[2];
     }
     return CRM_Core_DAO::objectExists($value, CRM_Utils_Array::value(0, $options), CRM_Utils_Array::value(1, $options), CRM_Utils_Array::value(2, $options, $name));
 }
開發者ID:archcidburnziso,項目名稱:civicrm-core,代碼行數:18,代碼來源:Rule.php

示例3: formRule

 /**
  * Global form rule.
  *
  * @param array $fields
  *   The input form values.
  *
  * @param $files
  * @param $self
  *
  * @return bool|array
  *   true if no errors, else array of errors
  */
 public static function formRule($fields, $files, $self)
 {
     $errors = array();
     if ($self->_id) {
         $contactName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_ContactType', $self->_id, 'name');
     } else {
         $contactName = ucfirst(CRM_Utils_String::munge($fields['label']));
     }
     if (!CRM_Core_DAO::objectExists($contactName, 'CRM_Contact_DAO_ContactType', $self->_id)) {
         $errors['label'] = ts('This contact type name already exists in database. Contact type names must be unique.');
     }
     $reservedKeyWords = CRM_Core_SelectValues::customGroupExtends();
     //restrict "name" from being a reserved keyword when a new contact subtype is created
     if (!$self->_id && in_array($contactName, array_keys($reservedKeyWords))) {
         $errors['label'] = ts('Contact type names should not use reserved keywords.');
     }
     return empty($errors) ? TRUE : $errors;
 }
開發者ID:FundingWorks,項目名稱:civicrm-core,代碼行數:30,代碼來源:ContactType.php

示例4: formRule

 /**
  * Global validation rules for the form.
  *
  * @param array $values
  * @param $files
  * @param $self
  *
  * @return array
  *   list of errors to be posted back to the form
  */
 public static function formRule($values, $files, $self)
 {
     $errors = array();
     if (!empty($values['contact_name']) && !is_numeric($values['created_id'])) {
         $errors['contact_name'] = ts('Please select a valid contact.');
     }
     if ($values['item_count'] && (!is_numeric($values['item_count']) || $values['item_count'] < 1)) {
         $errors['item_count'] = ts('Number of Transactions should a positive number');
     }
     if ($values['total'] && (!is_numeric($values['total']) || $values['total'] <= 0)) {
         $errors['total'] = ts('Total Amount should be a positive number');
     }
     if (!empty($values['created_date']) && date('Y-m-d') < date('Y-m-d', strtotime($values['created_date']))) {
         $errors['created_date'] = ts('Created date cannot be greater than current date');
     }
     $batchName = $values['title'];
     if (!CRM_Core_DAO::objectExists($batchName, 'CRM_Batch_DAO_Batch', $self->_id)) {
         $errors['title'] = ts('This name already exists in database. Batch names must be unique.');
     }
     return CRM_Utils_Array::crmIsEmptyArray($errors) ? TRUE : $errors;
 }
開發者ID:utkarshsharma,項目名稱:civicrm-core,代碼行數:31,代碼來源:FinancialBatch.php

示例5: objectExists

 /**
  * Check if there is a record with the same name in the db
  *
  * @param string $value     the value of the field we are checking
  * @param array  $options   the daoName and fieldName (optional )
  *
  * @return boolean     true if object exists
  * @access public
  * @static
  */
 function objectExists($value, $options)
 {
     return CRM_Core_DAO::objectExists($value, $options[0], $options[1], CRM_Utils_Array::value(2, $options, 'name'));
 }
開發者ID:bhirsch,項目名稱:voipdrupal-4.7-1.0,代碼行數:14,代碼來源:Rule.php


注:本文中的CRM_Core_DAO::objectExists方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。