diff --git a/CRM/ACL/DAO/ACL.php b/CRM/ACL/DAO/ACL.php index a4e3359c6dde..fbb4110cb613 100644 --- a/CRM/ACL/DAO/ACL.php +++ b/CRM/ACL/DAO/ACL.php @@ -1,29 +1,5 @@ __table = 'civicrm_acl'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('ACL ID') , + 'title' => ts('ACL ID'), 'description' => 'Unique table ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_acl', 'entity' => 'ACL', 'bao' => 'CRM_ACL_BAO_ACL', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('ACL Name') , + 'title' => ts('ACL Name'), 'description' => 'ACL Name.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -167,70 +158,70 @@ static function &fields() { 'entity' => 'ACL', 'bao' => 'CRM_ACL_BAO_ACL', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'deny' => array( + ], + ], + 'deny' => [ 'name' => 'deny', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Deny ACL?') , + 'title' => ts('Deny ACL?'), 'description' => 'Is this ACL entry Allow (0) or Deny (1) ?', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_acl', 'entity' => 'ACL', 'bao' => 'CRM_ACL_BAO_ACL', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Radio', - ) , - ) , - 'entity_table' => array( + ], + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('ACL Entity') , + 'title' => ts('ACL Entity'), 'description' => 'Table of the object possessing this ACL entry (Contact, Group, or ACL Group)', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_acl', 'entity' => 'ACL', 'bao' => 'CRM_ACL_BAO_ACL', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity ID') , + 'title' => ts('Entity ID'), 'description' => 'ID of the object possessing this ACL', 'table_name' => 'civicrm_acl', 'entity' => 'ACL', 'bao' => 'CRM_ACL_BAO_ACL', 'localizable' => 0, - ) , - 'operation' => array( + ], + 'operation' => [ 'name' => 'operation', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('ACL Operation') , + 'title' => ts('ACL Operation'), 'description' => 'What operation does this ACL entry control?', - 'required' => true, + 'required' => TRUE, 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, 'table_name' => 'civicrm_acl', 'entity' => 'ACL', 'bao' => 'CRM_ACL_BAO_ACL', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_ACL_BAO_ACL::operation', - ) - ) , - 'object_table' => array( + ] + ], + 'object_table' => [ 'name' => 'object_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('ACL Object') , + 'title' => ts('ACL Object'), 'description' => 'The table of the object controlled by this ACL entry', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -238,21 +229,21 @@ static function &fields() { 'entity' => 'ACL', 'bao' => 'CRM_ACL_BAO_ACL', 'localizable' => 0, - ) , - 'object_id' => array( + ], + 'object_id' => [ 'name' => 'object_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('ACL Object ID') , + 'title' => ts('ACL Object ID'), 'description' => 'The ID of the object controlled by this ACL entry', 'table_name' => 'civicrm_acl', 'entity' => 'ACL', 'bao' => 'CRM_ACL_BAO_ACL', 'localizable' => 0, - ) , - 'acl_table' => array( + ], + 'acl_table' => [ 'name' => 'acl_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('ACL Table') , + 'title' => ts('ACL Table'), 'description' => 'If this is a grant/revoke entry, what table are we granting?', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -260,63 +251,67 @@ static function &fields() { 'entity' => 'ACL', 'bao' => 'CRM_ACL_BAO_ACL', 'localizable' => 0, - ) , - 'acl_id' => array( + ], + 'acl_id' => [ 'name' => 'acl_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('ACL Group ID') , + 'title' => ts('ACL Group ID'), 'description' => 'ID of the ACL or ACL group being granted/revoked', 'table_name' => 'civicrm_acl', 'entity' => 'ACL', 'bao' => 'CRM_ACL_BAO_ACL', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('ACL Is Active?') , + 'title' => ts('ACL Is Active?'), 'description' => 'Is this property active?', 'table_name' => 'civicrm_acl', 'entity' => 'ACL', 'bao' => 'CRM_ACL_BAO_ACL', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - ); + ], + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -324,10 +319,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -335,24 +331,30 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_acl_id' => array( + $indices = [ + 'index_acl_id' => [ 'name' => 'index_acl_id', - 'field' => array( + 'field' => [ 0 => 'acl_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_acl::0::acl_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/ACL/DAO/Cache.php b/CRM/ACL/DAO/Cache.php index 16c1af6755b1..c505046dc4d1 100644 --- a/CRM/ACL/DAO/Cache.php +++ b/CRM/ACL/DAO/Cache.php @@ -1,29 +1,5 @@ __table = 'civicrm_acl_cache'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'acl_id', 'civicrm_acl', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'acl_id', 'civicrm_acl', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Cache ID') , + 'title' => ts('Cache ID'), 'description' => 'Unique table ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_acl_cache', 'entity' => 'Cache', 'bao' => 'CRM_ACL_BAO_Cache', 'localizable' => 0, - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Cache Contact') , + 'title' => ts('Cache Contact'), 'description' => 'Foreign Key to Contact', 'table_name' => 'civicrm_acl_cache', 'entity' => 'Cache', 'bao' => 'CRM_ACL_BAO_Cache', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'acl_id' => array( + ], + 'acl_id' => [ 'name' => 'acl_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Cache ACL') , + 'title' => ts('Cache ACL'), 'description' => 'Foreign Key to ACL', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_acl_cache', 'entity' => 'Cache', 'bao' => 'CRM_ACL_BAO_Cache', 'localizable' => 0, 'FKClassName' => 'CRM_ACL_DAO_ACL', - ) , - 'modified_date' => array( + ], + 'modified_date' => [ 'name' => 'modified_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Cache Modified Date') , + 'title' => ts('Cache Modified Date'), 'description' => 'When was this cache entry last modified', - 'required' => false, + 'required' => FALSE, 'table_name' => 'civicrm_acl_cache', 'entity' => 'Cache', 'bao' => 'CRM_ACL_BAO_Cache', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -189,10 +177,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl_cache', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl_cache', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -200,24 +189,30 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl_cache', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl_cache', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_acl_id' => array( + $indices = [ + 'index_acl_id' => [ 'name' => 'index_acl_id', - 'field' => array( + 'field' => [ 0 => 'acl_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_acl_cache::0::acl_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/ACL/DAO/EntityRole.php b/CRM/ACL/DAO/EntityRole.php index 5ecda4016a70..d80702423716 100644 --- a/CRM/ACL/DAO/EntityRole.php +++ b/CRM/ACL/DAO/EntityRole.php @@ -1,29 +1,5 @@ __table = 'civicrm_acl_entity_role'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity Role') , + 'title' => ts('Entity Role'), 'description' => 'Unique table ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_acl_entity_role', 'entity' => 'EntityRole', 'bao' => 'CRM_ACL_BAO_EntityRole', 'localizable' => 0, - ) , - 'acl_role_id' => array( + ], + 'acl_role_id' => [ 'name' => 'acl_role_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('ACL Role ID') , + 'title' => ts('ACL Role ID'), 'description' => 'Foreign Key to ACL Role (which is an option value pair and hence an implicit FK)', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_acl_entity_role', 'entity' => 'EntityRole', 'bao' => 'CRM_ACL_BAO_EntityRole', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Table') , + 'title' => ts('Entity Table'), 'description' => 'Table of the object joined to the ACL Role (Contact or Group)', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_acl_entity_role', 'entity' => 'EntityRole', 'bao' => 'CRM_ACL_BAO_EntityRole', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('ACL Entity ID') , + 'title' => ts('ACL Entity ID'), 'description' => 'ID of the group/contact object being joined', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_acl_entity_role', 'entity' => 'EntityRole', 'bao' => 'CRM_ACL_BAO_EntityRole', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('ACL Entity Role is Active') , + 'title' => ts('ACL Entity Role is Active'), 'description' => 'Is this property active?', 'table_name' => 'civicrm_acl_entity_role', 'entity' => 'EntityRole', 'bao' => 'CRM_ACL_BAO_EntityRole', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -205,10 +194,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl_entity_role', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl_entity_role', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -216,33 +206,39 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl_entity_role', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl_entity_role', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_role' => array( + $indices = [ + 'index_role' => [ 'name' => 'index_role', - 'field' => array( + 'field' => [ 0 => 'acl_role_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_acl_entity_role::0::acl_role_id', - ) , - 'index_entity' => array( + ], + 'index_entity' => [ 'name' => 'index_entity', - 'field' => array( + 'field' => [ 0 => 'entity_table', 1 => 'entity_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_acl_entity_role::0::entity_table::entity_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Activity/DAO/Activity.php b/CRM/Activity/DAO/Activity.php index d619c2e99029..ce006eac72ba 100644 --- a/CRM/Activity/DAO/Activity.php +++ b/CRM/Activity/DAO/Activity.php @@ -1,29 +1,5 @@ __table = 'civicrm_activity'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'phone_id', 'civicrm_phone', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_activity', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'relationship_id', 'civicrm_relationship', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'original_id', 'civicrm_activity', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_id', 'civicrm_phone', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_activity', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'relationship_id', 'civicrm_relationship', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'original_id', 'civicrm_activity', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'activity_id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'activity_id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Activity ID') , + 'title' => ts('Activity ID'), 'description' => 'Unique Other Activity ID', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_activity.id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - ) , - 'source_record_id' => array( + ], + 'source_record_id' => [ 'name' => 'source_record_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Source Record') , + 'title' => ts('Source Record'), 'description' => 'Artificial FK to original transaction (e.g. contribution) IF it is not an Activity. Table can be figured out through activity_type_id, and further through component registry.', 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - ) , - 'activity_type_id' => array( + ], + 'activity_type_id' => [ 'name' => 'activity_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Activity Type ID') , + 'title' => ts('Activity Type ID'), 'description' => 'FK to civicrm_option_value.id, that has to be valid, registered activity type.', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_activity.activity_type_id', 'headerPattern' => '/(activity.)?type(.id$)/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'default' => '1', 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'activity_type', 'optionEditPath' => 'civicrm/admin/options/activity_type', - ) - ) , - 'activity_subject' => array( + ] + ], + 'activity_subject' => [ 'name' => 'subject', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Subject') , + 'title' => ts('Subject'), 'description' => 'The subject/purpose/short description of the activity.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_activity.subject', 'headerPattern' => '/(activity.)?subject/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'activity_date_time' => array( + ], + ], + 'activity_date_time' => [ 'name' => 'activity_date_time', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Activity Date') , + 'title' => ts('Activity Date'), 'description' => 'Date and time this activity is scheduled to occur. Formerly named scheduled_date_time.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_activity.activity_date_time', 'headerPattern' => '/(activity.)?date(.time$)?/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'formatType' => 'activityDateTime', - ) , - ) , - 'activity_duration' => array( + ], + ], + 'activity_duration' => [ 'name' => 'duration', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Duration') , + 'title' => ts('Duration'), 'description' => 'Planned or actual duration of activity expressed in minutes. Conglomerate of former duration_hours and duration_minutes.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_activity.duration', 'headerPattern' => '/(activity.)?duration(s)?$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'activity_location' => array( + ], + ], + 'activity_location' => [ 'name' => 'location', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Location') , + 'title' => ts('Location'), 'description' => 'Location of the activity (optional, open text).', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_activity.location', 'headerPattern' => '/(activity.)?location$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'phone_id' => array( + ], + ], + 'phone_id' => [ 'name' => 'phone_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Phone (called) ID') , + 'title' => ts('Phone (called) ID'), 'description' => 'Phone ID of the number called (optional - used if an existing phone number is selected).', 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Phone', - 'html' => array( + 'html' => [ 'type' => 'EntityRef', - ) , - ) , - 'phone_number' => array( + ], + ], + 'phone_number' => [ 'name' => 'phone_number', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Phone (called) Number') , + 'title' => ts('Phone (called) Number'), 'description' => 'Phone number in case the number does not exist in the civicrm_phone table.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -392,126 +394,126 @@ static function &fields() { 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'activity_details' => array( + ], + ], + 'activity_details' => [ 'name' => 'details', 'type' => CRM_Utils_Type::T_LONGTEXT, - 'title' => ts('Details') , + 'title' => ts('Details'), 'description' => 'Details about the activity (agenda, notes, etc).', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_activity.details', 'headerPattern' => '/(activity.)?detail(s)?$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'RichTextEditor', - ) , - ) , - 'activity_status_id' => array( + ], + ], + 'activity_status_id' => [ 'name' => 'status_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Activity Status') , + 'title' => ts('Activity Status'), 'description' => 'ID of the status this activity is currently in. Foreign key to civicrm_option_value.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_activity.status_id', 'headerPattern' => '/(activity.)?status(.label$)?/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'activity_status', 'optionEditPath' => 'civicrm/admin/options/activity_status', - ) - ) , - 'priority_id' => array( + ] + ], + 'priority_id' => [ 'name' => 'priority_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Priority') , + 'title' => ts('Priority'), 'description' => 'ID of the priority given to this activity. Foreign key to civicrm_option_value.', 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'priority', 'optionEditPath' => 'civicrm/admin/options/priority', - ) - ) , - 'parent_id' => array( + ] + ], + 'parent_id' => [ 'name' => 'parent_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Parent Activity Id') , + 'title' => ts('Parent Activity Id'), 'description' => 'Parent meeting ID (if this is a follow-up item). This is not currently implemented', 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, 'FKClassName' => 'CRM_Activity_DAO_Activity', - ) , - 'activity_is_test' => array( + ], + 'activity_is_test' => [ 'name' => 'is_test', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Test') , - 'import' => true, + 'title' => ts('Test'), + 'import' => TRUE, 'where' => 'civicrm_activity.is_test', 'headerPattern' => '/(is.)?test(.activity)?/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - ) , - 'activity_medium_id' => array( + ], + ], + 'activity_medium_id' => [ 'name' => 'medium_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Activity Medium') , + 'title' => ts('Activity Medium'), 'description' => 'Activity Medium, Implicit FK to civicrm_option_value where option_group = encounter_medium.', 'default' => 'NULL', 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'encounter_medium', 'optionEditPath' => 'civicrm/admin/options/encounter_medium', - ) - ) , - 'is_auto' => array( + ] + ], + 'is_auto' => [ 'name' => 'is_auto', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Auto') , + 'title' => ts('Auto'), 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - ) , - 'relationship_id' => array( + ], + 'relationship_id' => [ 'name' => 'relationship_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Relationship Id') , + 'title' => ts('Relationship Id'), 'description' => 'FK to Relationship ID', 'default' => 'NULL', 'table_name' => 'civicrm_activity', @@ -519,40 +521,40 @@ static function &fields() { 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Relationship', - ) , - 'is_current_revision' => array( + ], + 'is_current_revision' => [ 'name' => 'is_current_revision', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is this activity a current revision in versioning chain?') , - 'import' => true, + 'title' => ts('Is this activity a current revision in versioning chain?'), + 'import' => TRUE, 'where' => 'civicrm_activity.is_current_revision', 'headerPattern' => '/(is.)?(current.)?(revision|version(ing)?)/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'default' => '1', 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'original_id' => array( + ], + ], + 'original_id' => [ 'name' => 'original_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Original Activity ID ') , + 'title' => ts('Original Activity ID '), 'description' => 'Activity ID of the first activity record in versioning chain.', 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, 'FKClassName' => 'CRM_Activity_DAO_Activity', - ) , - 'activity_result' => array( + ], + 'activity_result' => [ 'name' => 'result', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Result') , + 'title' => ts('Result'), 'description' => 'Currently being used to store result id for survey activity, FK to option value.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -560,107 +562,107 @@ static function &fields() { 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'activity_is_deleted' => array( + ], + ], + 'activity_is_deleted' => [ 'name' => 'is_deleted', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Activity is in the Trash') , - 'import' => true, + 'title' => ts('Activity is in the Trash'), + 'import' => TRUE, 'where' => 'civicrm_activity.is_deleted', 'headerPattern' => '/(activity.)?(trash|deleted)/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'activity_campaign_id' => array( + ], + ], + 'activity_campaign_id' => [ 'name' => 'campaign_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Campaign') , + 'title' => ts('Campaign'), 'description' => 'The campaign for which this activity has been triggered.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_activity.campaign_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, 'FKClassName' => 'CRM_Campaign_DAO_Campaign', - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'activity_engagement_level' => array( + ] + ], + 'activity_engagement_level' => [ 'name' => 'engagement_level', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Engagement Index') , + 'title' => ts('Engagement Index'), 'description' => 'Assign a specific level of engagement to this activity. Used for tracking constituents in ladder of engagement.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_activity.engagement_level', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'engagement_index', 'optionEditPath' => 'civicrm/admin/options/engagement_index', - ) - ) , - 'weight' => array( + ] + ], + 'weight' => [ 'name' => 'weight', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Order') , + 'title' => ts('Order'), 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'is_star' => array( + ], + ], + 'is_star' => [ 'name' => 'is_star', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Starred') , + 'title' => ts('Is Starred'), 'description' => 'Activity marked as favorite.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_activity.is_star', 'headerPattern' => '/(activity.)?(star|favorite)/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_activity', 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - ) , - 'activity_created_date' => array( + ], + 'activity_created_date' => [ 'name' => 'created_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Created Date') , + 'title' => ts('Created Date'), 'description' => 'When was the activity was created.', - 'required' => false, - 'export' => true, + 'required' => FALSE, + 'export' => TRUE, 'where' => 'civicrm_activity.created_date', 'headerPattern' => '', 'dataPattern' => '', @@ -669,14 +671,14 @@ static function &fields() { 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - ) , - 'activity_modified_date' => array( + ], + 'activity_modified_date' => [ 'name' => 'modified_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Modified Date') , + 'title' => ts('Modified Date'), 'description' => 'When was the activity (or closely related entity) was created or modified or deleted.', - 'required' => false, - 'export' => true, + 'required' => FALSE, + 'export' => TRUE, 'where' => 'civicrm_activity.modified_date', 'headerPattern' => '', 'dataPattern' => '', @@ -685,40 +687,44 @@ static function &fields() { 'entity' => 'Activity', 'bao' => 'CRM_Activity_BAO_Activity', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -726,10 +732,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'activity', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'activity', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -737,72 +744,78 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'activity', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'activity', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_source_record_id' => array( + $indices = [ + 'UI_source_record_id' => [ 'name' => 'UI_source_record_id', - 'field' => array( + 'field' => [ 0 => 'source_record_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_activity::0::source_record_id', - ) , - 'UI_activity_type_id' => array( + ], + 'UI_activity_type_id' => [ 'name' => 'UI_activity_type_id', - 'field' => array( + 'field' => [ 0 => 'activity_type_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_activity::0::activity_type_id', - ) , - 'index_activity_date_time' => array( + ], + 'index_activity_date_time' => [ 'name' => 'index_activity_date_time', - 'field' => array( + 'field' => [ 0 => 'activity_date_time', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_activity::0::activity_date_time', - ) , - 'index_status_id' => array( + ], + 'index_status_id' => [ 'name' => 'index_status_id', - 'field' => array( + 'field' => [ 0 => 'status_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_activity::0::status_id', - ) , - 'index_medium_id' => array( + ], + 'index_medium_id' => [ 'name' => 'index_medium_id', - 'field' => array( + 'field' => [ 0 => 'medium_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_activity::0::medium_id', - ) , - 'index_is_current_revision' => array( + ], + 'index_is_current_revision' => [ 'name' => 'index_is_current_revision', - 'field' => array( + 'field' => [ 0 => 'is_current_revision', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_activity::0::is_current_revision', - ) , - 'index_is_deleted' => array( + ], + 'index_is_deleted' => [ 'name' => 'index_is_deleted', - 'field' => array( + 'field' => [ 0 => 'is_deleted', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_activity::0::is_deleted', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Activity/DAO/ActivityContact.php b/CRM/Activity/DAO/ActivityContact.php index bb95eb6fddbc..77618bafb42a 100644 --- a/CRM/Activity/DAO/ActivityContact.php +++ b/CRM/Activity/DAO/ActivityContact.php @@ -1,29 +1,5 @@ __table = 'civicrm_activity_contact'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'activity_id', 'civicrm_activity', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'activity_id', 'civicrm_activity', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Activity Contact ID') , + 'title' => ts('Activity Contact ID'), 'description' => 'Activity contact id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_activity_contact', 'entity' => 'ActivityContact', 'bao' => 'CRM_Activity_BAO_ActivityContact', 'localizable' => 0, - ) , - 'activity_id' => array( + ], + 'activity_id' => [ 'name' => 'activity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Activity ID') , + 'title' => ts('Activity ID'), 'description' => 'Foreign key to the activity for this record.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_activity_contact', 'entity' => 'ActivityContact', 'bao' => 'CRM_Activity_BAO_ActivityContact', 'localizable' => 0, 'FKClassName' => 'CRM_Activity_DAO_Activity', - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID (match to contact)') , + 'title' => ts('Contact ID (match to contact)'), 'description' => 'Foreign key to the contact for this record.', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_activity_contact.contact_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_activity_contact', 'entity' => 'ActivityContact', 'bao' => 'CRM_Activity_BAO_ActivityContact', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'record_type_id' => array( + ], + 'record_type_id' => [ 'name' => 'record_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Record Type ID') , + 'title' => ts('Record Type ID'), 'description' => 'Nature of this contact\'s role in the activity: 1 assignee, 2 creator, 3 focus or target.', 'table_name' => 'civicrm_activity_contact', 'entity' => 'ActivityContact', 'bao' => 'CRM_Activity_BAO_ActivityContact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'activity_contacts', 'optionEditPath' => 'civicrm/admin/options/activity_contacts', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -201,10 +189,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'activity_contact', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'activity_contact', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -212,36 +201,42 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'activity_contact', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'activity_contact', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_activity_contact' => array( + $indices = [ + 'UI_activity_contact' => [ 'name' => 'UI_activity_contact', - 'field' => array( + 'field' => [ 0 => 'contact_id', 1 => 'activity_id', 2 => 'record_type_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_activity_contact::1::contact_id::activity_id::record_type_id', - ) , - 'index_record_type' => array( + ], + 'index_record_type' => [ 'name' => 'index_record_type', - 'field' => array( + 'field' => [ 0 => 'activity_id', 1 => 'record_type_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_activity_contact::0::activity_id::record_type_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Batch/DAO/Batch.php b/CRM/Batch/DAO/Batch.php index 9adce55180f0..fa9a16a01447 100644 --- a/CRM/Batch/DAO/Batch.php +++ b/CRM/Batch/DAO/Batch.php @@ -1,29 +1,5 @@ __table = 'civicrm_batch'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'modified_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'saved_search_id', 'civicrm_saved_search', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'modified_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'saved_search_id', 'civicrm_saved_search', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Batch ID') , + 'title' => ts('Batch ID'), 'description' => 'Unique Address ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_batch', 'entity' => 'Batch', 'bao' => 'CRM_Batch_BAO_Batch', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Batch Name') , + 'title' => ts('Batch Name'), 'description' => 'Variable name/programmatic handle for this batch.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -204,14 +200,14 @@ static function &fields() { 'entity' => 'Batch', 'bao' => 'CRM_Batch_BAO_Batch', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'title' => array( + ], + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Batch Title') , + 'title' => ts('Batch Title'), 'description' => 'Friendly Name.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -219,14 +215,14 @@ static function &fields() { 'entity' => 'Batch', 'bao' => 'CRM_Batch_BAO_Batch', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'description' => array( + ], + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Batch Description') , + 'title' => ts('Batch Description'), 'description' => 'Description of this batch set.', 'rows' => 4, 'cols' => 80, @@ -234,220 +230,224 @@ static function &fields() { 'entity' => 'Batch', 'bao' => 'CRM_Batch_BAO_Batch', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'created_id' => array( + ], + ], + 'created_id' => [ 'name' => 'created_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Batch Created By') , + 'title' => ts('Batch Created By'), 'description' => 'FK to Contact ID', 'table_name' => 'civicrm_batch', 'entity' => 'Batch', 'bao' => 'CRM_Batch_BAO_Batch', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'created_date' => array( + ], + 'created_date' => [ 'name' => 'created_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Batch Created Date') , + 'title' => ts('Batch Created Date'), 'description' => 'When was this item created', 'table_name' => 'civicrm_batch', 'entity' => 'Batch', 'bao' => 'CRM_Batch_BAO_Batch', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'modified_id' => array( + ], + ], + 'modified_id' => [ 'name' => 'modified_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Batch Modified By') , + 'title' => ts('Batch Modified By'), 'description' => 'FK to Contact ID', 'table_name' => 'civicrm_batch', 'entity' => 'Batch', 'bao' => 'CRM_Batch_BAO_Batch', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'modified_date' => array( + ], + 'modified_date' => [ 'name' => 'modified_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Batch Modified Date') , + 'title' => ts('Batch Modified Date'), 'description' => 'When was this item created', 'table_name' => 'civicrm_batch', 'entity' => 'Batch', 'bao' => 'CRM_Batch_BAO_Batch', 'localizable' => 0, - ) , - 'saved_search_id' => array( + ], + 'saved_search_id' => [ 'name' => 'saved_search_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Batch Smart Group') , + 'title' => ts('Batch Smart Group'), 'description' => 'FK to Saved Search ID', 'table_name' => 'civicrm_batch', 'entity' => 'Batch', 'bao' => 'CRM_Batch_BAO_Batch', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_SavedSearch', - 'html' => array( + 'html' => [ 'type' => 'EntityRef', - ) , - ) , - 'status_id' => array( + ], + ], + 'status_id' => [ 'name' => 'status_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Batch Status') , + 'title' => ts('Batch Status'), 'description' => 'fk to Batch Status options in civicrm_option_values', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_batch', 'entity' => 'Batch', 'bao' => 'CRM_Batch_BAO_Batch', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'batch_status', 'optionEditPath' => 'civicrm/admin/options/batch_status', - ) - ) , - 'type_id' => array( + ] + ], + 'type_id' => [ 'name' => 'type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Batch Type') , + 'title' => ts('Batch Type'), 'description' => 'fk to Batch Type options in civicrm_option_values', 'table_name' => 'civicrm_batch', 'entity' => 'Batch', 'bao' => 'CRM_Batch_BAO_Batch', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'batch_type', 'optionEditPath' => 'civicrm/admin/options/batch_type', - ) - ) , - 'mode_id' => array( + ] + ], + 'mode_id' => [ 'name' => 'mode_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Batch Mode') , + 'title' => ts('Batch Mode'), 'description' => 'fk to Batch mode options in civicrm_option_values', 'table_name' => 'civicrm_batch', 'entity' => 'Batch', 'bao' => 'CRM_Batch_BAO_Batch', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'batch_mode', 'optionEditPath' => 'civicrm/admin/options/batch_mode', - ) - ) , - 'total' => array( + ] + ], + 'total' => [ 'name' => 'total', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Batch Total') , + 'title' => ts('Batch Total'), 'description' => 'Total amount for this batch.', - 'precision' => array( + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_batch', 'entity' => 'Batch', 'bao' => 'CRM_Batch_BAO_Batch', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'item_count' => array( + ], + ], + 'item_count' => [ 'name' => 'item_count', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Batch Number of Items') , + 'title' => ts('Batch Number of Items'), 'description' => 'Number of items in a batch.', 'table_name' => 'civicrm_batch', 'entity' => 'Batch', 'bao' => 'CRM_Batch_BAO_Batch', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'payment_instrument_id' => array( + ], + ], + 'payment_instrument_id' => [ 'name' => 'payment_instrument_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Batch Payment Method') , + 'title' => ts('Batch Payment Method'), 'description' => 'fk to Payment Instrument options in civicrm_option_values', 'table_name' => 'civicrm_batch', 'entity' => 'Batch', 'bao' => 'CRM_Batch_BAO_Batch', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'payment_instrument', 'optionEditPath' => 'civicrm/admin/options/payment_instrument', - ) - ) , - 'exported_date' => array( + ] + ], + 'exported_date' => [ 'name' => 'exported_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Batch Exported Date') , + 'title' => ts('Batch Exported Date'), 'table_name' => 'civicrm_batch', 'entity' => 'Batch', 'bao' => 'CRM_Batch_BAO_Batch', 'localizable' => 0, - ) , - 'data' => array( + ], + 'data' => [ 'name' => 'data', 'type' => CRM_Utils_Type::T_LONGTEXT, - 'title' => ts('Batch Data') , + 'title' => ts('Batch Data'), 'description' => 'cache entered data', 'table_name' => 'civicrm_batch', 'entity' => 'Batch', 'bao' => 'CRM_Batch_BAO_Batch', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -455,10 +455,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'batch', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'batch', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -466,25 +467,31 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'batch', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'batch', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_name' => array( + $indices = [ + 'UI_name' => [ 'name' => 'UI_name', - 'field' => array( + 'field' => [ 0 => 'name', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_batch::1::name', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Batch/DAO/EntityBatch.php b/CRM/Batch/DAO/EntityBatch.php index 2ba28e1601e3..4ee6b4382c0a 100644 --- a/CRM/Batch/DAO/EntityBatch.php +++ b/CRM/Batch/DAO/EntityBatch.php @@ -1,29 +1,5 @@ __table = 'civicrm_entity_batch'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'batch_id', 'civicrm_batch', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'batch_id', 'civicrm_batch', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('EntityBatch ID') , + 'title' => ts('EntityBatch ID'), 'description' => 'primary key', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_entity_batch', 'entity' => 'EntityBatch', 'bao' => 'CRM_Batch_BAO_EntityBatch', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('EntityBatch Table') , + 'title' => ts('EntityBatch Table'), 'description' => 'physical tablename for entity being joined to file, e.g. civicrm_contact', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -126,68 +110,72 @@ static function &fields() { 'entity' => 'EntityBatch', 'bao' => 'CRM_Batch_BAO_EntityBatch', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity ID') , + 'title' => ts('Entity ID'), 'description' => 'FK to entity table specified in entity_table column.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_entity_batch', 'entity' => 'EntityBatch', 'bao' => 'CRM_Batch_BAO_EntityBatch', 'localizable' => 0, - ) , - 'batch_id' => array( + ], + 'batch_id' => [ 'name' => 'batch_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Batch ID') , + 'title' => ts('Batch ID'), 'description' => 'FK to civicrm_batch', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_entity_batch', 'entity' => 'EntityBatch', 'bao' => 'CRM_Batch_BAO_EntityBatch', 'localizable' => 0, 'FKClassName' => 'CRM_Batch_DAO_Batch', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_batch', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -195,10 +183,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_batch', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_batch', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -206,36 +195,42 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_batch', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_batch', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_entity' => array( + $indices = [ + 'index_entity' => [ 'name' => 'index_entity', - 'field' => array( + 'field' => [ 0 => 'entity_table', 1 => 'entity_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_entity_batch::0::entity_table::entity_id', - ) , - 'UI_batch_entity' => array( + ], + 'UI_batch_entity' => [ 'name' => 'UI_batch_entity', - 'field' => array( + 'field' => [ 0 => 'batch_id', 1 => 'entity_id', 2 => 'entity_table', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_entity_batch::1::batch_id::entity_id::entity_table', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Campaign/DAO/Campaign.php b/CRM/Campaign/DAO/Campaign.php index 2e80da94a113..99b0bd359ed5 100644 --- a/CRM/Campaign/DAO/Campaign.php +++ b/CRM/Campaign/DAO/Campaign.php @@ -1,29 +1,5 @@ __table = 'civicrm_campaign'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_campaign', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'last_modified_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_campaign', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'last_modified_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Campaign ID') , + 'title' => ts('Campaign ID'), 'description' => 'Unique Campaign ID.', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_campaign.id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_campaign', 'entity' => 'Campaign', 'bao' => 'CRM_Campaign_BAO_Campaign', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Campaign Name') , + 'title' => ts('Campaign Name'), 'description' => 'Name of the Campaign.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_campaign.name', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_campaign', 'entity' => 'Campaign', 'bao' => 'CRM_Campaign_BAO_Campaign', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'title' => array( + ], + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Campaign Title') , + 'title' => ts('Campaign Title'), 'description' => 'Title of the Campaign.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_campaign.title', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_campaign', 'entity' => 'Campaign', 'bao' => 'CRM_Campaign_BAO_Campaign', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'description' => array( + ], + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Campaign Description') , + 'title' => ts('Campaign Description'), 'description' => 'Full description of Campaign.', 'rows' => 8, 'cols' => 60, @@ -251,254 +248,258 @@ static function &fields() { 'entity' => 'Campaign', 'bao' => 'CRM_Campaign_BAO_Campaign', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'start_date' => array( + ], + ], + 'start_date' => [ 'name' => 'start_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Campaign Start Date') , + 'title' => ts('Campaign Start Date'), 'description' => 'Date and time that Campaign starts.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_campaign.start_date', 'headerPattern' => '/^start|(s(tart\s)?date)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_campaign', 'entity' => 'Campaign', 'bao' => 'CRM_Campaign_BAO_Campaign', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'end_date' => array( + ], + ], + 'end_date' => [ 'name' => 'end_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Campaign End Date') , + 'title' => ts('Campaign End Date'), 'description' => 'Date and time that Campaign ends.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_campaign.end_date', 'headerPattern' => '/^end|(e(nd\s)?date)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_campaign', 'entity' => 'Campaign', 'bao' => 'CRM_Campaign_BAO_Campaign', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'campaign_type_id' => array( + ], + ], + 'campaign_type_id' => [ 'name' => 'campaign_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Campaign Type') , + 'title' => ts('Campaign Type'), 'description' => 'Campaign Type ID.Implicit FK to civicrm_option_value where option_group = campaign_type', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_campaign.campaign_type_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'default' => 'NULL', 'table_name' => 'civicrm_campaign', 'entity' => 'Campaign', 'bao' => 'CRM_Campaign_BAO_Campaign', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'campaign_type', 'optionEditPath' => 'civicrm/admin/options/campaign_type', - ) - ) , - 'status_id' => array( + ] + ], + 'status_id' => [ 'name' => 'status_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Campaign Status') , + 'title' => ts('Campaign Status'), 'description' => 'Campaign status ID.Implicit FK to civicrm_option_value where option_group = campaign_status', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_campaign.status_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'default' => 'NULL', 'table_name' => 'civicrm_campaign', 'entity' => 'Campaign', 'bao' => 'CRM_Campaign_BAO_Campaign', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'campaign_status', 'optionEditPath' => 'civicrm/admin/options/campaign_status', - ) - ) , - 'external_identifier' => array( + ] + ], + 'external_identifier' => [ 'name' => 'external_identifier', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Campaign External ID') , + 'title' => ts('Campaign External ID'), 'description' => 'Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.', 'maxlength' => 32, 'size' => CRM_Utils_Type::MEDIUM, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_campaign.external_identifier', 'headerPattern' => '/external\s?id/i', 'dataPattern' => '/^\d{11,}$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_campaign', 'entity' => 'Campaign', 'bao' => 'CRM_Campaign_BAO_Campaign', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'parent_id' => array( + ], + ], + 'parent_id' => [ 'name' => 'parent_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Parent Campaign') , + 'title' => ts('Parent Campaign'), 'description' => 'Optional parent id for this Campaign.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_campaign.parent_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'default' => 'NULL', 'table_name' => 'civicrm_campaign', 'entity' => 'Campaign', 'bao' => 'CRM_Campaign_BAO_Campaign', 'localizable' => 0, 'FKClassName' => 'CRM_Campaign_DAO_Campaign', - 'html' => array( + 'html' => [ 'type' => 'EntityRef', - ) , - ) , - 'is_active' => array( + ], + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Campaign Active?') , + 'title' => ts('Is Campaign Active?'), 'description' => 'Is this Campaign enabled or disabled/cancelled?', 'default' => '1', 'table_name' => 'civicrm_campaign', 'entity' => 'Campaign', 'bao' => 'CRM_Campaign_BAO_Campaign', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'created_id' => array( + ], + ], + 'created_id' => [ 'name' => 'created_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Campaign Created By') , + 'title' => ts('Campaign Created By'), 'description' => 'FK to civicrm_contact, who created this Campaign.', 'table_name' => 'civicrm_campaign', 'entity' => 'Campaign', 'bao' => 'CRM_Campaign_BAO_Campaign', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'created_date' => array( + ], + 'created_date' => [ 'name' => 'created_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Campaign Created Date') , + 'title' => ts('Campaign Created Date'), 'description' => 'Date and time that Campaign was created.', 'table_name' => 'civicrm_campaign', 'entity' => 'Campaign', 'bao' => 'CRM_Campaign_BAO_Campaign', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'last_modified_id' => array( + ], + ], + 'last_modified_id' => [ 'name' => 'last_modified_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Campaign Modified By') , + 'title' => ts('Campaign Modified By'), 'description' => 'FK to civicrm_contact, who recently edited this Campaign.', 'table_name' => 'civicrm_campaign', 'entity' => 'Campaign', 'bao' => 'CRM_Campaign_BAO_Campaign', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'last_modified_date' => array( + ], + 'last_modified_date' => [ 'name' => 'last_modified_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Campaign Modified Date') , + 'title' => ts('Campaign Modified Date'), 'description' => 'Date and time that Campaign was edited last time.', 'table_name' => 'civicrm_campaign', 'entity' => 'Campaign', 'bao' => 'CRM_Campaign_BAO_Campaign', 'localizable' => 0, - ) , - 'goal_general' => array( + ], + 'goal_general' => [ 'name' => 'goal_general', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Campaign Goals') , + 'title' => ts('Campaign Goals'), 'description' => 'General goals for Campaign.', 'table_name' => 'civicrm_campaign', 'entity' => 'Campaign', 'bao' => 'CRM_Campaign_BAO_Campaign', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'RichTextEditor', - ) , - ) , - 'goal_revenue' => array( + ], + ], + 'goal_revenue' => [ 'name' => 'goal_revenue', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Goal Revenue') , + 'title' => ts('Goal Revenue'), 'description' => 'The target revenue for this campaign.', - 'precision' => array( + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_campaign', 'entity' => 'Campaign', 'bao' => 'CRM_Campaign_BAO_Campaign', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - ); + ], + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -506,10 +507,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'campaign', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'campaign', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -517,41 +519,47 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'campaign', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'campaign', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_campaign_type_id' => array( + $indices = [ + 'UI_campaign_type_id' => [ 'name' => 'UI_campaign_type_id', - 'field' => array( + 'field' => [ 0 => 'campaign_type_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_campaign::0::campaign_type_id', - ) , - 'UI_campaign_status_id' => array( + ], + 'UI_campaign_status_id' => [ 'name' => 'UI_campaign_status_id', - 'field' => array( + 'field' => [ 0 => 'status_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_campaign::0::status_id', - ) , - 'UI_external_identifier' => array( + ], + 'UI_external_identifier' => [ 'name' => 'UI_external_identifier', - 'field' => array( + 'field' => [ 0 => 'external_identifier', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_campaign::1::external_identifier', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Campaign/DAO/CampaignGroup.php b/CRM/Campaign/DAO/CampaignGroup.php index 9597c097362a..e6dda96f316a 100644 --- a/CRM/Campaign/DAO/CampaignGroup.php +++ b/CRM/Campaign/DAO/CampaignGroup.php @@ -1,29 +1,5 @@ __table = 'civicrm_campaign_group'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Campaign Group ID') , + 'title' => ts('Campaign Group ID'), 'description' => 'Campaign Group id.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_campaign_group', 'entity' => 'CampaignGroup', 'bao' => 'CRM_Campaign_DAO_CampaignGroup', 'localizable' => 0, - ) , - 'campaign_id' => array( + ], + 'campaign_id' => [ 'name' => 'campaign_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Campaign') , + 'title' => ts('Campaign'), 'description' => 'Foreign key to the activity Campaign.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_campaign_group', 'entity' => 'CampaignGroup', 'bao' => 'CRM_Campaign_DAO_CampaignGroup', 'localizable' => 0, 'FKClassName' => 'CRM_Campaign_DAO_Campaign', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'group_type' => array( + ] + ], + 'group_type' => [ 'name' => 'group_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Campaign Group Type') , + 'title' => ts('Campaign Group Type'), 'description' => 'Type of Group.', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -150,17 +135,17 @@ static function &fields() { 'entity' => 'CampaignGroup', 'bao' => 'CRM_Campaign_DAO_CampaignGroup', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getCampaignGroupTypes', - ) - ) , - 'entity_table' => array( + ] + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Table') , + 'title' => ts('Entity Table'), 'description' => 'Name of table where item being referenced is stored.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -169,51 +154,55 @@ static function &fields() { 'entity' => 'CampaignGroup', 'bao' => 'CRM_Campaign_DAO_CampaignGroup', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity ID') , + 'title' => ts('Entity ID'), 'description' => 'Entity id of referenced table.', 'default' => 'NULL', 'table_name' => 'civicrm_campaign_group', 'entity' => 'CampaignGroup', 'bao' => 'CRM_Campaign_DAO_CampaignGroup', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -221,10 +210,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'campaign_group', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'campaign_group', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -232,15 +222,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'campaign_group', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'campaign_group', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Campaign/DAO/Survey.php b/CRM/Campaign/DAO/Survey.php index f0c128bd227e..30ad453f183e 100644 --- a/CRM/Campaign/DAO/Survey.php +++ b/CRM/Campaign/DAO/Survey.php @@ -1,29 +1,5 @@ __table = 'civicrm_survey'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'last_modified_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'last_modified_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Survey ID') , + 'title' => ts('Survey ID'), 'description' => 'Survey id.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_survey', 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 0, - ) , - 'title' => array( + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Survey Title') , + 'title' => ts('Survey Title'), 'description' => 'Title of the Survey.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_survey.title', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_survey', 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 1, - ) , - 'campaign_id' => array( + ], + 'campaign_id' => [ 'name' => 'campaign_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Survey Campaign ID') , + 'title' => ts('Survey Campaign ID'), 'description' => 'Foreign key to the Campaign.', 'default' => 'NULL', 'table_name' => 'civicrm_survey', @@ -241,39 +241,39 @@ static function &fields() { 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 0, 'FKClassName' => 'CRM_Campaign_DAO_Campaign', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'activity_type_id' => array( + ] + ], + 'activity_type_id' => [ 'name' => 'activity_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Activity Type') , + 'title' => ts('Activity Type'), 'description' => 'Implicit FK to civicrm_option_value where option_group = activity_type', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_survey.activity_type_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'default' => 'NULL', 'table_name' => 'civicrm_survey', 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'activity_type', 'optionEditPath' => 'civicrm/admin/options/activity_type', - ) - ) , - 'recontact_interval' => array( + ] + ], + 'recontact_interval' => [ 'name' => 'recontact_interval', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Follow up Interval') , + 'title' => ts('Follow up Interval'), 'description' => 'Recontact intervals for each status.', 'rows' => 20, 'cols' => 80, @@ -281,14 +281,14 @@ static function &fields() { 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'instructions' => array( + ], + ], + 'instructions' => [ 'name' => 'instructions', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Instructions') , + 'title' => ts('Instructions'), 'description' => 'Script instructions for volunteers to use for the survey.', 'rows' => 20, 'cols' => 80, @@ -296,131 +296,131 @@ static function &fields() { 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'release_frequency' => array( + ], + ], + 'release_frequency' => [ 'name' => 'release_frequency', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Survey Hold Duration') , + 'title' => ts('Survey Hold Duration'), 'description' => 'Number of days for recurrence of release.', 'default' => 'NULL', 'table_name' => 'civicrm_survey', 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 0, - ) , - 'max_number_of_contacts' => array( + ], + 'max_number_of_contacts' => [ 'name' => 'max_number_of_contacts', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Maximum number of contacts') , + 'title' => ts('Maximum number of contacts'), 'description' => 'Maximum number of contacts to allow for survey.', 'default' => 'NULL', 'table_name' => 'civicrm_survey', 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 0, - ) , - 'default_number_of_contacts' => array( + ], + 'default_number_of_contacts' => [ 'name' => 'default_number_of_contacts', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Default number of contacts') , + 'title' => ts('Default number of contacts'), 'description' => 'Default number of contacts to allow for survey.', 'default' => 'NULL', 'table_name' => 'civicrm_survey', 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Survey Is Active') , + 'title' => ts('Survey Is Active'), 'description' => 'Is this survey enabled or disabled/cancelled?', 'default' => '1', 'table_name' => 'civicrm_survey', 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 0, - ) , - 'is_default' => array( + ], + 'is_default' => [ 'name' => 'is_default', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Default Survey') , + 'title' => ts('Is Default Survey'), 'description' => 'Is this default survey?', 'table_name' => 'civicrm_survey', 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 0, - ) , - 'created_id' => array( + ], + 'created_id' => [ 'name' => 'created_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Survey Created By') , + 'title' => ts('Survey Created By'), 'description' => 'FK to civicrm_contact, who created this Survey.', 'table_name' => 'civicrm_survey', 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'created_date' => array( + ], + 'created_date' => [ 'name' => 'created_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Campaign Created Date') , + 'title' => ts('Campaign Created Date'), 'description' => 'Date and time that Survey was created.', 'table_name' => 'civicrm_survey', 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 0, - ) , - 'last_modified_id' => array( + ], + 'last_modified_id' => [ 'name' => 'last_modified_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Survey Modified') , + 'title' => ts('Survey Modified'), 'description' => 'FK to civicrm_contact, who recently edited this Survey.', 'table_name' => 'civicrm_survey', 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'last_modified_date' => array( + ], + 'last_modified_date' => [ 'name' => 'last_modified_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Survey Modified On') , + 'title' => ts('Survey Modified On'), 'description' => 'Date and time that Survey was edited last time.', 'table_name' => 'civicrm_survey', 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 0, - ) , - 'result_id' => array( + ], + 'result_id' => [ 'name' => 'result_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Survey Result') , + 'title' => ts('Survey Result'), 'description' => 'Used to store option group id.', 'default' => 'NULL', 'table_name' => 'civicrm_survey', 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 0, - ) , - 'bypass_confirm' => array( + ], + 'bypass_confirm' => [ 'name' => 'bypass_confirm', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('No Email Verification') , + 'title' => ts('No Email Verification'), 'description' => 'Bypass the email verification.', 'table_name' => 'civicrm_survey', 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 0, - ) , - 'thankyou_title' => array( + ], + 'thankyou_title' => [ 'name' => 'thankyou_title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Thank-you Title') , + 'title' => ts('Thank-you Title'), 'description' => 'Title for Thank-you page (header title tag, and display at the top of the page).', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -428,11 +428,11 @@ static function &fields() { 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 1, - ) , - 'thankyou_text' => array( + ], + 'thankyou_text' => [ 'name' => 'thankyou_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Thank-you Text') , + 'title' => ts('Thank-you Text'), 'description' => 'text and html allowed. displayed above result on success page', 'rows' => 8, 'cols' => 60, @@ -440,54 +440,58 @@ static function &fields() { 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'is_share' => array( + ], + ], + 'is_share' => [ 'name' => 'is_share', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is shared through social media') , + 'title' => ts('Is shared through social media'), 'description' => 'Can people share the petition through social media?', 'default' => '1', 'table_name' => 'civicrm_survey', 'entity' => 'Survey', 'bao' => 'CRM_Campaign_BAO_Survey', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -495,10 +499,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'survey', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'survey', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -506,24 +511,30 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'survey', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'survey', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_activity_type_id' => array( + $indices = [ + 'UI_activity_type_id' => [ 'name' => 'UI_activity_type_id', - 'field' => array( + 'field' => [ 0 => 'activity_type_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_survey::0::activity_type_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Case/DAO/Case.php b/CRM/Case/DAO/Case.php index 66bf0d6aff94..d54b69eaf512 100644 --- a/CRM/Case/DAO/Case.php +++ b/CRM/Case/DAO/Case.php @@ -1,29 +1,5 @@ __table = 'civicrm_case'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'case_type_id', 'civicrm_case_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'case_type_id', 'civicrm_case_type', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'case_id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'case_id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Case ID') , + 'title' => ts('Case ID'), 'description' => 'Unique Case ID', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_case.id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_case', 'entity' => 'Case', 'bao' => 'CRM_Case_BAO_Case', 'localizable' => 0, - ) , - 'case_type_id' => array( + ], + 'case_type_id' => [ 'name' => 'case_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Case Type') , + 'title' => ts('Case Type'), 'description' => 'FK to civicrm_case_type.id', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_case.case_type_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => false, + 'export' => FALSE, 'table_name' => 'civicrm_case', 'entity' => 'Case', 'bao' => 'CRM_Case_BAO_Case', 'localizable' => 0, 'FKClassName' => 'CRM_Case_DAO_CaseType', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_case_type', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'case_subject' => array( + ] + ], + 'case_subject' => [ 'name' => 'subject', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Case Subject') , + 'title' => ts('Case Subject'), 'description' => 'Short name of the case.', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_case.subject', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_case', 'entity' => 'Case', 'bao' => 'CRM_Case_BAO_Case', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'case_start_date' => array( + ], + ], + 'case_start_date' => [ 'name' => 'start_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Case Start Date') , + 'title' => ts('Case Start Date'), 'description' => 'Date on which given case starts.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_case.start_date', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_case', 'entity' => 'Case', 'bao' => 'CRM_Case_BAO_Case', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'case_end_date' => array( + ], + ], + 'case_end_date' => [ 'name' => 'end_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Case End Date') , + 'title' => ts('Case End Date'), 'description' => 'Date on which given case ends.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_case.end_date', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_case', 'entity' => 'Case', 'bao' => 'CRM_Case_BAO_Case', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'details' => array( + ], + ], + 'details' => [ 'name' => 'details', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Details') , + 'title' => ts('Details'), 'description' => 'Details about the meeting (agenda, notes, etc).', 'rows' => 8, 'cols' => 60, @@ -246,54 +235,54 @@ static function &fields() { 'entity' => 'Case', 'bao' => 'CRM_Case_BAO_Case', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'case_status_id' => array( + ], + ], + 'case_status_id' => [ 'name' => 'status_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Case Status') , + 'title' => ts('Case Status'), 'description' => 'Id of case status.', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_case.status_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => false, + 'export' => FALSE, 'table_name' => 'civicrm_case', 'entity' => 'Case', 'bao' => 'CRM_Case_BAO_Case', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'case_status', 'optionEditPath' => 'civicrm/admin/options/case_status', - ) - ) , - 'case_deleted' => array( + ] + ], + 'case_deleted' => [ 'name' => 'is_deleted', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Case is in the Trash') , - 'import' => true, + 'title' => ts('Case is in the Trash'), + 'import' => TRUE, 'where' => 'civicrm_case.is_deleted', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_case', 'entity' => 'Case', 'bao' => 'CRM_Case_BAO_Case', 'localizable' => 0, - ) , - 'case_created_date' => array( + ], + 'case_created_date' => [ 'name' => 'created_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Created Date') , + 'title' => ts('Created Date'), 'description' => 'When was the case was created.', - 'required' => false, - 'export' => true, + 'required' => FALSE, + 'export' => TRUE, 'where' => 'civicrm_case.created_date', 'headerPattern' => '', 'dataPattern' => '', @@ -302,14 +291,14 @@ static function &fields() { 'entity' => 'Case', 'bao' => 'CRM_Case_BAO_Case', 'localizable' => 0, - ) , - 'case_modified_date' => array( + ], + 'case_modified_date' => [ 'name' => 'modified_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Modified Date') , + 'title' => ts('Modified Date'), 'description' => 'When was the case (or closely related entity) was created or modified or deleted.', - 'required' => false, - 'export' => true, + 'required' => FALSE, + 'export' => TRUE, 'where' => 'civicrm_case.modified_date', 'headerPattern' => '', 'dataPattern' => '', @@ -318,40 +307,44 @@ static function &fields() { 'entity' => 'Case', 'bao' => 'CRM_Case_BAO_Case', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -359,10 +352,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -370,32 +364,38 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_case_type_id' => array( + $indices = [ + 'index_case_type_id' => [ 'name' => 'index_case_type_id', - 'field' => array( + 'field' => [ 0 => 'case_type_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_case::0::case_type_id', - ) , - 'index_is_deleted' => array( + ], + 'index_is_deleted' => [ 'name' => 'index_is_deleted', - 'field' => array( + 'field' => [ 0 => 'is_deleted', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_case::0::is_deleted', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Case/DAO/CaseActivity.php b/CRM/Case/DAO/CaseActivity.php index 6645ab4b2548..352e134e0de9 100644 --- a/CRM/Case/DAO/CaseActivity.php +++ b/CRM/Case/DAO/CaseActivity.php @@ -1,29 +1,5 @@ __table = 'civicrm_case_activity'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'case_id', 'civicrm_case', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'activity_id', 'civicrm_activity', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'case_id', 'civicrm_case', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'activity_id', 'civicrm_activity', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Case Activity ID') , + 'title' => ts('Case Activity ID'), 'description' => 'Unique case-activity association id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_case_activity', 'entity' => 'CaseActivity', 'bao' => 'CRM_Case_DAO_CaseActivity', 'localizable' => 0, - ) , - 'case_id' => array( + ], + 'case_id' => [ 'name' => 'case_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Case') , + 'title' => ts('Case'), 'description' => 'Case ID of case-activity association.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_case_activity', 'entity' => 'CaseActivity', 'bao' => 'CRM_Case_DAO_CaseActivity', 'localizable' => 0, 'FKClassName' => 'CRM_Case_DAO_Case', - ) , - 'activity_id' => array( + ], + 'activity_id' => [ 'name' => 'activity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Activity ID') , + 'title' => ts('Activity ID'), 'description' => 'Activity ID of case-activity association.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_case_activity', 'entity' => 'CaseActivity', 'bao' => 'CRM_Case_DAO_CaseActivity', 'localizable' => 0, 'FKClassName' => 'CRM_Activity_DAO_Activity', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -173,10 +160,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case_activity', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case_activity', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -184,25 +172,31 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case_activity', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case_activity', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_case_activity_id' => array( + $indices = [ + 'UI_case_activity_id' => [ 'name' => 'UI_case_activity_id', - 'field' => array( + 'field' => [ 0 => 'case_id', 1 => 'activity_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_case_activity::0::case_id::activity_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Case/DAO/CaseContact.php b/CRM/Case/DAO/CaseContact.php index 8454e5b72c8d..9c297170eb83 100644 --- a/CRM/Case/DAO/CaseContact.php +++ b/CRM/Case/DAO/CaseContact.php @@ -1,29 +1,5 @@ __table = 'civicrm_case_contact'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'case_id', 'civicrm_case', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'case_id', 'civicrm_case', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Case Contact ID') , + 'title' => ts('Case Contact ID'), 'description' => 'Unique case-contact association id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_case_contact', 'entity' => 'CaseContact', 'bao' => 'CRM_Case_BAO_CaseContact', 'localizable' => 0, - ) , - 'case_id' => array( + ], + 'case_id' => [ 'name' => 'case_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Case') , + 'title' => ts('Case'), 'description' => 'Case ID of case-contact association.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_case_contact', 'entity' => 'CaseContact', 'bao' => 'CRM_Case_BAO_CaseContact', 'localizable' => 0, 'FKClassName' => 'CRM_Case_DAO_Case', - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'Contact ID of contact record given case belongs to.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_case_contact', 'entity' => 'CaseContact', 'bao' => 'CRM_Case_BAO_CaseContact', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'EntityRef', - ) , - ) , - ); + ], + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -176,10 +163,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case_contact', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case_contact', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -187,26 +175,32 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case_contact', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case_contact', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_case_contact_id' => array( + $indices = [ + 'UI_case_contact_id' => [ 'name' => 'UI_case_contact_id', - 'field' => array( + 'field' => [ 0 => 'case_id', 1 => 'contact_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_case_contact::1::case_id::contact_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Case/DAO/CaseType.php b/CRM/Case/DAO/CaseType.php index ac84133ab94c..8ee224bf4a3d 100644 --- a/CRM/Case/DAO/CaseType.php +++ b/CRM/Case/DAO/CaseType.php @@ -1,29 +1,5 @@ __table = 'civicrm_case_type'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Case Type ID') , + 'title' => ts('Case Type ID'), 'description' => 'Autoincremented type id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_case_type', 'entity' => 'CaseType', 'bao' => 'CRM_Case_BAO_CaseType', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Case Type Name') , + 'title' => ts('Case Type Name'), 'description' => 'Machine name for Case Type', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_case_type', 'entity' => 'CaseType', 'bao' => 'CRM_Case_BAO_CaseType', 'localizable' => 0, - ) , - 'title' => array( + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Case Type Title') , + 'title' => ts('Case Type Title'), 'description' => 'Natural language name for Case Type', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_case_type', 'entity' => 'CaseType', 'bao' => 'CRM_Case_BAO_CaseType', 'localizable' => 1, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Case Type Description') , + 'title' => ts('Case Type Description'), 'description' => 'Description of the Case Type', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -161,82 +148,86 @@ static function &fields() { 'entity' => 'CaseType', 'bao' => 'CRM_Case_BAO_CaseType', 'localizable' => 1, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Case Type Is Active') , + 'title' => ts('Case Type Is Active'), 'description' => 'Is this entry active?', 'table_name' => 'civicrm_case_type', 'entity' => 'CaseType', 'bao' => 'CRM_Case_BAO_CaseType', 'localizable' => 0, - ) , - 'is_reserved' => array( + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Case Type Is Reserved') , + 'title' => ts('Case Type Is Reserved'), 'description' => 'Is this case type a predefined system type?', 'table_name' => 'civicrm_case_type', 'entity' => 'CaseType', 'bao' => 'CRM_Case_BAO_CaseType', 'localizable' => 0, - ) , - 'weight' => array( + ], + 'weight' => [ 'name' => 'weight', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Order') , + 'title' => ts('Order'), 'description' => 'Ordering of the case types', - 'required' => true, + 'required' => TRUE, 'default' => '1', 'table_name' => 'civicrm_case_type', 'entity' => 'CaseType', 'bao' => 'CRM_Case_BAO_CaseType', 'localizable' => 0, - ) , - 'definition' => array( + ], + 'definition' => [ 'name' => 'definition', 'type' => CRM_Utils_Type::T_BLOB, - 'title' => ts('Case Type Definition') , + 'title' => ts('Case Type Definition'), 'description' => 'xml definition of case type', 'table_name' => 'civicrm_case_type', 'entity' => 'CaseType', 'bao' => 'CRM_Case_BAO_CaseType', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -244,10 +235,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case_type', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case_type', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -255,25 +247,31 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case_type', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case_type', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'case_type_name' => array( + $indices = [ + 'case_type_name' => [ 'name' => 'case_type_name', - 'field' => array( + 'field' => [ 0 => 'name', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_case_type::1::name', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contact/DAO/ACLContactCache.php b/CRM/Contact/DAO/ACLContactCache.php index 0a16ea51c1c9..6a0a1a7f60dc 100644 --- a/CRM/Contact/DAO/ACLContactCache.php +++ b/CRM/Contact/DAO/ACLContactCache.php @@ -1,29 +1,5 @@ __table = 'civicrm_acl_contact_cache'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'user_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'user_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('ACL Contact Cache ID') , + 'title' => ts('ACL Contact Cache ID'), 'description' => 'primary key', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_acl_contact_cache', 'entity' => 'ACLContactCache', 'bao' => 'CRM_Contact_DAO_ACLContactCache', 'localizable' => 0, - ) , - 'user_id' => array( + ], + 'user_id' => [ 'name' => 'user_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'FK to civicrm_contact (could be null for anon user)', 'table_name' => 'civicrm_acl_contact_cache', 'entity' => 'ACLContactCache', 'bao' => 'CRM_Contact_DAO_ACLContactCache', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'FK to civicrm_contact', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_acl_contact_cache', 'entity' => 'ACLContactCache', 'bao' => 'CRM_Contact_DAO_ACLContactCache', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'operation' => array( + ], + 'operation' => [ 'name' => 'operation', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Operation') , + 'title' => ts('Operation'), 'description' => 'What operation does this user have permission on?', - 'required' => true, + 'required' => TRUE, 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, 'table_name' => 'civicrm_acl_contact_cache', 'entity' => 'ACLContactCache', 'bao' => 'CRM_Contact_DAO_ACLContactCache', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_ACL_BAO_ACL::operation', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -197,10 +185,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl_contact_cache', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl_contact_cache', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -208,27 +197,33 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl_contact_cache', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl_contact_cache', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_user_contact_operation' => array( + $indices = [ + 'UI_user_contact_operation' => [ 'name' => 'UI_user_contact_operation', - 'field' => array( + 'field' => [ 0 => 'user_id', 1 => 'contact_id', 2 => 'operation', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_acl_contact_cache::1::user_id::contact_id::operation', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contact/DAO/Contact.php b/CRM/Contact/DAO/Contact.php index 837f0a3cd7e0..abe106af4a89 100644 --- a/CRM/Contact/DAO/Contact.php +++ b/CRM/Contact/DAO/Contact.php @@ -1,29 +1,5 @@ __table = 'civicrm_contact'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'primary_contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'employer_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'primary_contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'employer_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'Unique Contact ID', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_contact.id', 'headerPattern' => '/internal|contact?|id$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - ) , - 'contact_type' => array( + ], + 'contact_type' => [ 'name' => 'contact_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Contact Type') , + 'title' => ts('Contact Type'), 'description' => 'Type of Contact.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_contact.contact_type', 'headerPattern' => '', 'dataPattern' => '', @@ -416,196 +441,196 @@ static function &fields() { 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_contact_type', 'keyColumn' => 'name', 'labelColumn' => 'label', 'condition' => 'parent_id IS NULL', - ) - ) , - 'contact_sub_type' => array( + ] + ], + 'contact_sub_type' => [ 'name' => 'contact_sub_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Contact Subtype') , + 'title' => ts('Contact Subtype'), 'description' => 'May be used to over-ride contact view and edit templates.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.contact_sub_type', 'headerPattern' => '/C(ontact )?(subtype|sub-type|sub type)/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_contact_type', 'keyColumn' => 'name', 'labelColumn' => 'label', 'condition' => 'parent_id IS NOT NULL', - ) - ) , - 'do_not_email' => array( + ] + ], + 'do_not_email' => [ 'name' => 'do_not_email', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Do Not Email') , - 'import' => true, + 'title' => ts('Do Not Email'), + 'import' => TRUE, 'where' => 'civicrm_contact.do_not_email', 'headerPattern' => '/d(o )?(not )?(email)/i', 'dataPattern' => '/^\d{1,}$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'do_not_phone' => array( + ], + ], + 'do_not_phone' => [ 'name' => 'do_not_phone', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Do Not Phone') , - 'import' => true, + 'title' => ts('Do Not Phone'), + 'import' => TRUE, 'where' => 'civicrm_contact.do_not_phone', 'headerPattern' => '/d(o )?(not )?(call|phone)/i', 'dataPattern' => '/^\d{1,}$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'do_not_mail' => array( + ], + ], + 'do_not_mail' => [ 'name' => 'do_not_mail', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Do Not Mail') , - 'import' => true, + 'title' => ts('Do Not Mail'), + 'import' => TRUE, 'where' => 'civicrm_contact.do_not_mail', 'headerPattern' => '/^(d(o\s)?n(ot\s)?mail)|(\w*)?bulk\s?(\w*)$/i', 'dataPattern' => '/^\d{1,}$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'do_not_sms' => array( + ], + ], + 'do_not_sms' => [ 'name' => 'do_not_sms', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Do Not Sms') , - 'import' => true, + 'title' => ts('Do Not Sms'), + 'import' => TRUE, 'where' => 'civicrm_contact.do_not_sms', 'headerPattern' => '/d(o )?(not )?(sms)/i', 'dataPattern' => '/^\d{1,}$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'do_not_trade' => array( + ], + ], + 'do_not_trade' => [ 'name' => 'do_not_trade', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Do Not Trade') , - 'import' => true, + 'title' => ts('Do Not Trade'), + 'import' => TRUE, 'where' => 'civicrm_contact.do_not_trade', 'headerPattern' => '/d(o )?(not )?(trade)/i', 'dataPattern' => '/^\d{1,}$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'is_opt_out' => array( + ], + ], + 'is_opt_out' => [ 'name' => 'is_opt_out', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('No Bulk Emails (User Opt Out)') , + 'title' => ts('No Bulk Emails (User Opt Out)'), 'description' => 'Has the contact opted out from receiving all bulk email from the organization or site domain?', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_contact.is_opt_out', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'legal_identifier' => array( + ], + ], + 'legal_identifier' => [ 'name' => 'legal_identifier', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Legal Identifier') , + 'title' => ts('Legal Identifier'), 'description' => 'May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID. ', 'maxlength' => 32, 'size' => CRM_Utils_Type::MEDIUM, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.legal_identifier', 'headerPattern' => '/legal\s?id/i', 'dataPattern' => '/\w+?\d{5,}/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'external_identifier' => array( + ], + ], + 'external_identifier' => [ 'name' => 'external_identifier', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('External Identifier') , + 'title' => ts('External Identifier'), 'description' => 'Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.', 'maxlength' => 64, 'size' => 8, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.external_identifier', 'headerPattern' => '/external\s?id/i', 'dataPattern' => '/^\d{11,}$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'sort_name' => array( + ], + ], + 'sort_name' => [ 'name' => 'sort_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Sort Name') , + 'title' => ts('Sort Name'), 'description' => 'Name used for sorting different contact types', 'maxlength' => 128, 'size' => 30, - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_contact.sort_name', 'headerPattern' => '', 'dataPattern' => '', @@ -613,18 +638,18 @@ static function &fields() { 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'display_name' => array( + ], + ], + 'display_name' => [ 'name' => 'display_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Display Name') , + 'title' => ts('Display Name'), 'description' => 'Formatted name representing preferred format for display/print/other output.', 'maxlength' => 128, 'size' => 30, - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_contact.display_name', 'headerPattern' => '', 'dataPattern' => '', @@ -632,150 +657,150 @@ static function &fields() { 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'nick_name' => array( + ], + ], + 'nick_name' => [ 'name' => 'nick_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Nickname') , + 'title' => ts('Nickname'), 'description' => 'Nickname.', 'maxlength' => 128, 'size' => 30, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.nick_name', 'headerPattern' => '/n(ick\s)name|nick$/i', 'dataPattern' => '/^\w+$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'legal_name' => array( + ], + ], + 'legal_name' => [ 'name' => 'legal_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Legal Name') , + 'title' => ts('Legal Name'), 'description' => 'Legal Name.', 'maxlength' => 128, 'size' => 30, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.legal_name', 'headerPattern' => '/^legal|(l(egal\s)?name)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'image_URL' => array( + ], + ], + 'image_URL' => [ 'name' => 'image_URL', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Image Url') , + 'title' => ts('Image Url'), 'description' => 'optional URL for preferred image (photo, logo, etc.) to display for this contact.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.image_URL', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'File', - ) , - ) , - 'preferred_communication_method' => array( + ], + ], + 'preferred_communication_method' => [ 'name' => 'preferred_communication_method', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Preferred Communication Method') , + 'title' => ts('Preferred Communication Method'), 'description' => 'What is the preferred mode of communication.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.preferred_communication_method', 'headerPattern' => '/^p(ref\w*\s)?c(omm\w*)|( meth\w*)$/i', 'dataPattern' => '/^\w+$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'preferred_communication_method', 'optionEditPath' => 'civicrm/admin/options/preferred_communication_method', - ) - ) , - 'preferred_language' => array( + ] + ], + 'preferred_language' => [ 'name' => 'preferred_language', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Preferred Language') , + 'title' => ts('Preferred Language'), 'description' => 'Which language is preferred for communication. FK to languages in civicrm_option_value.', 'maxlength' => 5, 'size' => CRM_Utils_Type::SIX, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.preferred_language', 'headerPattern' => '/^lang/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'languages', 'keyColumn' => 'name', 'optionEditPath' => 'civicrm/admin/options/languages', - ) - ) , - 'preferred_mail_format' => array( + ] + ], + 'preferred_mail_format' => [ 'name' => 'preferred_mail_format', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Preferred Mail Format') , + 'title' => ts('Preferred Mail Format'), 'description' => 'What is the preferred mode of sending an email.', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.preferred_mail_format', 'headerPattern' => '/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'default' => 'Both', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::pmf', - ) - ) , - 'hash' => array( + ] + ], + 'hash' => [ 'name' => 'hash', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Contact Hash') , + 'title' => ts('Contact Hash'), 'description' => 'Key for validating requests related to this contact.', 'maxlength' => 32, 'size' => CRM_Utils_Type::MEDIUM, - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_contact.hash', 'headerPattern' => '', 'dataPattern' => '', @@ -783,11 +808,11 @@ static function &fields() { 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - ) , - 'api_key' => array( + ], + 'api_key' => [ 'name' => 'api_key', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Api Key') , + 'title' => ts('Api Key'), 'description' => 'API Key for validating requests related to this contact.', 'maxlength' => 32, 'size' => CRM_Utils_Type::MEDIUM, @@ -795,157 +820,157 @@ static function &fields() { 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - ) , - 'contact_source' => array( + ], + 'contact_source' => [ 'name' => 'source', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Contact Source') , + 'title' => ts('Contact Source'), 'description' => 'where contact come from, e.g. import, donate module insert...', 'maxlength' => 255, 'size' => 30, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.source', 'headerPattern' => '/(C(ontact\s)?Source)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'first_name' => array( + ], + ], + 'first_name' => [ 'name' => 'first_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('First Name') , + 'title' => ts('First Name'), 'description' => 'First Name.', 'maxlength' => 64, 'size' => 30, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.first_name', 'headerPattern' => '/^first|(f(irst\s)?name)$/i', 'dataPattern' => '/^\w+$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'middle_name' => array( + ], + ], + 'middle_name' => [ 'name' => 'middle_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Middle Name') , + 'title' => ts('Middle Name'), 'description' => 'Middle Name.', 'maxlength' => 64, 'size' => 30, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.middle_name', 'headerPattern' => '/^middle|(m(iddle\s)?name)$/i', 'dataPattern' => '/^\w+$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'last_name' => array( + ], + ], + 'last_name' => [ 'name' => 'last_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Last Name') , + 'title' => ts('Last Name'), 'description' => 'Last Name.', 'maxlength' => 64, 'size' => 30, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.last_name', 'headerPattern' => '/^last|(l(ast\s)?name)$/i', 'dataPattern' => '/^\w+(\s\w+)?+$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'prefix_id' => array( + ], + ], + 'prefix_id' => [ 'name' => 'prefix_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Individual Prefix') , + 'title' => ts('Individual Prefix'), 'description' => 'Prefix or Title for name (Ms, Mr...). FK to prefix ID', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.prefix_id', 'headerPattern' => '/^(prefix|title)/i', 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\.?$/i', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'individual_prefix', 'optionEditPath' => 'civicrm/admin/options/individual_prefix', - ) - ) , - 'suffix_id' => array( + ] + ], + 'suffix_id' => [ 'name' => 'suffix_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Individual Suffix') , + 'title' => ts('Individual Suffix'), 'description' => 'Suffix for name (Jr, Sr...). FK to suffix ID', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.suffix_id', 'headerPattern' => '/^suffix$/i', 'dataPattern' => '/^(sr|jr)\.?|i{2,}$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'individual_suffix', 'optionEditPath' => 'civicrm/admin/options/individual_suffix', - ) - ) , - 'formal_title' => array( + ] + ], + 'formal_title' => [ 'name' => 'formal_title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Formal Title') , + 'title' => ts('Formal Title'), 'description' => 'Formal (academic or similar) title in front of name. (Prof., Dr. etc.)', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.formal_title', 'headerPattern' => '/^title/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'communication_style_id' => array( + ], + ], + 'communication_style_id' => [ 'name' => 'communication_style_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Communication Style') , + 'title' => ts('Communication Style'), 'description' => 'Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.', - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_contact.communication_style_id', 'headerPattern' => '', 'dataPattern' => '', @@ -953,52 +978,52 @@ static function &fields() { 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'communication_style', 'optionEditPath' => 'civicrm/admin/options/communication_style', - ) - ) , - 'email_greeting_id' => array( + ] + ], + 'email_greeting_id' => [ 'name' => 'email_greeting_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Email Greeting ID') , + 'title' => ts('Email Greeting ID'), 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Email Greeting.', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'email_greeting', 'optionEditPath' => 'civicrm/admin/options/email_greeting', - ) - ) , - 'email_greeting_custom' => array( + ] + ], + 'email_greeting_custom' => [ 'name' => 'email_greeting_custom', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Email Greeting Custom') , + 'title' => ts('Email Greeting Custom'), 'description' => 'Custom Email Greeting.', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.email_greeting_custom', 'headerPattern' => '', 'dataPattern' => '', - 'export' => false, + 'export' => FALSE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'email_greeting_display' => array( + ], + ], + 'email_greeting_display' => [ 'name' => 'email_greeting_display', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Email Greeting') , + 'title' => ts('Email Greeting'), 'description' => 'Cache Email Greeting.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -1006,51 +1031,51 @@ static function &fields() { 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'postal_greeting_id' => array( + ], + ], + 'postal_greeting_id' => [ 'name' => 'postal_greeting_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Postal Greeting ID') , + 'title' => ts('Postal Greeting ID'), 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'postal_greeting', 'optionEditPath' => 'civicrm/admin/options/postal_greeting', - ) - ) , - 'postal_greeting_custom' => array( + ] + ], + 'postal_greeting_custom' => [ 'name' => 'postal_greeting_custom', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Postal Greeting Custom') , + 'title' => ts('Postal Greeting Custom'), 'description' => 'Custom Postal greeting.', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.postal_greeting_custom', 'headerPattern' => '', 'dataPattern' => '', - 'export' => false, + 'export' => FALSE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'postal_greeting_display' => array( + ], + ], + 'postal_greeting_display' => [ 'name' => 'postal_greeting_display', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Postal Greeting') , + 'title' => ts('Postal Greeting'), 'description' => 'Cache Postal greeting.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -1058,48 +1083,48 @@ static function &fields() { 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'addressee_id' => array( + ], + ], + 'addressee_id' => [ 'name' => 'addressee_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Addressee ID') , + 'title' => ts('Addressee ID'), 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Addressee.', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'addressee', 'optionEditPath' => 'civicrm/admin/options/addressee', - ) - ) , - 'addressee_custom' => array( + ] + ], + 'addressee_custom' => [ 'name' => 'addressee_custom', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Addressee Custom') , + 'title' => ts('Addressee Custom'), 'description' => 'Custom Addressee.', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.addressee_custom', 'headerPattern' => '', 'dataPattern' => '', - 'export' => false, + 'export' => FALSE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'addressee_display' => array( + ], + ], + 'addressee_display' => [ 'name' => 'addressee_display', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Addressee') , + 'title' => ts('Addressee'), 'description' => 'Cache Addressee.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -1107,208 +1132,208 @@ static function &fields() { 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'job_title' => array( + ], + ], + 'job_title' => [ 'name' => 'job_title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Job Title') , + 'title' => ts('Job Title'), 'description' => 'Job Title', 'maxlength' => 255, 'size' => 30, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.job_title', 'headerPattern' => '/^job|(j(ob\s)?title)$/i', 'dataPattern' => '//', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'gender_id' => array( + ], + ], + 'gender_id' => [ 'name' => 'gender_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Gender') , + 'title' => ts('Gender'), 'description' => 'FK to gender ID', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.gender_id', 'headerPattern' => '/^gender$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'gender', 'optionEditPath' => 'civicrm/admin/options/gender', - ) - ) , - 'birth_date' => array( + ] + ], + 'birth_date' => [ 'name' => 'birth_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Birth Date') , + 'title' => ts('Birth Date'), 'description' => 'Date of birth', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.birth_date', 'headerPattern' => '/^birth|(b(irth\s)?date)|D(\W*)O(\W*)B(\W*)$/i', 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'formatType' => 'birth', - ) , - ) , - 'is_deceased' => array( + ], + ], + 'is_deceased' => [ 'name' => 'is_deceased', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Deceased') , - 'import' => true, + 'title' => ts('Deceased'), + 'import' => TRUE, 'where' => 'civicrm_contact.is_deceased', 'headerPattern' => '/i(s\s)?d(eceased)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'deceased_date' => array( + ], + ], + 'deceased_date' => [ 'name' => 'deceased_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Deceased Date') , + 'title' => ts('Deceased Date'), 'description' => 'Date of deceased', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.deceased_date', 'headerPattern' => '/^deceased|(d(eceased\s)?date)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'formatType' => 'birth', - ) , - ) , - 'household_name' => array( + ], + ], + 'household_name' => [ 'name' => 'household_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Household Name') , + 'title' => ts('Household Name'), 'description' => 'Household Name.', 'maxlength' => 128, 'size' => 30, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.household_name', 'headerPattern' => '/^household|(h(ousehold\s)?name)$/i', 'dataPattern' => '/^\w+$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'primary_contact_id' => array( + ], + ], + 'primary_contact_id' => [ 'name' => 'primary_contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Household Primary Contact ID') , + 'title' => ts('Household Primary Contact ID'), 'description' => 'Optional FK to Primary Contact for this household.', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - ) , - 'organization_name' => array( + ], + ], + 'organization_name' => [ 'name' => 'organization_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Organization Name') , + 'title' => ts('Organization Name'), 'description' => 'Organization Name.', 'maxlength' => 128, 'size' => 30, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.organization_name', 'headerPattern' => '/^organization|(o(rganization\s)?name)$/i', 'dataPattern' => '/^\w+$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'sic_code' => array( + ], + ], + 'sic_code' => [ 'name' => 'sic_code', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Sic Code') , + 'title' => ts('Sic Code'), 'description' => 'Standard Industry Classification Code.', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.sic_code', 'headerPattern' => '/^sic|(s(ic\s)?code)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'user_unique_id' => array( + ], + ], + 'user_unique_id' => [ 'name' => 'user_unique_id', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Unique ID (OpenID)') , + 'title' => ts('Unique ID (OpenID)'), 'description' => 'the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contact.user_unique_id', 'headerPattern' => '/^Open\s?ID|u(niq\w*)?\s?ID/i', 'dataPattern' => '/^[\w\/\:\.]+$/', - 'export' => true, + 'export' => TRUE, 'rule' => 'url', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'current_employer_id' => array( + ], + ], + 'current_employer_id' => [ 'name' => 'employer_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Current Employer') , + 'title' => ts('Current Employer'), 'description' => 'OPTIONAL FK to civicrm_contact record.', - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_contact.employer_id', 'headerPattern' => '', 'dataPattern' => '', @@ -1317,16 +1342,16 @@ static function &fields() { 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'EntityRef', - ) , - ) , - 'contact_is_deleted' => array( + ], + ], + 'contact_is_deleted' => [ 'name' => 'is_deleted', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Contact is in Trash') , - 'required' => true, - 'export' => true, + 'title' => ts('Contact is in Trash'), + 'required' => TRUE, + 'export' => TRUE, 'where' => 'civicrm_contact.is_deleted', 'headerPattern' => '', 'dataPattern' => '', @@ -1334,17 +1359,17 @@ static function &fields() { 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'created_date' => array( + ], + ], + 'created_date' => [ 'name' => 'created_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Created Date') , + 'title' => ts('Created Date'), 'description' => 'When was the contact was created.', - 'required' => false, - 'export' => true, + 'required' => FALSE, + 'export' => TRUE, 'where' => 'civicrm_contact.created_date', 'headerPattern' => '', 'dataPattern' => '', @@ -1353,14 +1378,14 @@ static function &fields() { 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - ) , - 'modified_date' => array( + ], + 'modified_date' => [ 'name' => 'modified_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Modified Date') , + 'title' => ts('Modified Date'), 'description' => 'When was the contact (or closely related entity) was created or modified or deleted.', - 'required' => false, - 'export' => true, + 'required' => FALSE, + 'export' => TRUE, 'where' => 'civicrm_contact.modified_date', 'headerPattern' => '', 'dataPattern' => '', @@ -1369,40 +1394,44 @@ static function &fields() { 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -1410,10 +1439,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contact', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contact', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -1421,155 +1451,161 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contact', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contact', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_contact_type' => array( + $indices = [ + 'index_contact_type' => [ 'name' => 'index_contact_type', - 'field' => array( + 'field' => [ 0 => 'contact_type', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contact::0::contact_type', - ) , - 'index_contact_sub_type' => array( + ], + 'index_contact_sub_type' => [ 'name' => 'index_contact_sub_type', - 'field' => array( + 'field' => [ 0 => 'contact_sub_type', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contact::0::contact_sub_type', - ) , - 'UI_external_identifier' => array( + ], + 'UI_external_identifier' => [ 'name' => 'UI_external_identifier', - 'field' => array( + 'field' => [ 0 => 'external_identifier', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_contact::1::external_identifier', - ) , - 'index_sort_name' => array( + ], + 'index_sort_name' => [ 'name' => 'index_sort_name', - 'field' => array( + 'field' => [ 0 => 'sort_name', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contact::0::sort_name', - ) , - 'index_preferred_communication_method' => array( + ], + 'index_preferred_communication_method' => [ 'name' => 'index_preferred_communication_method', - 'field' => array( + 'field' => [ 0 => 'preferred_communication_method', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contact::0::preferred_communication_method', - ) , - 'index_hash' => array( + ], + 'index_hash' => [ 'name' => 'index_hash', - 'field' => array( + 'field' => [ 0 => 'hash', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contact::0::hash', - ) , - 'index_api_key' => array( + ], + 'index_api_key' => [ 'name' => 'index_api_key', - 'field' => array( + 'field' => [ 0 => 'api_key', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contact::0::api_key', - ) , - 'index_first_name' => array( + ], + 'index_first_name' => [ 'name' => 'index_first_name', - 'field' => array( + 'field' => [ 0 => 'first_name', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contact::0::first_name', - ) , - 'index_last_name' => array( + ], + 'index_last_name' => [ 'name' => 'index_last_name', - 'field' => array( + 'field' => [ 0 => 'last_name', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contact::0::last_name', - ) , - 'UI_prefix' => array( + ], + 'UI_prefix' => [ 'name' => 'UI_prefix', - 'field' => array( + 'field' => [ 0 => 'prefix_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contact::0::prefix_id', - ) , - 'UI_suffix' => array( + ], + 'UI_suffix' => [ 'name' => 'UI_suffix', - 'field' => array( + 'field' => [ 0 => 'suffix_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contact::0::suffix_id', - ) , - 'index_communication_style_id' => array( + ], + 'index_communication_style_id' => [ 'name' => 'index_communication_style_id', - 'field' => array( + 'field' => [ 0 => 'communication_style_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contact::0::communication_style_id', - ) , - 'UI_gender' => array( + ], + 'UI_gender' => [ 'name' => 'UI_gender', - 'field' => array( + 'field' => [ 0 => 'gender_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contact::0::gender_id', - ) , - 'index_is_deceased' => array( + ], + 'index_is_deceased' => [ 'name' => 'index_is_deceased', - 'field' => array( + 'field' => [ 0 => 'is_deceased', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contact::0::is_deceased', - ) , - 'index_household_name' => array( + ], + 'index_household_name' => [ 'name' => 'index_household_name', - 'field' => array( + 'field' => [ 0 => 'household_name', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contact::0::household_name', - ) , - 'index_organization_name' => array( + ], + 'index_organization_name' => [ 'name' => 'index_organization_name', - 'field' => array( + 'field' => [ 0 => 'organization_name', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contact::0::organization_name', - ) , - 'index_is_deleted_sort_name' => array( + ], + 'index_is_deleted_sort_name' => [ 'name' => 'index_is_deleted_sort_name', - 'field' => array( + 'field' => [ 0 => 'is_deleted', 1 => 'sort_name', 2 => 'id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contact::0::is_deleted::sort_name::id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contact/DAO/ContactType.php b/CRM/Contact/DAO/ContactType.php index efc21bcb8e6e..85eccc56c752 100644 --- a/CRM/Contact/DAO/ContactType.php +++ b/CRM/Contact/DAO/ContactType.php @@ -1,29 +1,5 @@ __table = 'civicrm_contact_type'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_contact_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_contact_type', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact Type ID') , + 'title' => ts('Contact Type ID'), 'description' => 'Contact Type ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_contact_type', 'entity' => 'ContactType', 'bao' => 'CRM_Contact_BAO_ContactType', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Name') , + 'title' => ts('Name'), 'description' => 'Internal name of Contact Type (or Subtype).', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -149,11 +137,11 @@ static function &fields() { 'entity' => 'ContactType', 'bao' => 'CRM_Contact_BAO_ContactType', 'localizable' => 0, - ) , - 'label' => array( + ], + 'label' => [ 'name' => 'label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Contact Type Label') , + 'title' => ts('Contact Type Label'), 'description' => 'localized Name of Contact Type.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -161,11 +149,11 @@ static function &fields() { 'entity' => 'ContactType', 'bao' => 'CRM_Contact_BAO_ContactType', 'localizable' => 1, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Contact Type Description') , + 'title' => ts('Contact Type Description'), 'description' => 'localized Optional verbose description of the type.', 'rows' => 2, 'cols' => 60, @@ -173,14 +161,14 @@ static function &fields() { 'entity' => 'ContactType', 'bao' => 'CRM_Contact_BAO_ContactType', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'image_URL' => array( + ], + ], + 'image_URL' => [ 'name' => 'image_URL', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Contact Type Image URL') , + 'title' => ts('Contact Type Image URL'), 'description' => 'URL of image if any.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -188,77 +176,81 @@ static function &fields() { 'entity' => 'ContactType', 'bao' => 'CRM_Contact_BAO_ContactType', 'localizable' => 0, - ) , - 'parent_id' => array( + ], + 'parent_id' => [ 'name' => 'parent_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact Type Parent') , + 'title' => ts('Contact Type Parent'), 'description' => 'Optional FK to parent contact type.', 'table_name' => 'civicrm_contact_type', 'entity' => 'ContactType', 'bao' => 'CRM_Contact_BAO_ContactType', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_ContactType', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_contact_type', 'keyColumn' => 'id', 'labelColumn' => 'label', 'condition' => 'parent_id IS NULL', - ) - ) , - 'is_active' => array( + ] + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Contact Type Is Active?') , + 'title' => ts('Contact Type Is Active?'), 'description' => 'Is this entry active?', 'table_name' => 'civicrm_contact_type', 'entity' => 'ContactType', 'bao' => 'CRM_Contact_BAO_ContactType', 'localizable' => 0, - ) , - 'is_reserved' => array( + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Contact Type is Reserved?') , + 'title' => ts('Contact Type is Reserved?'), 'description' => 'Is this contact type a predefined system type', 'table_name' => 'civicrm_contact_type', 'entity' => 'ContactType', 'bao' => 'CRM_Contact_BAO_ContactType', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -266,10 +258,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contact_type', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contact_type', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -277,25 +270,31 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contact_type', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contact_type', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'contact_type' => array( + $indices = [ + 'contact_type' => [ 'name' => 'contact_type', - 'field' => array( + 'field' => [ 0 => 'name', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_contact_type::1::name', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contact/DAO/DashboardContact.php b/CRM/Contact/DAO/DashboardContact.php index 951be6206121..e03a23879f8b 100644 --- a/CRM/Contact/DAO/DashboardContact.php +++ b/CRM/Contact/DAO/DashboardContact.php @@ -1,29 +1,5 @@ __table = 'civicrm_dashboard_contact'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'dashboard_id', 'civicrm_dashboard', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'dashboard_id', 'civicrm_dashboard', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Dashboard Contact ID') , - 'required' => true, + 'title' => ts('Dashboard Contact ID'), + 'required' => TRUE, 'table_name' => 'civicrm_dashboard_contact', 'entity' => 'DashboardContact', 'bao' => 'CRM_Contact_BAO_DashboardContact', 'localizable' => 0, - ) , - 'dashboard_id' => array( + ], + 'dashboard_id' => [ 'name' => 'dashboard_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Dashboard') , + 'title' => ts('Dashboard'), 'description' => 'Dashboard ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_dashboard_contact', 'entity' => 'DashboardContact', 'bao' => 'CRM_Contact_BAO_DashboardContact', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Dashboard', - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Dashboard Contact') , + 'title' => ts('Dashboard Contact'), 'description' => 'Contact ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_dashboard_contact', 'entity' => 'DashboardContact', 'bao' => 'CRM_Contact_BAO_DashboardContact', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'column_no' => array( + ], + 'column_no' => [ 'name' => 'column_no', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Column No') , + 'title' => ts('Column No'), 'description' => 'column no for this widget', 'table_name' => 'civicrm_dashboard_contact', 'entity' => 'DashboardContact', 'bao' => 'CRM_Contact_BAO_DashboardContact', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Dashlet is Active?') , + 'title' => ts('Dashlet is Active?'), 'description' => 'Is this widget active?', 'table_name' => 'civicrm_dashboard_contact', 'entity' => 'DashboardContact', 'bao' => 'CRM_Contact_BAO_DashboardContact', 'localizable' => 0, - ) , - 'weight' => array( + ], + 'weight' => [ 'name' => 'weight', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Order') , + 'title' => ts('Order'), 'description' => 'Ordering of the widgets.', 'table_name' => 'civicrm_dashboard_contact', 'entity' => 'DashboardContact', 'bao' => 'CRM_Contact_BAO_DashboardContact', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -219,10 +208,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dashboard_contact', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dashboard_contact', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -230,26 +220,32 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dashboard_contact', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dashboard_contact', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_dashboard_id_contact_id' => array( + $indices = [ + 'index_dashboard_id_contact_id' => [ 'name' => 'index_dashboard_id_contact_id', - 'field' => array( + 'field' => [ 0 => 'dashboard_id', 1 => 'contact_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_dashboard_contact::1::dashboard_id::contact_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contact/DAO/Group.php b/CRM/Contact/DAO/Group.php index f77b220fc6d6..49fa0363d0d4 100644 --- a/CRM/Contact/DAO/Group.php +++ b/CRM/Contact/DAO/Group.php @@ -1,29 +1,5 @@ __table = 'civicrm_group'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'saved_search_id', 'civicrm_saved_search', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'modified_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'saved_search_id', 'civicrm_saved_search', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'modified_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Group ID') , + 'title' => ts('Group ID'), 'description' => 'Group ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Group Name') , + 'title' => ts('Group Name'), 'description' => 'Internal name of Group.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -222,11 +221,11 @@ static function &fields() { 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, - ) , - 'title' => array( + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Group Title') , + 'title' => ts('Group Title'), 'description' => 'Name of Group.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -234,11 +233,11 @@ static function &fields() { 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 1, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Group Description') , + 'title' => ts('Group Description'), 'description' => 'Optional verbose description of the group.', 'rows' => 2, 'cols' => 60, @@ -246,14 +245,14 @@ static function &fields() { 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'source' => array( + ], + ], + 'source' => [ 'name' => 'source', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Group Source') , + 'title' => ts('Group Source'), 'description' => 'Module or process which created this group.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -261,32 +260,32 @@ static function &fields() { 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, - ) , - 'saved_search_id' => array( + ], + 'saved_search_id' => [ 'name' => 'saved_search_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Saved Search ID') , + 'title' => ts('Saved Search ID'), 'description' => 'FK to saved search table.', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_SavedSearch', - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Group Enabled') , + 'title' => ts('Group Enabled'), 'description' => 'Is this entry active?', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, - ) , - 'visibility' => array( + ], + 'visibility' => [ 'name' => 'visibility', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Group Visibility Setting') , + 'title' => ts('Group Visibility Setting'), 'description' => 'In what context(s) is this field visible.', 'maxlength' => 24, 'size' => CRM_Utils_Type::MEDIUM, @@ -295,49 +294,49 @@ static function &fields() { 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::groupVisibility', - ) - ) , - 'where_clause' => array( + ] + ], + 'where_clause' => [ 'name' => 'where_clause', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Group Where Clause') , + 'title' => ts('Group Where Clause'), 'description' => 'the sql where clause if a saved search acl', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, - ) , - 'select_tables' => array( + ], + 'select_tables' => [ 'name' => 'select_tables', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Tables For Select Clause') , + 'title' => ts('Tables For Select Clause'), 'description' => 'the tables to be included in a select data', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, 'serialize' => self::SERIALIZE_PHP, - ) , - 'where_tables' => array( + ], + 'where_tables' => [ 'name' => 'where_tables', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Tables For Where Clause') , + 'title' => ts('Tables For Where Clause'), 'description' => 'the tables to be included in the count statement', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, 'serialize' => self::SERIALIZE_PHP, - ) , - 'group_type' => array( + ], + 'group_type' => [ 'name' => 'group_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Group Type') , + 'title' => ts('Group Type'), 'description' => 'FK to group type', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -346,127 +345,131 @@ static function &fields() { 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'group_type', 'optionEditPath' => 'civicrm/admin/options/group_type', - ) - ) , - 'cache_date' => array( + ] + ], + 'cache_date' => [ 'name' => 'cache_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Group Cache Date') , + 'title' => ts('Group Cache Date'), 'description' => 'Date when we created the cache for a smart group', - 'required' => false, + 'required' => FALSE, 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, - ) , - 'refresh_date' => array( + ], + 'refresh_date' => [ 'name' => 'refresh_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Next Group Refresh Time') , + 'title' => ts('Next Group Refresh Time'), 'description' => 'Date and time when we need to refresh the cache next.', - 'required' => false, + 'required' => FALSE, 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, - ) , - 'parents' => array( + ], + 'parents' => [ 'name' => 'parents', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Group Parents') , + 'title' => ts('Group Parents'), 'description' => 'IDs of the parent(s)', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, - ) , - 'children' => array( + ], + 'children' => [ 'name' => 'children', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Group Children') , + 'title' => ts('Group Children'), 'description' => 'IDs of the child(ren)', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, - ) , - 'is_hidden' => array( + ], + 'is_hidden' => [ 'name' => 'is_hidden', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Group is Hidden') , + 'title' => ts('Group is Hidden'), 'description' => 'Is this group hidden?', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, - ) , - 'is_reserved' => array( + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Group is Reserved') , + 'title' => ts('Group is Reserved'), 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, - ) , - 'created_id' => array( + ], + 'created_id' => [ 'name' => 'created_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Group Created By') , + 'title' => ts('Group Created By'), 'description' => 'FK to contact table.', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'modified_id' => array( + ], + 'modified_id' => [ 'name' => 'modified_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Group Modified By') , + 'title' => ts('Group Modified By'), 'description' => 'FK to contact table.', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -474,10 +477,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -485,42 +489,48 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_group_type' => array( + $indices = [ + 'index_group_type' => [ 'name' => 'index_group_type', - 'field' => array( + 'field' => [ 0 => 'group_type', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_group::0::group_type', - ) , - 'UI_title' => array( + ], + 'UI_title' => [ 'name' => 'UI_title', - 'field' => array( + 'field' => [ 0 => 'title', - ) , - 'localizable' => true, - 'unique' => true, + ], + 'localizable' => TRUE, + 'unique' => TRUE, 'sig' => 'civicrm_group::1::title', - ) , - 'UI_name' => array( + ], + 'UI_name' => [ 'name' => 'UI_name', - 'field' => array( + 'field' => [ 0 => 'name', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_group::1::name', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contact/DAO/GroupContact.php b/CRM/Contact/DAO/GroupContact.php index 380588a7d343..a53545599bbd 100644 --- a/CRM/Contact/DAO/GroupContact.php +++ b/CRM/Contact/DAO/GroupContact.php @@ -1,29 +1,5 @@ __table = 'civicrm_group_contact'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'group_id', 'civicrm_group', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'location_id', 'civicrm_loc_block', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'email_id', 'civicrm_email', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'group_id', 'civicrm_group', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'location_id', 'civicrm_loc_block', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_id', 'civicrm_email', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Group Contact ID') , + 'title' => ts('Group Contact ID'), 'description' => 'primary key', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_group_contact', 'entity' => 'GroupContact', 'bao' => 'CRM_Contact_BAO_GroupContact', 'localizable' => 0, - ) , - 'group_id' => array( + ], + 'group_id' => [ 'name' => 'group_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Group ID') , + 'title' => ts('Group ID'), 'description' => 'FK to civicrm_group', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_group_contact', 'entity' => 'GroupContact', 'bao' => 'CRM_Contact_BAO_GroupContact', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Group', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'contact_id' => array( + ] + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'FK to civicrm_contact', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_group_contact', 'entity' => 'GroupContact', 'bao' => 'CRM_Contact_BAO_GroupContact', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'status' => array( + ], + 'status' => [ 'name' => 'status', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Group Contact Status') , + 'title' => ts('Group Contact Status'), 'description' => 'status of contact relative to membership in group', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -172,68 +158,72 @@ static function &fields() { 'entity' => 'GroupContact', 'bao' => 'CRM_Contact_BAO_GroupContact', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::groupContactStatus', - ) - ) , - 'location_id' => array( + ] + ], + 'location_id' => [ 'name' => 'location_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Group Contact Location') , + 'title' => ts('Group Contact Location'), 'description' => 'Optional location to associate with this membership', 'table_name' => 'civicrm_group_contact', 'entity' => 'GroupContact', 'bao' => 'CRM_Contact_BAO_GroupContact', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_LocBlock', - ) , - 'email_id' => array( + ], + 'email_id' => [ 'name' => 'email_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Group Contact Email') , + 'title' => ts('Group Contact Email'), 'description' => 'Optional email to associate with this membership', 'table_name' => 'civicrm_group_contact', 'entity' => 'GroupContact', 'bao' => 'CRM_Contact_BAO_GroupContact', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Email', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -241,10 +231,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group_contact', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group_contact', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -252,26 +243,32 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group_contact', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group_contact', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_contact_group' => array( + $indices = [ + 'UI_contact_group' => [ 'name' => 'UI_contact_group', - 'field' => array( + 'field' => [ 0 => 'contact_id', 1 => 'group_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_group_contact::1::contact_id::group_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contact/DAO/GroupContactCache.php b/CRM/Contact/DAO/GroupContactCache.php index d85be450bd62..70970ac225dc 100644 --- a/CRM/Contact/DAO/GroupContactCache.php +++ b/CRM/Contact/DAO/GroupContactCache.php @@ -1,29 +1,5 @@ __table = 'civicrm_group_contact_cache'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'group_id', 'civicrm_group', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'group_id', 'civicrm_group', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Group Contact Cache ID') , + 'title' => ts('Group Contact Cache ID'), 'description' => 'primary key', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_group_contact_cache', 'entity' => 'GroupContactCache', 'bao' => 'CRM_Contact_BAO_GroupContactCache', 'localizable' => 0, - ) , - 'group_id' => array( + ], + 'group_id' => [ 'name' => 'group_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Group') , + 'title' => ts('Group'), 'description' => 'FK to civicrm_group', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_group_contact_cache', 'entity' => 'GroupContactCache', 'bao' => 'CRM_Contact_BAO_GroupContactCache', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Group', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'contact_id' => array( + ] + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'FK to civicrm_contact', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_group_contact_cache', 'entity' => 'GroupContactCache', 'bao' => 'CRM_Contact_BAO_GroupContactCache', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -181,10 +168,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group_contact_cache', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group_contact_cache', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -192,26 +180,32 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group_contact_cache', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group_contact_cache', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_contact_group' => array( + $indices = [ + 'UI_contact_group' => [ 'name' => 'UI_contact_group', - 'field' => array( + 'field' => [ 0 => 'contact_id', 1 => 'group_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_group_contact_cache::1::contact_id::group_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contact/DAO/GroupNesting.php b/CRM/Contact/DAO/GroupNesting.php index 255e80ac9963..40d736164f44 100644 --- a/CRM/Contact/DAO/GroupNesting.php +++ b/CRM/Contact/DAO/GroupNesting.php @@ -1,29 +1,5 @@ __table = 'civicrm_group_nesting'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'child_group_id', 'civicrm_group', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_group_id', 'civicrm_group', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'child_group_id', 'civicrm_group', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_group_id', 'civicrm_group', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Group Nesting ID') , + 'title' => ts('Group Nesting ID'), 'description' => 'Relationship ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_group_nesting', 'entity' => 'GroupNesting', 'bao' => 'CRM_Contact_BAO_GroupNesting', 'localizable' => 0, - ) , - 'child_group_id' => array( + ], + 'child_group_id' => [ 'name' => 'child_group_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Child Group') , + 'title' => ts('Child Group'), 'description' => 'ID of the child group', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_group_nesting', 'entity' => 'GroupNesting', 'bao' => 'CRM_Contact_BAO_GroupNesting', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Group', - ) , - 'parent_group_id' => array( + ], + 'parent_group_id' => [ 'name' => 'parent_group_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Parent Group') , + 'title' => ts('Parent Group'), 'description' => 'ID of the parent group', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_group_nesting', 'entity' => 'GroupNesting', 'bao' => 'CRM_Contact_BAO_GroupNesting', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Group', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -173,10 +160,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group_nesting', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group_nesting', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -184,15 +172,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group_nesting', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group_nesting', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contact/DAO/GroupOrganization.php b/CRM/Contact/DAO/GroupOrganization.php index 718a2bfda29c..49bb7b424086 100644 --- a/CRM/Contact/DAO/GroupOrganization.php +++ b/CRM/Contact/DAO/GroupOrganization.php @@ -1,29 +1,5 @@ __table = 'civicrm_group_organization'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'group_id', 'civicrm_group', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'organization_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'group_id', 'civicrm_group', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'organization_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Group Organization ID') , + 'title' => ts('Group Organization ID'), 'description' => 'Relationship ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_group_organization', 'entity' => 'GroupOrganization', 'bao' => 'CRM_Contact_BAO_GroupOrganization', 'localizable' => 0, - ) , - 'group_id' => array( + ], + 'group_id' => [ 'name' => 'group_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Group') , + 'title' => ts('Group'), 'description' => 'ID of the group', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_group_organization', 'entity' => 'GroupOrganization', 'bao' => 'CRM_Contact_BAO_GroupOrganization', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Group', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'organization_id' => array( + ] + ], + 'organization_id' => [ 'name' => 'organization_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Organization') , + 'title' => ts('Organization'), 'description' => 'ID of the Organization Contact', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_group_organization', 'entity' => 'GroupOrganization', 'bao' => 'CRM_Contact_BAO_GroupOrganization', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -181,10 +168,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group_organization', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group_organization', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -192,26 +180,32 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group_organization', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group_organization', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_group_organization' => array( + $indices = [ + 'UI_group_organization' => [ 'name' => 'UI_group_organization', - 'field' => array( + 'field' => [ 0 => 'group_id', 1 => 'organization_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_group_organization::1::group_id::organization_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contact/DAO/Relationship.php b/CRM/Contact/DAO/Relationship.php index 5953567a02b1..20f4bef28dc2 100644 --- a/CRM/Contact/DAO/Relationship.php +++ b/CRM/Contact/DAO/Relationship.php @@ -1,29 +1,5 @@ __table = 'civicrm_relationship'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id_a', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id_b', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'relationship_type_id', 'civicrm_relationship_type', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'case_id', 'civicrm_case', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id_a', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id_b', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'relationship_type_id', 'civicrm_relationship_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'case_id', 'civicrm_case', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Relationship ID') , + 'title' => ts('Relationship ID'), 'description' => 'Relationship ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_relationship', 'entity' => 'Relationship', 'bao' => 'CRM_Contact_BAO_Relationship', 'localizable' => 0, - ) , - 'contact_id_a' => array( + ], + 'contact_id_a' => [ 'name' => 'contact_id_a', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact A') , + 'title' => ts('Contact A'), 'description' => 'id of the first contact', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_relationship', 'entity' => 'Relationship', 'bao' => 'CRM_Contact_BAO_Relationship', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'contact_id_b' => array( + ], + 'contact_id_b' => [ 'name' => 'contact_id_b', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact B') , + 'title' => ts('Contact B'), 'description' => 'id of the second contact', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_relationship', 'entity' => 'Relationship', 'bao' => 'CRM_Contact_BAO_Relationship', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'EntityRef', - ) , - ) , - 'relationship_type_id' => array( + ], + ], + 'relationship_type_id' => [ 'name' => 'relationship_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Relationship Type') , + 'title' => ts('Relationship Type'), 'description' => 'id of the relationship', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_relationship', 'entity' => 'Relationship', 'bao' => 'CRM_Contact_BAO_Relationship', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_RelationshipType', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - ) , - 'start_date' => array( + ], + ], + 'start_date' => [ 'name' => 'start_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Relationship Start Date') , + 'title' => ts('Relationship Start Date'), 'description' => 'date when the relationship started', 'table_name' => 'civicrm_relationship', 'entity' => 'Relationship', 'bao' => 'CRM_Contact_BAO_Relationship', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'end_date' => array( + ], + ], + 'end_date' => [ 'name' => 'end_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Relationship End Date') , + 'title' => ts('Relationship End Date'), 'description' => 'date when the relationship ended', 'table_name' => 'civicrm_relationship', 'entity' => 'Relationship', 'bao' => 'CRM_Contact_BAO_Relationship', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'is_active' => array( + ], + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Relationship Is Active') , + 'title' => ts('Relationship Is Active'), 'description' => 'is the relationship active ?', 'default' => '1', 'table_name' => 'civicrm_relationship', 'entity' => 'Relationship', 'bao' => 'CRM_Contact_BAO_Relationship', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'description' => array( + ], + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Relationship Description') , + 'title' => ts('Relationship Description'), 'description' => 'Optional verbose description for the relationship.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -254,14 +245,14 @@ static function &fields() { 'entity' => 'Relationship', 'bao' => 'CRM_Contact_BAO_Relationship', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'is_permission_a_b' => array( + ], + ], + 'is_permission_a_b' => [ 'name' => 'is_permission_a_b', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Contact A has Permission Over Contact B') , + 'title' => ts('Contact A has Permission Over Contact B'), 'description' => 'is contact a has permission to view / edit contact and related data for contact b ? ', @@ -269,14 +260,14 @@ static function &fields() { 'entity' => 'Relationship', 'bao' => 'CRM_Contact_BAO_Relationship', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'is_permission_b_a' => array( + ], + ], + 'is_permission_b_a' => [ 'name' => 'is_permission_b_a', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Contact B has Permission Over Contact A') , + 'title' => ts('Contact B has Permission Over Contact A'), 'description' => 'is contact b has permission to view / edit contact and related data for contact a ? ', @@ -284,14 +275,14 @@ static function &fields() { 'entity' => 'Relationship', 'bao' => 'CRM_Contact_BAO_Relationship', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'case_id' => array( + ], + ], + 'case_id' => [ 'name' => 'case_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Relationship Case') , + 'title' => ts('Relationship Case'), 'description' => 'FK to civicrm_case', 'default' => 'NULL', 'table_name' => 'civicrm_relationship', @@ -299,40 +290,44 @@ static function &fields() { 'bao' => 'CRM_Contact_BAO_Relationship', 'localizable' => 0, 'FKClassName' => 'CRM_Case_DAO_Case', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -340,10 +335,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'relationship', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'relationship', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -351,15 +347,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'relationship', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'relationship', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contact/DAO/RelationshipType.php b/CRM/Contact/DAO/RelationshipType.php index 16e0125fe122..df6adbf37951 100644 --- a/CRM/Contact/DAO/RelationshipType.php +++ b/CRM/Contact/DAO/RelationshipType.php @@ -1,29 +1,5 @@ __table = 'civicrm_relationship_type'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Relationship Type ID') , + 'title' => ts('Relationship Type ID'), 'description' => 'Primary key', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_relationship_type', 'entity' => 'RelationshipType', 'bao' => 'CRM_Contact_BAO_RelationshipType', 'localizable' => 0, - ) , - 'name_a_b' => array( + ], + 'name_a_b' => [ 'name' => 'name_a_b', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Relationship Type Name A to B') , + 'title' => ts('Relationship Type Name A to B'), 'description' => 'name for relationship of contact_a to contact_b.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -159,11 +150,11 @@ static function &fields() { 'entity' => 'RelationshipType', 'bao' => 'CRM_Contact_BAO_RelationshipType', 'localizable' => 0, - ) , - 'label_a_b' => array( + ], + 'label_a_b' => [ 'name' => 'label_a_b', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Relationship Type Label A to B') , + 'title' => ts('Relationship Type Label A to B'), 'description' => 'label for relationship of contact_a to contact_b.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -171,11 +162,11 @@ static function &fields() { 'entity' => 'RelationshipType', 'bao' => 'CRM_Contact_BAO_RelationshipType', 'localizable' => 1, - ) , - 'name_b_a' => array( + ], + 'name_b_a' => [ 'name' => 'name_b_a', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Relationship Type Name B to A') , + 'title' => ts('Relationship Type Name B to A'), 'description' => 'Optional name for relationship of contact_b to contact_a.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -183,11 +174,11 @@ static function &fields() { 'entity' => 'RelationshipType', 'bao' => 'CRM_Contact_BAO_RelationshipType', 'localizable' => 0, - ) , - 'label_b_a' => array( + ], + 'label_b_a' => [ 'name' => 'label_b_a', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Relationship Type Label B to A') , + 'title' => ts('Relationship Type Label B to A'), 'description' => 'Optional label for relationship of contact_b to contact_a.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -195,11 +186,11 @@ static function &fields() { 'entity' => 'RelationshipType', 'bao' => 'CRM_Contact_BAO_RelationshipType', 'localizable' => 1, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Relationship Description') , + 'title' => ts('Relationship Description'), 'description' => 'Optional verbose description of the relationship type.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -207,11 +198,11 @@ static function &fields() { 'entity' => 'RelationshipType', 'bao' => 'CRM_Contact_BAO_RelationshipType', 'localizable' => 1, - ) , - 'contact_type_a' => array( + ], + 'contact_type_a' => [ 'name' => 'contact_type_a', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Contact Type for Contact A') , + 'title' => ts('Contact Type for Contact A'), 'description' => 'If defined, contact_a in a relationship of this type must be a specific contact_type.', 'maxlength' => 12, 'size' => CRM_Utils_Type::TWELVE, @@ -219,20 +210,20 @@ static function &fields() { 'entity' => 'RelationshipType', 'bao' => 'CRM_Contact_BAO_RelationshipType', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_contact_type', 'keyColumn' => 'name', 'labelColumn' => 'label', 'condition' => 'parent_id IS NULL', - ) - ) , - 'contact_type_b' => array( + ] + ], + 'contact_type_b' => [ 'name' => 'contact_type_b', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Contact Type for Contact B') , + 'title' => ts('Contact Type for Contact B'), 'description' => 'If defined, contact_b in a relationship of this type must be a specific contact_type.', 'maxlength' => 12, 'size' => CRM_Utils_Type::TWELVE, @@ -240,20 +231,20 @@ static function &fields() { 'entity' => 'RelationshipType', 'bao' => 'CRM_Contact_BAO_RelationshipType', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_contact_type', 'keyColumn' => 'name', 'labelColumn' => 'label', 'condition' => 'parent_id IS NULL', - ) - ) , - 'contact_sub_type_a' => array( + ] + ], + 'contact_sub_type_a' => [ 'name' => 'contact_sub_type_a', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Contact Subtype A') , + 'title' => ts('Contact Subtype A'), 'description' => 'If defined, contact_sub_type_a in a relationship of this type must be a specific contact_sub_type. ', 'maxlength' => 64, @@ -262,20 +253,20 @@ static function &fields() { 'entity' => 'RelationshipType', 'bao' => 'CRM_Contact_BAO_RelationshipType', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_contact_type', 'keyColumn' => 'name', 'labelColumn' => 'label', 'condition' => 'parent_id IS NOT NULL', - ) - ) , - 'contact_sub_type_b' => array( + ] + ], + 'contact_sub_type_b' => [ 'name' => 'contact_sub_type_b', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Contact Subtype B') , + 'title' => ts('Contact Subtype B'), 'description' => 'If defined, contact_sub_type_b in a relationship of this type must be a specific contact_sub_type. ', 'maxlength' => 64, @@ -284,30 +275,30 @@ static function &fields() { 'entity' => 'RelationshipType', 'bao' => 'CRM_Contact_BAO_RelationshipType', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_contact_type', 'keyColumn' => 'name', 'labelColumn' => 'label', 'condition' => 'parent_id IS NOT NULL', - ) - ) , - 'is_reserved' => array( + ] + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Relationship Type is Reserved') , + 'title' => ts('Relationship Type is Reserved'), 'description' => 'Is this relationship type a predefined system type (can not be changed or de-activated)?', 'table_name' => 'civicrm_relationship_type', 'entity' => 'RelationshipType', 'bao' => 'CRM_Contact_BAO_RelationshipType', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Relationship Type is Active') , + 'title' => ts('Relationship Type is Active'), 'description' => 'Is this relationship type currently active (i.e. can be used when creating or editing relationships)? ', 'default' => '1', @@ -315,40 +306,44 @@ static function &fields() { 'entity' => 'RelationshipType', 'bao' => 'CRM_Contact_BAO_RelationshipType', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -356,10 +351,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'relationship_type', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'relationship_type', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -367,34 +363,40 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'relationship_type', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'relationship_type', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_name_a_b' => array( + $indices = [ + 'UI_name_a_b' => [ 'name' => 'UI_name_a_b', - 'field' => array( + 'field' => [ 0 => 'name_a_b', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_relationship_type::1::name_a_b', - ) , - 'UI_name_b_a' => array( + ], + 'UI_name_b_a' => [ 'name' => 'UI_name_b_a', - 'field' => array( + 'field' => [ 0 => 'name_b_a', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_relationship_type::1::name_b_a', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contact/DAO/SavedSearch.php b/CRM/Contact/DAO/SavedSearch.php index bfecfb6bbc8e..0755741e050b 100644 --- a/CRM/Contact/DAO/SavedSearch.php +++ b/CRM/Contact/DAO/SavedSearch.php @@ -1,29 +1,5 @@ __table = 'civicrm_saved_search'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'mapping_id', 'civicrm_mapping', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mapping_id', 'civicrm_mapping', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Saved Search ID') , + 'title' => ts('Saved Search ID'), 'description' => 'Saved Search ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_saved_search', 'entity' => 'SavedSearch', 'bao' => 'CRM_Contact_BAO_SavedSearch', 'localizable' => 0, - ) , - 'form_values' => array( + ], + 'form_values' => [ 'name' => 'form_values', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Submitted Form Values') , + 'title' => ts('Submitted Form Values'), 'description' => 'Submitted form values for this search', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_saved_search.form_values', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_saved_search', 'entity' => 'SavedSearch', 'bao' => 'CRM_Contact_BAO_SavedSearch', 'localizable' => 0, 'serialize' => self::SERIALIZE_PHP, - ) , - 'mapping_id' => array( + ], + 'mapping_id' => [ 'name' => 'mapping_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mapping ID') , + 'title' => ts('Mapping ID'), 'description' => 'Foreign key to civicrm_mapping used for saved search-builder searches.', 'table_name' => 'civicrm_saved_search', 'entity' => 'SavedSearch', 'bao' => 'CRM_Contact_BAO_SavedSearch', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Mapping', - ) , - 'search_custom_id' => array( + ], + 'search_custom_id' => [ 'name' => 'search_custom_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Option Value ID') , + 'title' => ts('Option Value ID'), 'description' => 'Foreign key to civicrm_option value table used for saved custom searches.', 'table_name' => 'civicrm_saved_search', 'entity' => 'SavedSearch', 'bao' => 'CRM_Contact_BAO_SavedSearch', 'localizable' => 0, - ) , - 'where_clause' => array( + ], + 'where_clause' => [ 'name' => 'where_clause', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Where Clause') , + 'title' => ts('Where Clause'), 'description' => 'the sql where clause if a saved search acl', 'table_name' => 'civicrm_saved_search', 'entity' => 'SavedSearch', 'bao' => 'CRM_Contact_BAO_SavedSearch', 'localizable' => 0, - ) , - 'select_tables' => array( + ], + 'select_tables' => [ 'name' => 'select_tables', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Select Tables') , + 'title' => ts('Select Tables'), 'description' => 'the tables to be included in a select data', 'table_name' => 'civicrm_saved_search', 'entity' => 'SavedSearch', 'bao' => 'CRM_Contact_BAO_SavedSearch', 'localizable' => 0, 'serialize' => self::SERIALIZE_PHP, - ) , - 'where_tables' => array( + ], + 'where_tables' => [ 'name' => 'where_tables', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Where Tables') , + 'title' => ts('Where Tables'), 'description' => 'the tables to be included in the count statement', 'table_name' => 'civicrm_saved_search', 'entity' => 'SavedSearch', 'bao' => 'CRM_Contact_BAO_SavedSearch', 'localizable' => 0, 'serialize' => self::SERIALIZE_PHP, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -241,10 +232,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'saved_search', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'saved_search', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -252,15 +244,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'saved_search', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'saved_search', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contact/DAO/SubscriptionHistory.php b/CRM/Contact/DAO/SubscriptionHistory.php index 0890772cca58..0fc2f90fb7b6 100644 --- a/CRM/Contact/DAO/SubscriptionHistory.php +++ b/CRM/Contact/DAO/SubscriptionHistory.php @@ -1,29 +1,5 @@ __table = 'civicrm_subscription_history'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'group_id', 'civicrm_group', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'group_id', 'civicrm_group', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Group Membership History ID') , + 'title' => ts('Group Membership History ID'), 'description' => 'Internal Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_subscription_history', 'entity' => 'SubscriptionHistory', 'bao' => 'CRM_Contact_BAO_SubscriptionHistory', 'localizable' => 0, - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'Contact Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_subscription_history', 'entity' => 'SubscriptionHistory', 'bao' => 'CRM_Contact_BAO_SubscriptionHistory', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'group_id' => array( + ], + 'group_id' => [ 'name' => 'group_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Group') , + 'title' => ts('Group'), 'description' => 'Group Id', 'table_name' => 'civicrm_subscription_history', 'entity' => 'SubscriptionHistory', 'bao' => 'CRM_Contact_BAO_SubscriptionHistory', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Group', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'date' => array( + ] + ], + 'date' => [ 'name' => 'date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Group Membership Action Date') , + 'title' => ts('Group Membership Action Date'), 'description' => 'Date of the (un)subscription', - 'required' => true, + 'required' => TRUE, 'default' => 'CURRENT_TIMESTAMP', 'table_name' => 'civicrm_subscription_history', 'entity' => 'SubscriptionHistory', 'bao' => 'CRM_Contact_BAO_SubscriptionHistory', 'localizable' => 0, - ) , - 'method' => array( + ], + 'method' => [ 'name' => 'method', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Group Membership Action') , + 'title' => ts('Group Membership Action'), 'description' => 'How the (un)subscription was triggered', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -187,17 +174,17 @@ static function &fields() { 'entity' => 'SubscriptionHistory', 'bao' => 'CRM_Contact_BAO_SubscriptionHistory', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getSubscriptionHistoryMethods', - ) - ) , - 'status' => array( + ] + ], + 'status' => [ 'name' => 'status', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Group Membership Status') , + 'title' => ts('Group Membership Status'), 'description' => 'The state of the contact within the group', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -205,14 +192,14 @@ static function &fields() { 'entity' => 'SubscriptionHistory', 'bao' => 'CRM_Contact_BAO_SubscriptionHistory', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::groupContactStatus', - ) - ) , - 'tracking' => array( + ] + ], + 'tracking' => [ 'name' => 'tracking', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Group Membership Tracking') , + 'title' => ts('Group Membership Tracking'), 'description' => 'IP address or other tracking info', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -220,40 +207,44 @@ static function &fields() { 'entity' => 'SubscriptionHistory', 'bao' => 'CRM_Contact_BAO_SubscriptionHistory', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -261,10 +252,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'subscription_history', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'subscription_history', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -272,15 +264,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'subscription_history', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'subscription_history', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contribute/DAO/Contribution.php b/CRM/Contribute/DAO/Contribution.php index 6744a69fa949..f217ba7630a0 100644 --- a/CRM/Contribute/DAO/Contribution.php +++ b/CRM/Contribute/DAO/Contribution.php @@ -1,29 +1,5 @@ __table = 'civicrm_contribution'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_page_id', 'civicrm_contribution_page', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_recur_id', 'civicrm_contribution_recur', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'address_id', 'civicrm_address', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_page_id', 'civicrm_contribution_page', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_recur_id', 'civicrm_contribution_recur', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'address_id', 'civicrm_address', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'contribution_id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'contribution_id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contribution ID') , + 'title' => ts('Contribution ID'), 'description' => 'Contribution ID', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_contribution.id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - ) , - 'contribution_contact_id' => array( + ], + 'contribution_contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'FK to Contact ID', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_contribution.contact_id', 'headerPattern' => '/contact(.?id)?/i', 'dataPattern' => '/^\d+$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'EntityRef', - ) , - ) , - 'financial_type_id' => array( + ], + ], + 'financial_type_id' => [ 'name' => 'financial_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Type') , + 'title' => ts('Financial Type'), 'description' => 'FK to Financial Type for (total_amount - non_deductible_amount).', - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_contribution.financial_type_id', 'headerPattern' => '', 'dataPattern' => '', @@ -308,45 +312,45 @@ static function &fields() { 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_FinancialType', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'contribution_page_id' => array( + ] + ], + 'contribution_page_id' => [ 'name' => 'contribution_page_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contribution Page ID') , + 'title' => ts('Contribution Page ID'), 'description' => 'The Contribution Page which triggered this contribution', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contribution.contribution_page_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_contribution_page', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'payment_instrument_id' => array( + ] + ], + 'payment_instrument_id' => [ 'name' => 'payment_instrument_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Payment Method ID') , + 'title' => ts('Payment Method ID'), 'description' => 'FK to Payment Instrument', - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_contribution.payment_instrument_id', 'headerPattern' => '/^payment|(p(ayment\s)?instrument)$/i', 'dataPattern' => '', @@ -354,326 +358,326 @@ static function &fields() { 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'payment_instrument', 'optionEditPath' => 'civicrm/admin/options/payment_instrument', - ) - ) , - 'receive_date' => array( + ] + ], + 'receive_date' => [ 'name' => 'receive_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Date Received') , + 'title' => ts('Date Received'), 'description' => 'Date contribution was received - not necessarily the creation date of the record', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contribution.receive_date', 'headerPattern' => '/receive(.?date)?/i', 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'formatType' => 'activityDateTime', - ) , - ) , - 'non_deductible_amount' => array( + ], + ], + 'non_deductible_amount' => [ 'name' => 'non_deductible_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Non-deductible Amount') , + 'title' => ts('Non-deductible Amount'), 'description' => 'Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types.', - 'precision' => array( + 'precision' => [ 20, 2 - ) , - 'import' => true, + ], + 'import' => TRUE, 'where' => 'civicrm_contribution.non_deductible_amount', 'headerPattern' => '/non?.?deduct/i', 'dataPattern' => '/^\d+(\.\d{2})?$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'total_amount' => array( + ], + ], + 'total_amount' => [ 'name' => 'total_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Total Amount') , + 'title' => ts('Total Amount'), 'description' => 'Total amount of this contribution. Use market value for non-monetary gifts.', - 'required' => true, - 'precision' => array( + 'required' => TRUE, + 'precision' => [ 20, 2 - ) , - 'import' => true, + ], + 'import' => TRUE, 'where' => 'civicrm_contribution.total_amount', 'headerPattern' => '/^total|(.?^am(ou)?nt)/i', 'dataPattern' => '/^\d+(\.\d{2})?$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'fee_amount' => array( + ], + ], + 'fee_amount' => [ 'name' => 'fee_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Fee Amount') , + 'title' => ts('Fee Amount'), 'description' => 'actual processor fee if known - may be 0.', - 'precision' => array( + 'precision' => [ 20, 2 - ) , - 'import' => true, + ], + 'import' => TRUE, 'where' => 'civicrm_contribution.fee_amount', 'headerPattern' => '/fee(.?am(ou)?nt)?/i', 'dataPattern' => '/^\d+(\.\d{2})?$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'net_amount' => array( + ], + ], + 'net_amount' => [ 'name' => 'net_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Net Amount') , + 'title' => ts('Net Amount'), 'description' => 'actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.', - 'precision' => array( + 'precision' => [ 20, 2 - ) , - 'import' => true, + ], + 'import' => TRUE, 'where' => 'civicrm_contribution.net_amount', 'headerPattern' => '/net(.?am(ou)?nt)?/i', 'dataPattern' => '/^\d+(\.\d{2})?$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'trxn_id' => array( + ], + ], + 'trxn_id' => [ 'name' => 'trxn_id', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Transaction ID') , + 'title' => ts('Transaction ID'), 'description' => 'unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contribution.trxn_id', 'headerPattern' => '/tr(ansactio|x)n(.?id)?/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'invoice_id' => array( + ], + ], + 'invoice_id' => [ 'name' => 'invoice_id', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Invoice Reference') , + 'title' => ts('Invoice Reference'), 'description' => 'unique invoice id, system generated or passed in', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contribution.invoice_id', 'headerPattern' => '/invoice(.?id)?/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'invoice_number' => array( + ], + ], + 'invoice_number' => [ 'name' => 'invoice_number', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Invoice Number') , + 'title' => ts('Invoice Number'), 'description' => 'Human readable invoice number', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contribution.invoice_number', 'headerPattern' => '/invoice(.?number)?/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'currency' => array( + ], + ], + 'currency' => [ 'name' => 'currency', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Currency') , + 'title' => ts('Currency'), 'description' => '3 character string, value from config setting or input via user.', 'maxlength' => 3, 'size' => CRM_Utils_Type::FOUR, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contribution.currency', 'headerPattern' => '/cur(rency)?/i', 'dataPattern' => '/^[A-Z]{3}$/i', - 'export' => true, + 'export' => TRUE, 'default' => 'NULL', 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_currency', 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ) - ) , - 'cancel_date' => array( + ] + ], + 'cancel_date' => [ 'name' => 'cancel_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Cancel Date') , + 'title' => ts('Cancel Date'), 'description' => 'when was gift cancelled', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contribution.cancel_date', 'headerPattern' => '/cancel(.?date)?/i', 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'formatType' => 'activityDateTime', - ) , - ) , - 'cancel_reason' => array( + ], + ], + 'cancel_reason' => [ 'name' => 'cancel_reason', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Cancel Reason') , - 'import' => true, + 'title' => ts('Cancel Reason'), + 'import' => TRUE, 'where' => 'civicrm_contribution.cancel_reason', 'headerPattern' => '/(cancel.?)?reason/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'receipt_date' => array( + ], + ], + 'receipt_date' => [ 'name' => 'receipt_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Receipt Date') , + 'title' => ts('Receipt Date'), 'description' => 'when (if) receipt was sent. populated automatically for online donations w/ automatic receipting', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contribution.receipt_date', 'headerPattern' => '/receipt(.?date)?/i', 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'formatType' => 'activityDateTime', - ) , - ) , - 'thankyou_date' => array( + ], + ], + 'thankyou_date' => [ 'name' => 'thankyou_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Thank-you Date') , + 'title' => ts('Thank-you Date'), 'description' => 'when (if) was donor thanked', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contribution.thankyou_date', 'headerPattern' => '/thank(s|(.?you))?(.?date)?/i', 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'formatType' => 'activityDateTime', - ) , - ) , - 'contribution_source' => array( + ], + ], + 'contribution_source' => [ 'name' => 'source', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Contribution Source') , + 'title' => ts('Contribution Source'), 'description' => 'Origin of this Contribution.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contribution.source', 'headerPattern' => '/source/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'amount_level' => array( + ], + ], + 'amount_level' => [ 'name' => 'amount_level', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Amount Label') , - 'import' => true, + 'title' => ts('Amount Label'), + 'import' => TRUE, 'where' => 'civicrm_contribution.amount_level', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'contribution_recur_id' => array( + ], + ], + 'contribution_recur_id' => [ 'name' => 'contribution_recur_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Recurring Contribution ID') , + 'title' => ts('Recurring Contribution ID'), 'description' => 'Conditional foreign key to civicrm_contribution_recur id. Each contribution made in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events.', - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_contribution.contribution_recur_id', 'headerPattern' => '', 'dataPattern' => '', @@ -682,69 +686,69 @@ static function &fields() { 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, 'FKClassName' => 'CRM_Contribute_DAO_ContributionRecur', - ) , - 'is_test' => array( + ], + 'is_test' => [ 'name' => 'is_test', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Test') , - 'import' => true, + 'title' => ts('Test'), + 'import' => TRUE, 'where' => 'civicrm_contribution.is_test', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'is_pay_later' => array( + ], + ], + 'is_pay_later' => [ 'name' => 'is_pay_later', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Pay Later') , - 'import' => true, + 'title' => ts('Is Pay Later'), + 'import' => TRUE, 'where' => 'civicrm_contribution.is_pay_later', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'contribution_status_id' => array( + ], + ], + 'contribution_status_id' => [ 'name' => 'contribution_status_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contribution Status ID') , - 'import' => true, + 'title' => ts('Contribution Status ID'), + 'import' => TRUE, 'where' => 'civicrm_contribution.contribution_status_id', 'headerPattern' => '/status/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'default' => '1', 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'contribution_status', 'optionEditPath' => 'civicrm/admin/options/contribution_status', - ) - ) , - 'contribution_address_id' => array( + ] + ], + 'contribution_address_id' => [ 'name' => 'address_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contribution Address') , + 'title' => ts('Contribution Address'), 'description' => 'Conditional foreign key to civicrm_address.id. We insert an address record for each contribution when we have associated billing name and address data.', - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_contribution.address_id', 'headerPattern' => '', 'dataPattern' => '', @@ -753,144 +757,148 @@ static function &fields() { 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Address', - ) , - 'contribution_check_number' => array( + ], + 'contribution_check_number' => [ 'name' => 'check_number', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Check Number') , + 'title' => ts('Check Number'), 'maxlength' => 255, 'size' => 6, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contribution.check_number', 'headerPattern' => '/check(.?number)?/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'contribution_campaign_id' => array( + ], + ], + 'contribution_campaign_id' => [ 'name' => 'campaign_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Campaign') , + 'title' => ts('Campaign'), 'description' => 'The campaign for which this contribution has been triggered.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contribution.campaign_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, 'FKClassName' => 'CRM_Campaign_DAO_Campaign', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'creditnote_id' => array( + ] + ], + 'creditnote_id' => [ 'name' => 'creditnote_id', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Credit Note ID') , + 'title' => ts('Credit Note ID'), 'description' => 'unique credit note id, system generated or passed in', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contribution.creditnote_id', 'headerPattern' => '/creditnote(.?id)?/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'tax_amount' => array( + ], + ], + 'tax_amount' => [ 'name' => 'tax_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Tax Amount') , + 'title' => ts('Tax Amount'), 'description' => 'Total tax amount of this contribution.', - 'precision' => array( + 'precision' => [ 20, 2 - ) , - 'import' => true, + ], + 'import' => TRUE, 'where' => 'civicrm_contribution.tax_amount', 'headerPattern' => '/tax(.?am(ou)?nt)?/i', 'dataPattern' => '/^\d+(\.\d{2})?$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'revenue_recognition_date' => array( + ], + ], + 'revenue_recognition_date' => [ 'name' => 'revenue_recognition_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Revenue Recognition Date') , + 'title' => ts('Revenue Recognition Date'), 'description' => 'Stores the date when revenue should be recognized.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contribution.revenue_recognition_date', 'headerPattern' => '/revenue(.?date)?/i', 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution', 'entity' => 'Contribution', 'bao' => 'CRM_Contribute_BAO_Contribution', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'formatType' => 'activityDateTime', - ) , - ) , - ); + ], + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -898,10 +906,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -909,91 +918,97 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_contrib_payment_instrument_id' => array( + $indices = [ + 'UI_contrib_payment_instrument_id' => [ 'name' => 'UI_contrib_payment_instrument_id', - 'field' => array( + 'field' => [ 0 => 'payment_instrument_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contribution::0::payment_instrument_id', - ) , - 'index_total_amount_receive_date' => array( + ], + 'index_total_amount_receive_date' => [ 'name' => 'index_total_amount_receive_date', - 'field' => array( + 'field' => [ 0 => 'total_amount', 1 => 'receive_date', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contribution::0::total_amount::receive_date', - ) , - 'index_source' => array( + ], + 'index_source' => [ 'name' => 'index_source', - 'field' => array( + 'field' => [ 0 => 'source', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contribution::0::source', - ) , - 'UI_contrib_trxn_id' => array( + ], + 'UI_contrib_trxn_id' => [ 'name' => 'UI_contrib_trxn_id', - 'field' => array( + 'field' => [ 0 => 'trxn_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_contribution::1::trxn_id', - ) , - 'UI_contrib_invoice_id' => array( + ], + 'UI_contrib_invoice_id' => [ 'name' => 'UI_contrib_invoice_id', - 'field' => array( + 'field' => [ 0 => 'invoice_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_contribution::1::invoice_id', - ) , - 'index_contribution_status' => array( + ], + 'index_contribution_status' => [ 'name' => 'index_contribution_status', - 'field' => array( + 'field' => [ 0 => 'contribution_status_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contribution::0::contribution_status_id', - ) , - 'received_date' => array( + ], + 'received_date' => [ 'name' => 'received_date', - 'field' => array( + 'field' => [ 0 => 'receive_date', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contribution::0::receive_date', - ) , - 'check_number' => array( + ], + 'check_number' => [ 'name' => 'check_number', - 'field' => array( + 'field' => [ 0 => 'check_number', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contribution::0::check_number', - ) , - 'index_creditnote_id' => array( + ], + 'index_creditnote_id' => [ 'name' => 'index_creditnote_id', - 'field' => array( + 'field' => [ 0 => 'creditnote_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contribution::0::creditnote_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contribute/DAO/ContributionPage.php b/CRM/Contribute/DAO/ContributionPage.php index d26a27bc0ad7..35fa5ca615f8 100644 --- a/CRM/Contribute/DAO/ContributionPage.php +++ b/CRM/Contribute/DAO/ContributionPage.php @@ -1,29 +1,5 @@ __table = 'civicrm_contribution_page'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contribution Page ID') , + 'title' => ts('Contribution Page ID'), 'description' => 'Contribution Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'title' => array( + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Contribution Page Title') , + 'title' => ts('Contribution Page Title'), 'description' => 'Contribution Page title. For top of page display', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -373,11 +398,11 @@ static function &fields() { 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 1, - ) , - 'intro_text' => array( + ], + 'intro_text' => [ 'name' => 'intro_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Contribution Page Introduction Text') , + 'title' => ts('Contribution Page Introduction Text'), 'description' => 'Text and html allowed. Displayed below title.', 'rows' => 6, 'cols' => 50, @@ -385,33 +410,33 @@ static function &fields() { 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'RichTextEditor', - ) , - ) , - 'financial_type_id' => array( + ], + ], + 'financial_type_id' => [ 'name' => 'financial_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Type') , + 'title' => ts('Financial Type'), 'description' => 'default financial type assigned to contributions submitted via this page, e.g. Contribution, Campaign Contribution', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_FinancialType', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'payment_processor' => array( + ] + ], + 'payment_processor' => [ 'name' => 'payment_processor', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Payment Processor') , + 'title' => ts('Payment Processor'), 'description' => 'Payment Processors configured for this contribution Page', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -419,61 +444,61 @@ static function &fields() { 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_payment_processor', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'is_credit_card_only' => array( + ] + ], + 'is_credit_card_only' => [ 'name' => 'is_credit_card_only', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Credit Card Only?') , + 'title' => ts('Is Credit Card Only?'), 'description' => 'if true - processing logic must reject transaction at confirmation stage if pay method != credit card', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'is_monetary' => array( + ], + 'is_monetary' => [ 'name' => 'is_monetary', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Monetary') , + 'title' => ts('Is Monetary'), 'description' => 'if true - allows real-time monetary transactions otherwise non-monetary transactions', 'default' => '1', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'is_recur' => array( + ], + 'is_recur' => [ 'name' => 'is_recur', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Recurring') , + 'title' => ts('Is Recurring'), 'description' => 'if true - allows recurring contributions, valid only for PayPal_Standard', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'is_confirm_enabled' => array( + ], + 'is_confirm_enabled' => [ 'name' => 'is_confirm_enabled', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Confirmation Page?') , + 'title' => ts('Confirmation Page?'), 'description' => 'if false, the confirm page in contribution pages gets skipped', 'default' => '1', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'recur_frequency_unit' => array( + ], + 'recur_frequency_unit' => [ 'name' => 'recur_frequency_unit', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Recurring Frequency') , + 'title' => ts('Recurring Frequency'), 'description' => 'Supported recurring frequency units.', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -482,89 +507,89 @@ static function &fields() { 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'recur_frequency_units', 'keyColumn' => 'name', 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units', - ) - ) , - 'is_recur_interval' => array( + ] + ], + 'is_recur_interval' => [ 'name' => 'is_recur_interval', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Support Recurring Intervals') , + 'title' => ts('Support Recurring Intervals'), 'description' => 'if true - supports recurring intervals', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'is_recur_installments' => array( + ], + 'is_recur_installments' => [ 'name' => 'is_recur_installments', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Recurring Installments?') , + 'title' => ts('Recurring Installments?'), 'description' => 'if true - asks user for recurring installments', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'adjust_recur_start_date' => array( + ], + 'adjust_recur_start_date' => [ 'name' => 'adjust_recur_start_date', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Adjust Recurring Start Date') , + 'title' => ts('Adjust Recurring Start Date'), 'description' => 'if true - user is able to adjust payment start date', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'is_pay_later' => array( + ], + 'is_pay_later' => [ 'name' => 'is_pay_later', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Pay Later') , + 'title' => ts('Pay Later'), 'description' => 'if true - allows the user to send payment directly to the org later', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'pay_later_text' => array( + ], + 'pay_later_text' => [ 'name' => 'pay_later_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Pay Later Text') , + 'title' => ts('Pay Later Text'), 'description' => 'The text displayed to the user in the main form', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 1, - ) , - 'pay_later_receipt' => array( + ], + 'pay_later_receipt' => [ 'name' => 'pay_later_receipt', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Pay Later Receipt') , + 'title' => ts('Pay Later Receipt'), 'description' => 'The receipt sent to the user instead of the normal receipt text', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 1, - ) , - 'is_partial_payment' => array( + ], + 'is_partial_payment' => [ 'name' => 'is_partial_payment', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Allow Partial Payment') , + 'title' => ts('Allow Partial Payment'), 'description' => 'is partial payment enabled for this online contribution page', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'initial_amount_label' => array( + ], + 'initial_amount_label' => [ 'name' => 'initial_amount_label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Initial Amount Label') , + 'title' => ts('Initial Amount Label'), 'description' => 'Initial amount label for partial payment', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -572,97 +597,97 @@ static function &fields() { 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 1, - ) , - 'initial_amount_help_text' => array( + ], + 'initial_amount_help_text' => [ 'name' => 'initial_amount_help_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Initial Amount Help Text') , + 'title' => ts('Initial Amount Help Text'), 'description' => 'Initial amount help text for partial payment', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 1, - ) , - 'min_initial_amount' => array( + ], + 'min_initial_amount' => [ 'name' => 'min_initial_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Min Initial Amount') , + 'title' => ts('Min Initial Amount'), 'description' => 'Minimum initial amount for partial payment', - 'precision' => array( + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'is_allow_other_amount' => array( + ], + 'is_allow_other_amount' => [ 'name' => 'is_allow_other_amount', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Allow Other Amounts') , + 'title' => ts('Allow Other Amounts'), 'description' => 'if true, page will include an input text field where user can enter their own amount', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'default_amount_id' => array( + ], + 'default_amount_id' => [ 'name' => 'default_amount_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Default Amount') , + 'title' => ts('Default Amount'), 'description' => 'FK to civicrm_option_value.', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'min_amount' => array( + ], + 'min_amount' => [ 'name' => 'min_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Minimum Amount') , + 'title' => ts('Minimum Amount'), 'description' => 'if other amounts allowed, user can configure minimum allowed.', - 'precision' => array( + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'max_amount' => array( + ], + 'max_amount' => [ 'name' => 'max_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Maximum Amount') , + 'title' => ts('Maximum Amount'), 'description' => 'if other amounts allowed, user can configure maximum allowed.', - 'precision' => array( + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'goal_amount' => array( + ], + 'goal_amount' => [ 'name' => 'goal_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Goal Amount') , + 'title' => ts('Goal Amount'), 'description' => 'The target goal for this page, allows people to build a goal meter', - 'precision' => array( + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'thankyou_title' => array( + ], + 'thankyou_title' => [ 'name' => 'thankyou_title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Thank-you Title') , + 'title' => ts('Thank-you Title'), 'description' => 'Title for Thank-you page (header title tag, and display at the top of the page).', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -670,11 +695,11 @@ static function &fields() { 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 1, - ) , - 'thankyou_text' => array( + ], + 'thankyou_text' => [ 'name' => 'thankyou_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Thank-you Text') , + 'title' => ts('Thank-you Text'), 'description' => 'text and html allowed. displayed above result on success page', 'rows' => 8, 'cols' => 60, @@ -682,14 +707,14 @@ static function &fields() { 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'RichTextEditor', - ) , - ) , - 'thankyou_footer' => array( + ], + ], + 'thankyou_footer' => [ 'name' => 'thankyou_footer', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Thank-you Footer') , + 'title' => ts('Thank-you Footer'), 'description' => 'Text and html allowed. displayed at the bottom of the success page. Common usage is to include link(s) to other pages such as tell-a-friend, etc.', 'rows' => 8, 'cols' => 60, @@ -697,24 +722,24 @@ static function &fields() { 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'RichTextEditor', - ) , - ) , - 'is_email_receipt' => array( + ], + ], + 'is_email_receipt' => [ 'name' => 'is_email_receipt', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Send email Receipt') , + 'title' => ts('Send email Receipt'), 'description' => 'if true, receipt is automatically emailed to contact on success', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'receipt_from_name' => array( + ], + 'receipt_from_name' => [ 'name' => 'receipt_from_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Receipt From') , + 'title' => ts('Receipt From'), 'description' => 'FROM email name used for receipts generated by contributions to this contribution page.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -722,11 +747,11 @@ static function &fields() { 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 1, - ) , - 'receipt_from_email' => array( + ], + 'receipt_from_email' => [ 'name' => 'receipt_from_email', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Receipt From email') , + 'title' => ts('Receipt From email'), 'description' => 'FROM email address used for receipts generated by contributions to this contribution page.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -734,11 +759,11 @@ static function &fields() { 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'cc_receipt' => array( + ], + 'cc_receipt' => [ 'name' => 'cc_receipt', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Receipt cc') , + 'title' => ts('Receipt cc'), 'description' => 'comma-separated list of email addresses to cc each time a receipt is sent', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -746,11 +771,11 @@ static function &fields() { 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'bcc_receipt' => array( + ], + 'bcc_receipt' => [ 'name' => 'bcc_receipt', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Receipt bcc') , + 'title' => ts('Receipt bcc'), 'description' => 'comma-separated list of email addresses to bcc each time a receipt is sent', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -758,11 +783,11 @@ static function &fields() { 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'receipt_text' => array( + ], + 'receipt_text' => [ 'name' => 'receipt_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Receipt Text') , + 'title' => ts('Receipt Text'), 'description' => 'text to include above standard receipt info on receipt email. emails are text-only, so do not allow html for now', 'rows' => 6, 'cols' => 50, @@ -770,24 +795,24 @@ static function &fields() { 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'is_active' => array( + ], + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Page Active?') , + 'title' => ts('Is Page Active?'), 'description' => 'Is this property active?', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'footer_text' => array( + ], + 'footer_text' => [ 'name' => 'footer_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Footer Text') , + 'title' => ts('Footer Text'), 'description' => 'Text and html allowed. Displayed at the bottom of the first page of the contribution wizard.', 'rows' => 6, 'cols' => 50, @@ -795,66 +820,66 @@ static function &fields() { 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'RichTextEditor', - ) , - ) , - 'amount_block_is_active' => array( + ], + ], + 'amount_block_is_active' => [ 'name' => 'amount_block_is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Amount Block Active?') , + 'title' => ts('Is Amount Block Active?'), 'description' => 'Is this property active?', 'default' => '1', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'start_date' => array( + ], + 'start_date' => [ 'name' => 'start_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Contribution Page Start Date') , + 'title' => ts('Contribution Page Start Date'), 'description' => 'Date and time that this page starts.', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'end_date' => array( + ], + 'end_date' => [ 'name' => 'end_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Contribution Page End Date') , + 'title' => ts('Contribution Page End Date'), 'description' => 'Date and time that this page ends. May be NULL if no defined end date/time', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'created_id' => array( + ], + 'created_id' => [ 'name' => 'created_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contribution Page Created By') , + 'title' => ts('Contribution Page Created By'), 'description' => 'FK to civicrm_contact, who created this contribution page', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'created_date' => array( + ], + 'created_date' => [ 'name' => 'created_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Contribution Page Created Date') , + 'title' => ts('Contribution Page Created Date'), 'description' => 'Date and time that contribution page was created.', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'currency' => array( + ], + 'currency' => [ 'name' => 'currency', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Contribution Page Currency') , + 'title' => ts('Contribution Page Currency'), 'description' => '3 character string, value from config setting or input via user.', 'maxlength' => 3, 'size' => CRM_Utils_Type::FOUR, @@ -863,86 +888,90 @@ static function &fields() { 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_currency', 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ) - ) , - 'campaign_id' => array( + ] + ], + 'campaign_id' => [ 'name' => 'campaign_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contribution Page Campaign ID') , + 'title' => ts('Contribution Page Campaign ID'), 'description' => 'The campaign for which we are collecting contributions with this page.', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, 'FKClassName' => 'CRM_Campaign_DAO_Campaign', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'is_share' => array( + ] + ], + 'is_share' => [ 'name' => 'is_share', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Contribution Page Shared?') , + 'title' => ts('Is Contribution Page Shared?'), 'description' => 'Can people share the contribution page through social media?', 'default' => '1', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - 'is_billing_required' => array( + ], + 'is_billing_required' => [ 'name' => 'is_billing_required', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is billing block required') , + 'title' => ts('Is billing block required'), 'description' => 'if true - billing block is required for online contribution page', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -950,10 +979,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_page', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_page', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -961,15 +991,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_page', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_page', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contribute/DAO/ContributionProduct.php b/CRM/Contribute/DAO/ContributionProduct.php index 9061090543f5..2402e6a16ab2 100644 --- a/CRM/Contribute/DAO/ContributionProduct.php +++ b/CRM/Contribute/DAO/ContributionProduct.php @@ -1,29 +1,5 @@ __table = 'civicrm_contribution_product'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_id', 'civicrm_contribution', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_id', 'civicrm_contribution', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contribution Product ID') , - 'required' => true, + 'title' => ts('Contribution Product ID'), + 'required' => TRUE, 'table_name' => 'civicrm_contribution_product', 'entity' => 'ContributionProduct', 'bao' => 'CRM_Contribute_DAO_ContributionProduct', 'localizable' => 0, - ) , - 'product_id' => array( + ], + 'product_id' => [ 'name' => 'product_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Product ID') , - 'required' => true, + 'title' => ts('Product ID'), + 'required' => TRUE, 'table_name' => 'civicrm_contribution_product', 'entity' => 'ContributionProduct', 'bao' => 'CRM_Contribute_DAO_ContributionProduct', 'localizable' => 0, - ) , - 'contribution_id' => array( + ], + 'contribution_id' => [ 'name' => 'contribution_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contribution ID') , - 'required' => true, + 'title' => ts('Contribution ID'), + 'required' => TRUE, 'table_name' => 'civicrm_contribution_product', 'entity' => 'ContributionProduct', 'bao' => 'CRM_Contribute_DAO_ContributionProduct', 'localizable' => 0, 'FKClassName' => 'CRM_Contribute_DAO_Contribution', - ) , - 'product_option' => array( + ], + 'product_option' => [ 'name' => 'product_option', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Product Option') , + 'title' => ts('Product Option'), 'description' => 'Option value selected if applicable - e.g. color, size etc.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_contribution_product.product_option', 'headerPattern' => '', 'dataPattern' => '', @@ -181,12 +166,12 @@ static function &fields() { 'entity' => 'ContributionProduct', 'bao' => 'CRM_Contribute_DAO_ContributionProduct', 'localizable' => 0, - ) , - 'quantity' => array( + ], + 'quantity' => [ 'name' => 'quantity', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Quantity') , - 'export' => true, + 'title' => ts('Quantity'), + 'export' => TRUE, 'where' => 'civicrm_contribution_product.quantity', 'headerPattern' => '', 'dataPattern' => '', @@ -194,13 +179,13 @@ static function &fields() { 'entity' => 'ContributionProduct', 'bao' => 'CRM_Contribute_DAO_ContributionProduct', 'localizable' => 0, - ) , - 'fulfilled_date' => array( + ], + 'fulfilled_date' => [ 'name' => 'fulfilled_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Fulfilled Date') , + 'title' => ts('Fulfilled Date'), 'description' => 'Optional. Can be used to record the date this product was fulfilled or shipped.', - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_contribution_product.fulfilled_date', 'headerPattern' => '', 'dataPattern' => '', @@ -208,13 +193,13 @@ static function &fields() { 'entity' => 'ContributionProduct', 'bao' => 'CRM_Contribute_DAO_ContributionProduct', 'localizable' => 0, - ) , - 'contribution_start_date' => array( + ], + 'contribution_start_date' => [ 'name' => 'start_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Start date for premium') , + 'title' => ts('Start date for premium'), 'description' => 'Actual start date for a time-delimited premium (subscription, service or membership)', - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_contribution_product.start_date', 'headerPattern' => '', 'dataPattern' => '', @@ -222,13 +207,13 @@ static function &fields() { 'entity' => 'ContributionProduct', 'bao' => 'CRM_Contribute_DAO_ContributionProduct', 'localizable' => 0, - ) , - 'contribution_end_date' => array( + ], + 'contribution_end_date' => [ 'name' => 'end_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('End date for premium') , + 'title' => ts('End date for premium'), 'description' => 'Actual end date for a time-delimited premium (subscription, service or membership)', - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_contribution_product.end_date', 'headerPattern' => '', 'dataPattern' => '', @@ -236,20 +221,20 @@ static function &fields() { 'entity' => 'ContributionProduct', 'bao' => 'CRM_Contribute_DAO_ContributionProduct', 'localizable' => 0, - ) , - 'comment' => array( + ], + 'comment' => [ 'name' => 'comment', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Premium comment') , + 'title' => ts('Premium comment'), 'table_name' => 'civicrm_contribution_product', 'entity' => 'ContributionProduct', 'bao' => 'CRM_Contribute_DAO_ContributionProduct', 'localizable' => 0, - ) , - 'financial_type_id' => array( + ], + 'financial_type_id' => [ 'name' => 'financial_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Type') , + 'title' => ts('Financial Type'), 'description' => 'FK to Financial Type(for membership price sets only).', 'default' => 'NULL', 'table_name' => 'civicrm_contribution_product', @@ -257,45 +242,49 @@ static function &fields() { 'bao' => 'CRM_Contribute_DAO_ContributionProduct', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_FinancialType', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -303,10 +292,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_product', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_product', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -314,15 +304,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_product', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_product', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contribute/DAO/ContributionRecur.php b/CRM/Contribute/DAO/ContributionRecur.php index 5bdae065b527..d14b7f5ce492 100644 --- a/CRM/Contribute/DAO/ContributionRecur.php +++ b/CRM/Contribute/DAO/ContributionRecur.php @@ -1,29 +1,5 @@ __table = 'civicrm_contribution_recur'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'payment_token_id', 'civicrm_payment_token', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'payment_processor_id', 'civicrm_payment_processor', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'payment_token_id', 'civicrm_payment_token', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'payment_processor_id', 'civicrm_payment_processor', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Recurring Contribution ID') , + 'title' => ts('Recurring Contribution ID'), 'description' => 'Contribution Recur ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'Foreign key to civicrm_contact.id .', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'amount' => array( + ], + 'amount' => [ 'name' => 'amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Amount') , + 'title' => ts('Amount'), 'description' => 'Amount to be contributed or charged each recurrence.', - 'required' => true, - 'precision' => array( + 'required' => TRUE, + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'currency' => array( + ], + ], + 'currency' => [ 'name' => 'currency', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Currency') , + 'title' => ts('Currency'), 'description' => '3 character string, value from config setting or input via user.', 'maxlength' => 3, 'size' => CRM_Utils_Type::FOUR, @@ -302,20 +308,20 @@ static function &fields() { 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_currency', 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ) - ) , - 'frequency_unit' => array( + ] + ], + 'frequency_unit' => [ 'name' => 'frequency_unit', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Frequency Unit') , + 'title' => ts('Frequency Unit'), 'description' => 'Time units for recurrence of payment.', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -324,113 +330,113 @@ static function &fields() { 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'recur_frequency_units', 'keyColumn' => 'name', 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units', - ) - ) , - 'frequency_interval' => array( + ] + ], + 'frequency_interval' => [ 'name' => 'frequency_interval', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Interval (number of units)') , + 'title' => ts('Interval (number of units)'), 'description' => 'Number of time units for recurrence of payment.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'installments' => array( + ], + ], + 'installments' => [ 'name' => 'installments', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Number of Installments') , + 'title' => ts('Number of Installments'), 'description' => 'Total number of payments to be made. Set this to 0 if this is an open-ended commitment i.e. no set end date.', 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'start_date' => array( + ], + ], + 'start_date' => [ 'name' => 'start_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Recurring Contribution Started Date') , + 'title' => ts('Recurring Contribution Started Date'), 'description' => 'The date the first scheduled recurring contribution occurs.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'create_date' => array( + ], + ], + 'create_date' => [ 'name' => 'create_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Recurring Contribution Created Date') , + 'title' => ts('Recurring Contribution Created Date'), 'description' => 'When this recurring contribution record was created.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'modified_date' => array( + ], + ], + 'modified_date' => [ 'name' => 'modified_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Recurring Contribution Modified Date') , + 'title' => ts('Recurring Contribution Modified Date'), 'description' => 'Last updated date for this record. mostly the last time a payment was received', 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'cancel_date' => array( + ], + ], + 'cancel_date' => [ 'name' => 'cancel_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Recurring Contribution Cancel Date') , + 'title' => ts('Recurring Contribution Cancel Date'), 'description' => 'Date this recurring contribution was cancelled by contributor- if we can get access to it', 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'end_date' => array( + ], + ], + 'end_date' => [ 'name' => 'end_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Recurring Contribution End Date') , + 'title' => ts('Recurring Contribution End Date'), 'description' => 'Date this recurring contribution finished successfully', 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'processor_id' => array( + ], + ], + 'processor_id' => [ 'name' => 'processor_id', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Processor ID') , + 'title' => ts('Processor ID'), 'description' => 'Possibly needed to store a unique identifier for this recurring payment order - if this is available from the processor??', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -438,22 +444,22 @@ static function &fields() { 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - ) , - 'payment_token_id' => array( + ], + 'payment_token_id' => [ 'name' => 'payment_token_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Payment Token ID') , + 'title' => ts('Payment Token ID'), 'description' => 'Optionally used to store a link to a payment token used for this recurring contribution.', 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_PaymentToken', - ) , - 'trxn_id' => array( + ], + 'trxn_id' => [ 'name' => 'trxn_id', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Transaction ID') , + 'title' => ts('Transaction ID'), 'description' => 'unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -461,11 +467,11 @@ static function &fields() { 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - ) , - 'invoice_id' => array( + ], + 'invoice_id' => [ 'name' => 'invoice_id', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Invoice ID') , + 'title' => ts('Invoice ID'), 'description' => 'unique invoice id, system generated or passed in', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -473,128 +479,128 @@ static function &fields() { 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - ) , - 'contribution_status_id' => array( + ], + 'contribution_status_id' => [ 'name' => 'contribution_status_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Recurring Contribution Status') , - 'import' => true, + 'title' => ts('Recurring Contribution Status'), + 'import' => TRUE, 'where' => 'civicrm_contribution_recur.contribution_status_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'default' => '1', 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'contribution_status', 'optionEditPath' => 'civicrm/admin/options/contribution_status', - ) - ) , - 'is_test' => array( + ] + ], + 'is_test' => [ 'name' => 'is_test', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Test') , - 'import' => true, + 'title' => ts('Test'), + 'import' => TRUE, 'where' => 'civicrm_contribution_recur.is_test', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'cycle_day' => array( + ], + ], + 'cycle_day' => [ 'name' => 'cycle_day', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Number of Cycle Day') , + 'title' => ts('Number of Cycle Day'), 'description' => 'Day in the period when the payment should be charged e.g. 1st of month, 15th etc.', - 'required' => true, + 'required' => TRUE, 'default' => '1', 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'next_sched_contribution_date' => array( + ], + ], + 'next_sched_contribution_date' => [ 'name' => 'next_sched_contribution_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Next Scheduled Contribution Date') , + 'title' => ts('Next Scheduled Contribution Date'), 'description' => 'Next scheduled date', 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'failure_count' => array( + ], + ], + 'failure_count' => [ 'name' => 'failure_count', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Number of Failures') , + 'title' => ts('Number of Failures'), 'description' => 'Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures.', 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'failure_retry_date' => array( + ], + ], + 'failure_retry_date' => [ 'name' => 'failure_retry_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Retry Failed Attempt Date') , + 'title' => ts('Retry Failed Attempt Date'), 'description' => 'Date to retry failed attempt', 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'auto_renew' => array( + ], + ], + 'auto_renew' => [ 'name' => 'auto_renew', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Auto Renew') , + 'title' => ts('Auto Renew'), 'description' => 'Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'payment_processor_id' => array( + ], + ], + 'payment_processor_id' => [ 'name' => 'payment_processor_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Payment Processor') , + 'title' => ts('Payment Processor'), 'description' => 'Foreign key to civicrm_payment_processor.id', 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor', - ) , - 'financial_type_id' => array( + ], + 'financial_type_id' => [ 'name' => 'financial_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Type') , + 'title' => ts('Financial Type'), 'description' => 'FK to Financial Type', - 'export' => false, + 'export' => FALSE, 'where' => 'civicrm_contribution_recur.financial_type_id', 'headerPattern' => '', 'dataPattern' => '', @@ -603,97 +609,101 @@ static function &fields() { 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_FinancialType', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'payment_instrument_id' => array( + ] + ], + 'payment_instrument_id' => [ 'name' => 'payment_instrument_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Payment Method') , + 'title' => ts('Payment Method'), 'description' => 'FK to Payment Instrument', 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'payment_instrument', 'optionEditPath' => 'civicrm/admin/options/payment_instrument', - ) - ) , - 'contribution_campaign_id' => array( + ] + ], + 'contribution_campaign_id' => [ 'name' => 'campaign_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Campaign') , + 'title' => ts('Campaign'), 'description' => 'The campaign for which this contribution has been triggered.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_contribution_recur.campaign_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, 'FKClassName' => 'CRM_Campaign_DAO_Campaign', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'is_email_receipt' => array( + ] + ], + 'is_email_receipt' => [ 'name' => 'is_email_receipt', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Send email Receipt?') , + 'title' => ts('Send email Receipt?'), 'description' => 'if true, receipt is automatically emailed to contact on each successful payment', 'default' => '1', 'table_name' => 'civicrm_contribution_recur', 'entity' => 'ContributionRecur', 'bao' => 'CRM_Contribute_BAO_ContributionRecur', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - ); + ], + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -701,10 +711,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_recur', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_recur', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -712,50 +723,56 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_recur', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_recur', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_contrib_trxn_id' => array( + $indices = [ + 'UI_contrib_trxn_id' => [ 'name' => 'UI_contrib_trxn_id', - 'field' => array( + 'field' => [ 0 => 'trxn_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_contribution_recur::1::trxn_id', - ) , - 'UI_contrib_invoice_id' => array( + ], + 'UI_contrib_invoice_id' => [ 'name' => 'UI_contrib_invoice_id', - 'field' => array( + 'field' => [ 0 => 'invoice_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_contribution_recur::1::invoice_id', - ) , - 'index_contribution_status' => array( + ], + 'index_contribution_status' => [ 'name' => 'index_contribution_status', - 'field' => array( + 'field' => [ 0 => 'contribution_status_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contribution_recur::0::contribution_status_id', - ) , - 'UI_contribution_recur_payment_instrument_id' => array( + ], + 'UI_contribution_recur_payment_instrument_id' => [ 'name' => 'UI_contribution_recur_payment_instrument_id', - 'field' => array( + 'field' => [ 0 => 'payment_instrument_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contribution_recur::0::payment_instrument_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contribute/DAO/ContributionSoft.php b/CRM/Contribute/DAO/ContributionSoft.php index 2d8f1f692bad..edfc4fc6f896 100644 --- a/CRM/Contribute/DAO/ContributionSoft.php +++ b/CRM/Contribute/DAO/ContributionSoft.php @@ -1,29 +1,5 @@ __table = 'civicrm_contribution_soft'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_id', 'civicrm_contribution', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'pcp_id', 'civicrm_pcp', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_id', 'civicrm_contribution', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'pcp_id', 'civicrm_pcp', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'contribution_soft_id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'contribution_soft_id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Soft Contribution ID') , + 'title' => ts('Soft Contribution ID'), 'description' => 'Soft Contribution ID', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_contribution_soft.id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution_soft', 'entity' => 'ContributionSoft', 'bao' => 'CRM_Contribute_BAO_ContributionSoft', 'localizable' => 0, - ) , - 'contribution_id' => array( + ], + 'contribution_id' => [ 'name' => 'contribution_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Soft Contribution - Contribution') , + 'title' => ts('Soft Contribution - Contribution'), 'description' => 'FK to contribution table.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_contribution_soft', 'entity' => 'ContributionSoft', 'bao' => 'CRM_Contribute_BAO_ContributionSoft', 'localizable' => 0, 'FKClassName' => 'CRM_Contribute_DAO_Contribution', - ) , - 'contribution_soft_contact_id' => array( + ], + 'contribution_soft_contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'FK to Contact ID', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_contribution_soft.contact_id', 'headerPattern' => '/contact(.?id)?/i', 'dataPattern' => '/^\d+$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution_soft', 'entity' => 'ContributionSoft', 'bao' => 'CRM_Contribute_BAO_ContributionSoft', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'amount' => array( + ], + 'amount' => [ 'name' => 'amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Soft Contribution Amount') , + 'title' => ts('Soft Contribution Amount'), 'description' => 'Amount of this soft contribution.', - 'required' => true, - 'precision' => array( + 'required' => TRUE, + 'precision' => [ 20, 2 - ) , - 'import' => true, + ], + 'import' => TRUE, 'where' => 'civicrm_contribution_soft.amount', 'headerPattern' => '/total(.?am(ou)?nt)?/i', 'dataPattern' => '/^\d+(\.\d{2})?$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_contribution_soft', 'entity' => 'ContributionSoft', 'bao' => 'CRM_Contribute_BAO_ContributionSoft', 'localizable' => 0, - ) , - 'currency' => array( + ], + 'currency' => [ 'name' => 'currency', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Soft Contribution Currency') , + 'title' => ts('Soft Contribution Currency'), 'description' => '3 character string, value from config setting or input via user.', 'maxlength' => 3, 'size' => CRM_Utils_Type::FOUR, @@ -215,20 +202,20 @@ static function &fields() { 'entity' => 'ContributionSoft', 'bao' => 'CRM_Contribute_BAO_ContributionSoft', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_currency', 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ) - ) , - 'pcp_id' => array( + ] + ], + 'pcp_id' => [ 'name' => 'pcp_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Soft Contribution PCP') , + 'title' => ts('Soft Contribution PCP'), 'description' => 'FK to civicrm_pcp.id', 'default' => 'NULL', 'table_name' => 'civicrm_contribution_soft', @@ -236,25 +223,25 @@ static function &fields() { 'bao' => 'CRM_Contribute_BAO_ContributionSoft', 'localizable' => 0, 'FKClassName' => 'CRM_PCP_DAO_PCP', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_pcp', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'pcp_display_in_roll' => array( + ] + ], + 'pcp_display_in_roll' => [ 'name' => 'pcp_display_in_roll', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Soft Contribution Display on PCP') , + 'title' => ts('Soft Contribution Display on PCP'), 'table_name' => 'civicrm_contribution_soft', 'entity' => 'ContributionSoft', 'bao' => 'CRM_Contribute_BAO_ContributionSoft', 'localizable' => 0, - ) , - 'pcp_roll_nickname' => array( + ], + 'pcp_roll_nickname' => [ 'name' => 'pcp_roll_nickname', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Soft Contribution PCP Nickname') , + 'title' => ts('Soft Contribution PCP Nickname'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'default' => 'NULL', @@ -262,11 +249,11 @@ static function &fields() { 'entity' => 'ContributionSoft', 'bao' => 'CRM_Contribute_BAO_ContributionSoft', 'localizable' => 0, - ) , - 'pcp_personal_note' => array( + ], + 'pcp_personal_note' => [ 'name' => 'pcp_personal_note', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Soft Contribution PCP Note') , + 'title' => ts('Soft Contribution PCP Note'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'default' => 'NULL', @@ -274,55 +261,59 @@ static function &fields() { 'entity' => 'ContributionSoft', 'bao' => 'CRM_Contribute_BAO_ContributionSoft', 'localizable' => 0, - ) , - 'soft_credit_type_id' => array( + ], + 'soft_credit_type_id' => [ 'name' => 'soft_credit_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Soft Credit Type') , + 'title' => ts('Soft Credit Type'), 'description' => 'Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.', 'default' => 'NULL', 'table_name' => 'civicrm_contribution_soft', 'entity' => 'ContributionSoft', 'bao' => 'CRM_Contribute_BAO_ContributionSoft', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'soft_credit_type', 'optionEditPath' => 'civicrm/admin/options/soft_credit_type', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -330,10 +321,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_soft', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_soft', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -341,24 +333,30 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_soft', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_soft', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_id' => array( + $indices = [ + 'index_id' => [ 'name' => 'index_id', - 'field' => array( + 'field' => [ 0 => 'pcp_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_contribution_soft::0::pcp_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contribute/DAO/Premium.php b/CRM/Contribute/DAO/Premium.php index 8de2ba9601db..5631c954fb1a 100644 --- a/CRM/Contribute/DAO/Premium.php +++ b/CRM/Contribute/DAO/Premium.php @@ -1,29 +1,5 @@ at top of Premiums section of page. Text and HTML allowed. * * @var text */ public $premiums_intro_text; + /** * This email address is included in receipts if it is populated and a premium has been selected. * * @var string */ public $premiums_contact_email; + /** * This phone number is included in receipts if it is populated and a premium has been selected. * * @var string */ public $premiums_contact_phone; + /** * Boolean. Should we automatically display minimum contribution amount text after the premium descriptions. * * @var boolean */ public $premiums_display_min_contribution; + /** * Label displayed for No Thank-you option in premiums block (e.g. No thank you) * * @var string */ public $premiums_nothankyou_label; + /** - * * @var int unsigned */ public $premiums_nothankyou_position; + /** * Class constructor. */ - function __construct() { + public function __construct() { $this->__table = 'civicrm_premiums'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Premium ID') , - 'required' => true, + 'title' => ts('Premium ID'), + 'required' => TRUE, 'table_name' => 'civicrm_premiums', 'entity' => 'Premium', 'bao' => 'CRM_Contribute_BAO_Premium', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Premium Entity') , + 'title' => ts('Premium Entity'), 'description' => 'Joins these premium settings to another object. Always civicrm_contribution_page for now.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_premiums', 'entity' => 'Premium', 'bao' => 'CRM_Contribute_BAO_Premium', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Premium entity ID') , - 'required' => true, + 'title' => ts('Premium entity ID'), + 'required' => TRUE, 'table_name' => 'civicrm_premiums', 'entity' => 'Premium', 'bao' => 'CRM_Contribute_BAO_Premium', 'localizable' => 0, - ) , - 'premiums_active' => array( + ], + 'premiums_active' => [ 'name' => 'premiums_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Premium Active?') , + 'title' => ts('Is Premium Active?'), 'description' => 'Is the Premiums feature enabled for this page?', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_premiums', 'entity' => 'Premium', 'bao' => 'CRM_Contribute_BAO_Premium', 'localizable' => 0, - ) , - 'premiums_intro_title' => array( + ], + 'premiums_intro_title' => [ 'name' => 'premiums_intro_title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Title for Premiums section') , + 'title' => ts('Title for Premiums section'), 'description' => 'Title for Premiums section.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -197,21 +185,21 @@ static function &fields() { 'entity' => 'Premium', 'bao' => 'CRM_Contribute_BAO_Premium', 'localizable' => 1, - ) , - 'premiums_intro_text' => array( + ], + 'premiums_intro_text' => [ 'name' => 'premiums_intro_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Premium Introductory Text') , + 'title' => ts('Premium Introductory Text'), 'description' => 'Displayed in
at top of Premiums section of page. Text and HTML allowed.', 'table_name' => 'civicrm_premiums', 'entity' => 'Premium', 'bao' => 'CRM_Contribute_BAO_Premium', 'localizable' => 1, - ) , - 'premiums_contact_email' => array( + ], + 'premiums_contact_email' => [ 'name' => 'premiums_contact_email', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Premium Contact Email') , + 'title' => ts('Premium Contact Email'), 'description' => 'This email address is included in receipts if it is populated and a premium has been selected.', 'maxlength' => 100, 'size' => CRM_Utils_Type::HUGE, @@ -219,11 +207,11 @@ static function &fields() { 'entity' => 'Premium', 'bao' => 'CRM_Contribute_BAO_Premium', 'localizable' => 0, - ) , - 'premiums_contact_phone' => array( + ], + 'premiums_contact_phone' => [ 'name' => 'premiums_contact_phone', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Premiums Contact Phone') , + 'title' => ts('Premiums Contact Phone'), 'description' => 'This phone number is included in receipts if it is populated and a premium has been selected.', 'maxlength' => 50, 'size' => CRM_Utils_Type::BIG, @@ -231,22 +219,22 @@ static function &fields() { 'entity' => 'Premium', 'bao' => 'CRM_Contribute_BAO_Premium', 'localizable' => 0, - ) , - 'premiums_display_min_contribution' => array( + ], + 'premiums_display_min_contribution' => [ 'name' => 'premiums_display_min_contribution', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Display Minimum Contribution?') , + 'title' => ts('Display Minimum Contribution?'), 'description' => 'Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_premiums', 'entity' => 'Premium', 'bao' => 'CRM_Contribute_BAO_Premium', 'localizable' => 0, - ) , - 'premiums_nothankyou_label' => array( + ], + 'premiums_nothankyou_label' => [ 'name' => 'premiums_nothankyou_label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('No Thank-you Text') , + 'title' => ts('No Thank-you Text'), 'description' => 'Label displayed for No Thank-you option in premiums block (e.g. No thank you)', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -254,50 +242,54 @@ static function &fields() { 'entity' => 'Premium', 'bao' => 'CRM_Contribute_BAO_Premium', 'localizable' => 1, - ) , - 'premiums_nothankyou_position' => array( + ], + 'premiums_nothankyou_position' => [ 'name' => 'premiums_nothankyou_position', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('No Thank-you Position') , + 'title' => ts('No Thank-you Position'), 'default' => '1', 'table_name' => 'civicrm_premiums', 'entity' => 'Premium', 'bao' => 'CRM_Contribute_BAO_Premium', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -305,10 +297,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'premiums', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'premiums', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -316,15 +309,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'premiums', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'premiums', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contribute/DAO/PremiumsProduct.php b/CRM/Contribute/DAO/PremiumsProduct.php index 65e0ca345820..bf04314024cb 100644 --- a/CRM/Contribute/DAO/PremiumsProduct.php +++ b/CRM/Contribute/DAO/PremiumsProduct.php @@ -1,29 +1,5 @@ __table = 'civicrm_premiums_product'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'premiums_id', 'civicrm_premiums', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'product_id', 'civicrm_product', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'premiums_id', 'civicrm_premiums', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'product_id', 'civicrm_product', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Premium Product ID') , + 'title' => ts('Premium Product ID'), 'description' => 'Contribution ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_premiums_product', 'entity' => 'PremiumsProduct', 'bao' => 'CRM_Contribute_DAO_PremiumsProduct', 'localizable' => 0, - ) , - 'premiums_id' => array( + ], + 'premiums_id' => [ 'name' => 'premiums_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Premium') , + 'title' => ts('Premium'), 'description' => 'Foreign key to premiums settings record.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_premiums_product', 'entity' => 'PremiumsProduct', 'bao' => 'CRM_Contribute_DAO_PremiumsProduct', 'localizable' => 0, 'FKClassName' => 'CRM_Contribute_DAO_Premium', - ) , - 'product_id' => array( + ], + 'product_id' => [ 'name' => 'product_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Product') , + 'title' => ts('Product'), 'description' => 'Foreign key to each product object.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_premiums_product', 'entity' => 'PremiumsProduct', 'bao' => 'CRM_Contribute_DAO_PremiumsProduct', 'localizable' => 0, 'FKClassName' => 'CRM_Contribute_DAO_Product', - ) , - 'weight' => array( + ], + 'weight' => [ 'name' => 'weight', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Order') , - 'required' => true, + 'title' => ts('Order'), + 'required' => TRUE, 'table_name' => 'civicrm_premiums_product', 'entity' => 'PremiumsProduct', 'bao' => 'CRM_Contribute_DAO_PremiumsProduct', 'localizable' => 0, - ) , - 'financial_type_id' => array( + ], + 'financial_type_id' => [ 'name' => 'financial_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Type') , + 'title' => ts('Financial Type'), 'description' => 'FK to Financial Type.', 'default' => 'NULL', 'table_name' => 'civicrm_premiums_product', @@ -166,45 +150,49 @@ static function &fields() { 'bao' => 'CRM_Contribute_DAO_PremiumsProduct', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_FinancialType', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -212,10 +200,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'premiums_product', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'premiums_product', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -223,15 +212,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'premiums_product', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'premiums_product', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contribute/DAO/Product.php b/CRM/Contribute/DAO/Product.php index fcfdbc7b39c2..09f301d4441c 100644 --- a/CRM/Contribute/DAO/Product.php +++ b/CRM/Contribute/DAO/Product.php @@ -1,29 +1,5 @@ we would set start/end for 1/1/06 thru 12/31/06 for any premium chosen in 2006) @@ -134,83 +124,90 @@ class CRM_Contribute_DAO_Product extends CRM_Core_DAO { * @var string */ public $period_type; + /** * Month and day (MMDD) that fixed period type subscription or membership starts. * * @var int */ public $fixed_period_start_day; + /** - * * @var string */ public $duration_unit; + /** * Number of units for total duration of subscription, service, membership (e.g. 12 Months). * * @var int */ public $duration_interval; + /** * Frequency unit and interval allow option to store actual delivery frequency for a subscription or service. * * @var string */ public $frequency_unit; + /** * Number of units for delivery frequency of subscription, service, membership (e.g. every 3 Months). * * @var int */ public $frequency_interval; + /** * Class constructor. */ - function __construct() { + public function __construct() { $this->__table = 'civicrm_product'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Product ID') , - 'required' => true, + 'title' => ts('Product ID'), + 'required' => TRUE, 'table_name' => 'civicrm_product', 'entity' => 'Product', 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 0, - ) , - 'product_name' => array( + ], + 'product_name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Product Name') , + 'title' => ts('Product Name'), 'description' => 'Required product/premium name', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_product.name', 'headerPattern' => '', 'dataPattern' => '', @@ -218,25 +215,25 @@ static function &fields() { 'entity' => 'Product', 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 1, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Description') , + 'title' => ts('Description'), 'description' => 'Optional description of the product/premium.', 'table_name' => 'civicrm_product', 'entity' => 'Product', 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 1, - ) , - 'sku' => array( + ], + 'sku' => [ 'name' => 'sku', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('SKU') , + 'title' => ts('SKU'), 'description' => 'Optional product sku or code.', 'maxlength' => 50, 'size' => CRM_Utils_Type::BIG, - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_product.sku', 'headerPattern' => '', 'dataPattern' => '', @@ -244,21 +241,21 @@ static function &fields() { 'entity' => 'Product', 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 0, - ) , - 'options' => array( + ], + 'options' => [ 'name' => 'options', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Options') , + 'title' => ts('Options'), 'description' => 'Store comma-delimited list of color, size, etc. options for the product.', 'table_name' => 'civicrm_product', 'entity' => 'Product', 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 1, - ) , - 'image' => array( + ], + 'image' => [ 'name' => 'image', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Image') , + 'title' => ts('Image'), 'description' => 'Full or relative URL to uploaded image - fullsize.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -266,11 +263,11 @@ static function &fields() { 'entity' => 'Product', 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 0, - ) , - 'thumbnail' => array( + ], + 'thumbnail' => [ 'name' => 'thumbnail', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Thumbnail') , + 'title' => ts('Thumbnail'), 'description' => 'Full or relative URL to image thumbnail.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -278,25 +275,25 @@ static function &fields() { 'entity' => 'Product', 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 0, - ) , - 'price' => array( + ], + 'price' => [ 'name' => 'price', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Price') , + 'title' => ts('Price'), 'description' => 'Sell price or market value for premiums. For tax-deductible contributions, this will be stored as non_deductible_amount in the contribution record.', - 'precision' => array( + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_product', 'entity' => 'Product', 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 0, - ) , - 'currency' => array( + ], + 'currency' => [ 'name' => 'currency', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Currency') , + 'title' => ts('Currency'), 'description' => '3 character string, value from config setting or input via user.', 'maxlength' => 3, 'size' => CRM_Utils_Type::FOUR, @@ -305,20 +302,20 @@ static function &fields() { 'entity' => 'Product', 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_currency', 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ) - ) , - 'financial_type_id' => array( + ] + ], + 'financial_type_id' => [ 'name' => 'financial_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Type') , + 'title' => ts('Financial Type'), 'description' => 'FK to Financial Type.', 'default' => 'NULL', 'table_name' => 'civicrm_product', @@ -326,55 +323,55 @@ static function &fields() { 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_FinancialType', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'min_contribution' => array( + ] + ], + 'min_contribution' => [ 'name' => 'min_contribution', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Minimum Contribution') , + 'title' => ts('Minimum Contribution'), 'description' => 'Minimum contribution required to be eligible to select this premium.', - 'precision' => array( + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_product', 'entity' => 'Product', 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 0, - ) , - 'cost' => array( + ], + 'cost' => [ 'name' => 'cost', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Cost') , + 'title' => ts('Cost'), 'description' => 'Actual cost of this product. Useful to determine net return from sale or using this as an incentive.', - 'precision' => array( + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_product', 'entity' => 'Product', 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Active') , + 'title' => ts('Is Active'), 'description' => 'Disabling premium removes it from the premiums_premium join table below.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_product', 'entity' => 'Product', 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 0, - ) , - 'period_type' => array( + ], + 'period_type' => [ 'name' => 'period_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Period Type') , + 'title' => ts('Period Type'), 'description' => 'Rolling means we set start/end based on current day, fixed means we set start/end for current year or month (e.g. 1 year + fixed -> we would set start/end for 1/1/06 thru 12/31/06 for any premium chosen in 2006) ', 'maxlength' => 8, @@ -384,28 +381,28 @@ static function &fields() { 'entity' => 'Product', 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::periodType', - ) - ) , - 'fixed_period_start_day' => array( + ] + ], + 'fixed_period_start_day' => [ 'name' => 'fixed_period_start_day', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Fixed Period Start Day') , + 'title' => ts('Fixed Period Start Day'), 'description' => 'Month and day (MMDD) that fixed period type subscription or membership starts.', 'default' => '0101', 'table_name' => 'civicrm_product', 'entity' => 'Product', 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 0, - ) , - 'duration_unit' => array( + ], + 'duration_unit' => [ 'name' => 'duration_unit', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Duration Unit') , + 'title' => ts('Duration Unit'), 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, 'default' => 'year', @@ -413,27 +410,27 @@ static function &fields() { 'entity' => 'Product', 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getPremiumUnits', - ) - ) , - 'duration_interval' => array( + ] + ], + 'duration_interval' => [ 'name' => 'duration_interval', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Duration Interval') , + 'title' => ts('Duration Interval'), 'description' => 'Number of units for total duration of subscription, service, membership (e.g. 12 Months).', 'table_name' => 'civicrm_product', 'entity' => 'Product', 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 0, - ) , - 'frequency_unit' => array( + ], + 'frequency_unit' => [ 'name' => 'frequency_unit', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Frequency Unit') , + 'title' => ts('Frequency Unit'), 'description' => 'Frequency unit and interval allow option to store actual delivery frequency for a subscription or service.', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -442,56 +439,60 @@ static function &fields() { 'entity' => 'Product', 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getPremiumUnits', - ) - ) , - 'frequency_interval' => array( + ] + ], + 'frequency_interval' => [ 'name' => 'frequency_interval', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Frequency Interval') , + 'title' => ts('Frequency Interval'), 'description' => 'Number of units for delivery frequency of subscription, service, membership (e.g. every 3 Months).', 'table_name' => 'civicrm_product', 'entity' => 'Product', 'bao' => 'CRM_Contribute_DAO_Product', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -499,10 +500,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'product', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'product', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -510,15 +512,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'product', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'product', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Contribute/DAO/Widget.php b/CRM/Contribute/DAO/Widget.php index 3c57207f2efd..63394c305f8d 100644 --- a/CRM/Contribute/DAO/Widget.php +++ b/CRM/Contribute/DAO/Widget.php @@ -1,29 +1,5 @@ __table = 'civicrm_contribution_widget'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_page_id', 'civicrm_contribution_page', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_page_id', 'civicrm_contribution_page', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Widget ID') , + 'title' => ts('Widget ID'), 'description' => 'Contribution Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_contribution_widget', 'entity' => 'Widget', 'bao' => 'CRM_Contribute_BAO_Widget', 'localizable' => 0, - ) , - 'contribution_page_id' => array( + ], + 'contribution_page_id' => [ 'name' => 'contribution_page_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contribution Page') , + 'title' => ts('Contribution Page'), 'description' => 'The Contribution Page which triggered this contribution', 'table_name' => 'civicrm_contribution_widget', 'entity' => 'Widget', 'bao' => 'CRM_Contribute_BAO_Widget', 'localizable' => 0, 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage', - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Enabled?') , + 'title' => ts('Enabled?'), 'description' => 'Is this property active?', 'table_name' => 'civicrm_contribution_widget', 'entity' => 'Widget', 'bao' => 'CRM_Contribute_BAO_Widget', 'localizable' => 0, - ) , - 'title' => array( + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Widget Title') , + 'title' => ts('Widget Title'), 'description' => 'Widget title.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -215,11 +203,11 @@ static function &fields() { 'entity' => 'Widget', 'bao' => 'CRM_Contribute_BAO_Widget', 'localizable' => 0, - ) , - 'url_logo' => array( + ], + 'url_logo' => [ 'name' => 'url_logo', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Widget Image Url') , + 'title' => ts('Widget Image Url'), 'description' => 'URL to Widget logo', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -227,11 +215,11 @@ static function &fields() { 'entity' => 'Widget', 'bao' => 'CRM_Contribute_BAO_Widget', 'localizable' => 0, - ) , - 'button_title' => array( + ], + 'button_title' => [ 'name' => 'button_title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Button Title') , + 'title' => ts('Button Title'), 'description' => 'Button title.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -239,21 +227,21 @@ static function &fields() { 'entity' => 'Widget', 'bao' => 'CRM_Contribute_BAO_Widget', 'localizable' => 0, - ) , - 'about' => array( + ], + 'about' => [ 'name' => 'about', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Description') , + 'title' => ts('Description'), 'description' => 'About description.', 'table_name' => 'civicrm_contribution_widget', 'entity' => 'Widget', 'bao' => 'CRM_Contribute_BAO_Widget', 'localizable' => 0, - ) , - 'url_homepage' => array( + ], + 'url_homepage' => [ 'name' => 'url_homepage', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Homepage Url') , + 'title' => ts('Homepage Url'), 'description' => 'URL to Homepage.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -261,139 +249,143 @@ static function &fields() { 'entity' => 'Widget', 'bao' => 'CRM_Contribute_BAO_Widget', 'localizable' => 0, - ) , - 'color_title' => array( + ], + 'color_title' => [ 'name' => 'color_title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Title Color') , + 'title' => ts('Title Color'), 'maxlength' => 10, 'size' => CRM_Utils_Type::TWELVE, 'table_name' => 'civicrm_contribution_widget', 'entity' => 'Widget', 'bao' => 'CRM_Contribute_BAO_Widget', 'localizable' => 0, - ) , - 'color_button' => array( + ], + 'color_button' => [ 'name' => 'color_button', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Button Colour') , + 'title' => ts('Button Colour'), 'maxlength' => 10, 'size' => CRM_Utils_Type::TWELVE, 'table_name' => 'civicrm_contribution_widget', 'entity' => 'Widget', 'bao' => 'CRM_Contribute_BAO_Widget', 'localizable' => 0, - ) , - 'color_bar' => array( + ], + 'color_bar' => [ 'name' => 'color_bar', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Bar Color') , + 'title' => ts('Bar Color'), 'maxlength' => 10, 'size' => CRM_Utils_Type::TWELVE, 'table_name' => 'civicrm_contribution_widget', 'entity' => 'Widget', 'bao' => 'CRM_Contribute_BAO_Widget', 'localizable' => 0, - ) , - 'color_main_text' => array( + ], + 'color_main_text' => [ 'name' => 'color_main_text', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Main Text Color') , + 'title' => ts('Main Text Color'), 'maxlength' => 10, 'size' => CRM_Utils_Type::TWELVE, 'table_name' => 'civicrm_contribution_widget', 'entity' => 'Widget', 'bao' => 'CRM_Contribute_BAO_Widget', 'localizable' => 0, - ) , - 'color_main' => array( + ], + 'color_main' => [ 'name' => 'color_main', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Main Colour') , + 'title' => ts('Main Colour'), 'maxlength' => 10, 'size' => CRM_Utils_Type::TWELVE, 'table_name' => 'civicrm_contribution_widget', 'entity' => 'Widget', 'bao' => 'CRM_Contribute_BAO_Widget', 'localizable' => 0, - ) , - 'color_main_bg' => array( + ], + 'color_main_bg' => [ 'name' => 'color_main_bg', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Backgroup Color') , + 'title' => ts('Backgroup Color'), 'maxlength' => 10, 'size' => CRM_Utils_Type::TWELVE, 'table_name' => 'civicrm_contribution_widget', 'entity' => 'Widget', 'bao' => 'CRM_Contribute_BAO_Widget', 'localizable' => 0, - ) , - 'color_bg' => array( + ], + 'color_bg' => [ 'name' => 'color_bg', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Other Backgroun Colour') , + 'title' => ts('Other Backgroun Colour'), 'maxlength' => 10, 'size' => CRM_Utils_Type::TWELVE, 'table_name' => 'civicrm_contribution_widget', 'entity' => 'Widget', 'bao' => 'CRM_Contribute_BAO_Widget', 'localizable' => 0, - ) , - 'color_about_link' => array( + ], + 'color_about_link' => [ 'name' => 'color_about_link', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('About Link Colour') , + 'title' => ts('About Link Colour'), 'maxlength' => 10, 'size' => CRM_Utils_Type::TWELVE, 'table_name' => 'civicrm_contribution_widget', 'entity' => 'Widget', 'bao' => 'CRM_Contribute_BAO_Widget', 'localizable' => 0, - ) , - 'color_homepage_link' => array( + ], + 'color_homepage_link' => [ 'name' => 'color_homepage_link', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Homepage Link Colour') , + 'title' => ts('Homepage Link Colour'), 'maxlength' => 10, 'size' => CRM_Utils_Type::TWELVE, 'table_name' => 'civicrm_contribution_widget', 'entity' => 'Widget', 'bao' => 'CRM_Contribute_BAO_Widget', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -401,10 +393,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_widget', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_widget', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -412,15 +405,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_widget', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_widget', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/CodeGen/BaseTask.php b/CRM/Core/CodeGen/BaseTask.php index 83fcf1a410d0..c58a32ac15aa 100644 --- a/CRM/Core/CodeGen/BaseTask.php +++ b/CRM/Core/CodeGen/BaseTask.php @@ -73,13 +73,11 @@ protected static function extractRegex($file, $regex) { * @return bool */ protected function isApproxPhpMatch($actual, $expected) { - $actual = preg_replace(';\(GenCodeChecksum:([a-zA-Z0-9]+)\);', '', $actual); - $actual = preg_replace(';[ \r\n\t];', '', $actual); - - $expected = preg_replace(';\(GenCodeChecksum:([a-zA-Z0-9]+)\);', '', - $expected); - $expected = preg_replace(';[ \r\n\t];', '', $expected); - + foreach (['actual', 'expected'] as $var) { + $$var = CRM_Core_CodeGen_Util_ArraySyntaxConverter::convert($$var); + $$var = preg_replace(';\(GenCodeChecksum:([a-zA-Z0-9]+)\);', '', $$var); + $$var = strtolower(preg_replace(';[ \r\n\t];', '', $$var)); + } return $actual === $expected; } diff --git a/CRM/Core/CodeGen/Util/ArraySyntaxConverter.php b/CRM/Core/CodeGen/Util/ArraySyntaxConverter.php new file mode 100644 index 000000000000..5554c6b45140 --- /dev/null +++ b/CRM/Core/CodeGen/Util/ArraySyntaxConverter.php @@ -0,0 +1,92 @@ + + */ +class CRM_Core_CodeGen_Util_ArraySyntaxConverter { + + /** + * @param string $code + * @return string + */ + public static function convert($code) { + $tokens = token_get_all($code); + + // - - - - - PARSE CODE - - - - - + $replacements = array(); + $offset = 0; + for ($i = 0; $i < count($tokens); ++$i) { + // Keep track of the current byte offset in the source code + $offset += strlen(is_array($tokens[$i]) ? $tokens[$i][1] : $tokens[$i]); + // T_ARRAY could either mean the "array(...)" syntax we're looking for + // or a type hinting statement ("function(array $foo) { ... }") + if (is_array($tokens[$i]) && $tokens[$i][0] === T_ARRAY) { + // Look for a subsequent opening bracket ("(") to be sure we're actually + // looking at an "array(...)" statement + $isArraySyntax = FALSE; + $subOffset = $offset; + for ($j = $i + 1; $j < count($tokens); ++$j) { + $subOffset += strlen(is_array($tokens[$j]) ? $tokens[$j][1] : $tokens[$j]); + if (is_string($tokens[$j]) && $tokens[$j] == '(') { + $isArraySyntax = TRUE; + break; + } + elseif (!is_array($tokens[$j]) || $tokens[$j][0] !== T_WHITESPACE) { + $isArraySyntax = FALSE; + break; + } + } + if ($isArraySyntax) { + // Replace "array" and the opening bracket (including preceeding whitespace) with "[" + $replacements[] = array( + 'start' => $offset - strlen($tokens[$i][1]), + 'end' => $subOffset, + 'string' => '[', + ); + // Look for matching closing bracket (")") + $subOffset = $offset; + $openBracketsCount = 0; + for ($j = $i + 1; $j < count($tokens); ++$j) { + $subOffset += strlen(is_array($tokens[$j]) ? $tokens[$j][1] : $tokens[$j]); + if (is_string($tokens[$j]) && $tokens[$j] == '(') { + ++$openBracketsCount; + } + elseif (is_string($tokens[$j]) && $tokens[$j] == ')') { + --$openBracketsCount; + if ($openBracketsCount == 0) { + // Replace ")" with "]" + $replacements[] = array( + 'start' => $subOffset - 1, + 'end' => $subOffset, + 'string' => ']', + ); + break; + } + } + } + } + } + } + + // - - - - - UPDATE CODE - - - - - + // Apply the replacements to the source code + $offsetChange = 0; + foreach ($replacements as $replacement) { + $code = substr_replace( + $code, + $replacement['string'], + $replacement['start'] + $offsetChange, + $replacement['end'] - $replacement['start'] + ); + $offsetChange += strlen($replacement['string']) - ($replacement['end'] - $replacement['start']); + } + + return $code; + } + +} diff --git a/CRM/Core/CodeGen/Util/Template.php b/CRM/Core/CodeGen/Util/Template.php index b7d2bf00019e..e5a7ea36923f 100644 --- a/CRM/Core/CodeGen/Util/Template.php +++ b/CRM/Core/CodeGen/Util/Template.php @@ -25,7 +25,6 @@ public function __construct($filetype) { $this->beautifier = new PHP_Beautifier(); $this->beautifier->addFilter('ArrayNested'); // add one or more filters - $this->beautifier->addFilter('NewLines', array('after' => 'class, public, require, comment')); $this->beautifier->setIndentChar(' '); $this->beautifier->setIndentNumber(2); $this->beautifier->setNewLine("\n"); @@ -57,16 +56,27 @@ public function runConcat($inputs, $outpath) { * Full path to the desired output file. */ public function run($infile, $outpath) { - $renderedContents = $this->smarty->fetch($infile); + $contents = $this->smarty->fetch($infile); if ($this->filetype === 'php') { - $this->beautifier->setInputString($renderedContents); - $this->beautifier->setOutputFile($outpath); + $this->beautifier->setInputString($contents); $this->beautifier->process(); - $this->beautifier->save(); + $contents = $this->beautifier->get(); + // The beautifier isn't as beautiful as one would hope. Here's some extra string fudging. + $replacements = [ + ') ,' => '),', + "\n }\n}\n" => "\n }\n\n}\n", + '=> true,' => '=> TRUE,', + '=> false,' => '=> FALSE,', + ]; + $contents = str_replace(array_keys($replacements), array_values($replacements), $contents); + $contents = preg_replace('#(\s*)\\/\\*\\*#', "\n\$1/**", $contents); + // Convert old array syntax to new square brackets + $contents = CRM_Core_CodeGen_Util_ArraySyntaxConverter::convert($contents); + file_put_contents($outpath, $contents); } else { - file_put_contents($outpath, $renderedContents); + file_put_contents($outpath, $contents); } } diff --git a/CRM/Core/DAO/ActionLog.php b/CRM/Core/DAO/ActionLog.php index 56f97ac0141e..9b3caefb5e2f 100644 --- a/CRM/Core/DAO/ActionLog.php +++ b/CRM/Core/DAO/ActionLog.php @@ -1,29 +1,5 @@ __table = 'civicrm_action_log'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'action_schedule_id', 'civicrm_action_schedule', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'action_schedule_id', 'civicrm_action_schedule', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Action Schedule ID') , - 'required' => true, + 'title' => ts('Action Schedule ID'), + 'required' => TRUE, 'table_name' => 'civicrm_action_log', 'entity' => 'ActionLog', 'bao' => 'CRM_Core_BAO_ActionLog', 'localizable' => 0, - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Action Schedule Contact ID') , + 'title' => ts('Action Schedule Contact ID'), 'description' => 'FK to Contact ID', 'table_name' => 'civicrm_action_log', 'entity' => 'ActionLog', 'bao' => 'CRM_Core_BAO_ActionLog', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity ID') , + 'title' => ts('Entity ID'), 'description' => 'FK to id of the entity that the action was performed on. Pseudo - FK.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_action_log', 'entity' => 'ActionLog', 'bao' => 'CRM_Core_BAO_ActionLog', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Table') , + 'title' => ts('Entity Table'), 'description' => 'name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -183,103 +172,107 @@ static function &fields() { 'entity' => 'ActionLog', 'bao' => 'CRM_Core_BAO_ActionLog', 'localizable' => 0, - ) , - 'action_schedule_id' => array( + ], + 'action_schedule_id' => [ 'name' => 'action_schedule_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Schedule') , + 'title' => ts('Schedule'), 'description' => 'FK to the action schedule that this action originated from.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_action_log', 'entity' => 'ActionLog', 'bao' => 'CRM_Core_BAO_ActionLog', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_ActionSchedule', - ) , - 'action_date_time' => array( + ], + 'action_date_time' => [ 'name' => 'action_date_time', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Action Date And Time') , + 'title' => ts('Action Date And Time'), 'description' => 'date time that the action was performed on.', 'table_name' => 'civicrm_action_log', 'entity' => 'ActionLog', 'bao' => 'CRM_Core_BAO_ActionLog', 'localizable' => 0, - ) , - 'is_error' => array( + ], + 'is_error' => [ 'name' => 'is_error', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Error?') , + 'title' => ts('Error?'), 'description' => 'Was there any error sending the reminder?', 'table_name' => 'civicrm_action_log', 'entity' => 'ActionLog', 'bao' => 'CRM_Core_BAO_ActionLog', 'localizable' => 0, - ) , - 'message' => array( + ], + 'message' => [ 'name' => 'message', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Message') , + 'title' => ts('Message'), 'description' => 'Description / text in case there was an error encountered.', 'table_name' => 'civicrm_action_log', 'entity' => 'ActionLog', 'bao' => 'CRM_Core_BAO_ActionLog', 'localizable' => 0, - ) , - 'repetition_number' => array( + ], + 'repetition_number' => [ 'name' => 'repetition_number', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Repetition Number') , + 'title' => ts('Repetition Number'), 'description' => 'Keeps track of the sequence number of this repetition.', 'table_name' => 'civicrm_action_log', 'entity' => 'ActionLog', 'bao' => 'CRM_Core_BAO_ActionLog', 'localizable' => 0, - ) , - 'reference_date' => array( + ], + 'reference_date' => [ 'name' => 'reference_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Reference Date') , + 'title' => ts('Reference Date'), 'description' => 'Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)', 'default' => 'NULL', 'table_name' => 'civicrm_action_log', 'entity' => 'ActionLog', 'bao' => 'CRM_Core_BAO_ActionLog', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -287,10 +280,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'action_log', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'action_log', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -298,15 +292,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'action_log', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'action_log', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/ActionMapping.php b/CRM/Core/DAO/ActionMapping.php index c4e538756007..c45168dca9a4 100644 --- a/CRM/Core/DAO/ActionMapping.php +++ b/CRM/Core/DAO/ActionMapping.php @@ -1,29 +1,5 @@ __table = 'civicrm_action_mapping'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Action Mapping ID') , - 'required' => true, + 'title' => ts('Action Mapping ID'), + 'required' => TRUE, 'table_name' => 'civicrm_action_mapping', 'entity' => 'ActionMapping', 'bao' => 'CRM_Core_DAO_ActionMapping', 'localizable' => 0, - ) , - 'entity' => array( + ], + 'entity' => [ 'name' => 'entity', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Action Mapping Entity') , + 'title' => ts('Action Mapping Entity'), 'description' => 'Entity for which the reminder is created', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -139,11 +126,11 @@ static function &fields() { 'entity' => 'ActionMapping', 'bao' => 'CRM_Core_DAO_ActionMapping', 'localizable' => 0, - ) , - 'entity_value' => array( + ], + 'entity_value' => [ 'name' => 'entity_value', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Action Mapping Entity Value') , + 'title' => ts('Action Mapping Entity Value'), 'description' => 'Entity value', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -151,11 +138,11 @@ static function &fields() { 'entity' => 'ActionMapping', 'bao' => 'CRM_Core_DAO_ActionMapping', 'localizable' => 0, - ) , - 'entity_value_label' => array( + ], + 'entity_value_label' => [ 'name' => 'entity_value_label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Value Label') , + 'title' => ts('Value Label'), 'description' => 'Entity value label', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -163,11 +150,11 @@ static function &fields() { 'entity' => 'ActionMapping', 'bao' => 'CRM_Core_DAO_ActionMapping', 'localizable' => 0, - ) , - 'entity_status' => array( + ], + 'entity_status' => [ 'name' => 'entity_status', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Status') , + 'title' => ts('Status'), 'description' => 'Entity status', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -175,11 +162,11 @@ static function &fields() { 'entity' => 'ActionMapping', 'bao' => 'CRM_Core_DAO_ActionMapping', 'localizable' => 0, - ) , - 'entity_status_label' => array( + ], + 'entity_status_label' => [ 'name' => 'entity_status_label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Status Label') , + 'title' => ts('Status Label'), 'description' => 'Entity status label', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -187,11 +174,11 @@ static function &fields() { 'entity' => 'ActionMapping', 'bao' => 'CRM_Core_DAO_ActionMapping', 'localizable' => 0, - ) , - 'entity_date_start' => array( + ], + 'entity_date_start' => [ 'name' => 'entity_date_start', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Start Date') , + 'title' => ts('Entity Start Date'), 'description' => 'Entity date', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -199,11 +186,11 @@ static function &fields() { 'entity' => 'ActionMapping', 'bao' => 'CRM_Core_DAO_ActionMapping', 'localizable' => 0, - ) , - 'entity_date_end' => array( + ], + 'entity_date_end' => [ 'name' => 'entity_date_end', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity End Date') , + 'title' => ts('Entity End Date'), 'description' => 'Entity date', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -211,11 +198,11 @@ static function &fields() { 'entity' => 'ActionMapping', 'bao' => 'CRM_Core_DAO_ActionMapping', 'localizable' => 0, - ) , - 'entity_recipient' => array( + ], + 'entity_recipient' => [ 'name' => 'entity_recipient', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Recipient') , + 'title' => ts('Entity Recipient'), 'description' => 'Entity recipient', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -223,40 +210,44 @@ static function &fields() { 'entity' => 'ActionMapping', 'bao' => 'CRM_Core_DAO_ActionMapping', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -264,10 +255,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'action_mapping', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'action_mapping', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -275,15 +267,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'action_mapping', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'action_mapping', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/ActionSchedule.php b/CRM/Core/DAO/ActionSchedule.php index 492e8775fc20..e2a8df42484f 100644 --- a/CRM/Core/DAO/ActionSchedule.php +++ b/CRM/Core/DAO/ActionSchedule.php @@ -1,29 +1,5 @@ __table = 'civicrm_action_schedule'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'group_id', 'civicrm_group', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'msg_template_id', 'civicrm_msg_template', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'sms_template_id', 'civicrm_msg_template', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'sms_provider_id', 'civicrm_sms_provider', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'group_id', 'civicrm_group', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'msg_template_id', 'civicrm_msg_template', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'sms_template_id', 'civicrm_msg_template', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'sms_provider_id', 'civicrm_sms_provider', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Action Schedule ID') , - 'required' => true, + 'title' => ts('Action Schedule ID'), + 'required' => TRUE, 'table_name' => 'civicrm_action_schedule', 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Name') , + 'title' => ts('Name'), 'description' => 'Name of the action(reminder)', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -328,11 +343,11 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'title' => array( + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Title') , + 'title' => ts('Title'), 'description' => 'Title of the action(reminder)', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -340,11 +355,11 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'recipient' => array( + ], + 'recipient' => [ 'name' => 'recipient', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Recipient') , + 'title' => ts('Recipient'), 'description' => 'Recipient', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -352,21 +367,21 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'limit_to' => array( + ], + 'limit_to' => [ 'name' => 'limit_to', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Limit To') , + 'title' => ts('Limit To'), 'description' => 'Is this the recipient criteria limited to OR in addition to?', 'table_name' => 'civicrm_action_schedule', 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'entity_value' => array( + ], + 'entity_value' => [ 'name' => 'entity_value', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Value') , + 'title' => ts('Entity Value'), 'description' => 'Entity value', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -374,11 +389,11 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'entity_status' => array( + ], + 'entity_status' => [ 'name' => 'entity_status', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Status') , + 'title' => ts('Entity Status'), 'description' => 'Entity status', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -386,21 +401,21 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'start_action_offset' => array( + ], + 'start_action_offset' => [ 'name' => 'start_action_offset', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Start Action Offset') , + 'title' => ts('Start Action Offset'), 'description' => 'Reminder Interval.', 'table_name' => 'civicrm_action_schedule', 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'start_action_unit' => array( + ], + 'start_action_unit' => [ 'name' => 'start_action_unit', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Start Action Unit') , + 'title' => ts('Start Action Unit'), 'description' => 'Time units for reminder.', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -408,17 +423,17 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getRecurringFrequencyUnits', - ) - ) , - 'start_action_condition' => array( + ] + ], + 'start_action_condition' => [ 'name' => 'start_action_condition', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Start Action Condition') , + 'title' => ts('Start Action Condition'), 'description' => 'Reminder Action', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -426,11 +441,11 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'start_action_date' => array( + ], + 'start_action_date' => [ 'name' => 'start_action_date', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Start Action Date') , + 'title' => ts('Start Action Date'), 'description' => 'Entity date', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -438,20 +453,20 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'is_repeat' => array( + ], + 'is_repeat' => [ 'name' => 'is_repeat', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Repeat?') , + 'title' => ts('Repeat?'), 'table_name' => 'civicrm_action_schedule', 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'repetition_frequency_unit' => array( + ], + 'repetition_frequency_unit' => [ 'name' => 'repetition_frequency_unit', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Repetition Frequency Unit') , + 'title' => ts('Repetition Frequency Unit'), 'description' => 'Time units for repetition of reminder.', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -459,27 +474,27 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getRecurringFrequencyUnits', - ) - ) , - 'repetition_frequency_interval' => array( + ] + ], + 'repetition_frequency_interval' => [ 'name' => 'repetition_frequency_interval', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Repetition Frequency Interval') , + 'title' => ts('Repetition Frequency Interval'), 'description' => 'Time interval for repeating the reminder.', 'table_name' => 'civicrm_action_schedule', 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'end_frequency_unit' => array( + ], + 'end_frequency_unit' => [ 'name' => 'end_frequency_unit', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('End Frequency Unit') , + 'title' => ts('End Frequency Unit'), 'description' => 'Time units till repetition of reminder.', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -487,27 +502,27 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getRecurringFrequencyUnits', - ) - ) , - 'end_frequency_interval' => array( + ] + ], + 'end_frequency_interval' => [ 'name' => 'end_frequency_interval', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('End Frequency Interval') , + 'title' => ts('End Frequency Interval'), 'description' => 'Time interval till repeating the reminder.', 'table_name' => 'civicrm_action_schedule', 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'end_action' => array( + ], + 'end_action' => [ 'name' => 'end_action', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('End Action') , + 'title' => ts('End Action'), 'description' => 'Reminder Action till repeating the reminder.', 'maxlength' => 32, 'size' => CRM_Utils_Type::MEDIUM, @@ -515,11 +530,11 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'end_date' => array( + ], + 'end_date' => [ 'name' => 'end_date', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('End Date') , + 'title' => ts('End Date'), 'description' => 'Entity end date', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -527,22 +542,22 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Schedule is Active?') , + 'title' => ts('Schedule is Active?'), 'description' => 'Is this option active?', 'default' => '1', 'table_name' => 'civicrm_action_schedule', 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'recipient_manual' => array( + ], + 'recipient_manual' => [ 'name' => 'recipient_manual', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Recipient Manual') , + 'title' => ts('Recipient Manual'), 'description' => 'Contact IDs to which reminder should be sent.', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -550,11 +565,11 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'recipient_listing' => array( + ], + 'recipient_listing' => [ 'name' => 'recipient_listing', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Recipient Listing') , + 'title' => ts('Recipient Listing'), 'description' => 'listing based on recipient field.', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -562,41 +577,41 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'body_text' => array( + ], + 'body_text' => [ 'name' => 'body_text', 'type' => CRM_Utils_Type::T_LONGTEXT, - 'title' => ts('Reminder Text') , + 'title' => ts('Reminder Text'), 'description' => 'Body of the mailing in text format.', 'table_name' => 'civicrm_action_schedule', 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'body_html' => array( + ], + 'body_html' => [ 'name' => 'body_html', 'type' => CRM_Utils_Type::T_LONGTEXT, - 'title' => ts('Reminder HTML') , + 'title' => ts('Reminder HTML'), 'description' => 'Body of the mailing in html format.', 'table_name' => 'civicrm_action_schedule', 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'sms_body_text' => array( + ], + 'sms_body_text' => [ 'name' => 'sms_body_text', 'type' => CRM_Utils_Type::T_LONGTEXT, - 'title' => ts('SMS Reminder Text') , + 'title' => ts('SMS Reminder Text'), 'description' => 'Content of the SMS text.', 'table_name' => 'civicrm_action_schedule', 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'subject' => array( + ], + 'subject' => [ 'name' => 'subject', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Reminder Subject') , + 'title' => ts('Reminder Subject'), 'description' => 'Subject of mailing', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -604,22 +619,22 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'record_activity' => array( + ], + 'record_activity' => [ 'name' => 'record_activity', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Record Activity for Reminder?') , + 'title' => ts('Record Activity for Reminder?'), 'description' => 'Record Activity for this reminder?', 'default' => 'NULL', 'table_name' => 'civicrm_action_schedule', 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'mapping_id' => array( + ], + 'mapping_id' => [ 'name' => 'mapping_id', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Reminder Mapping') , + 'title' => ts('Reminder Mapping'), 'description' => 'Name/ID of the mapping to use on this table', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -627,62 +642,62 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'group_id' => array( + ], + 'group_id' => [ 'name' => 'group_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Reminder Group') , + 'title' => ts('Reminder Group'), 'description' => 'FK to Group', 'table_name' => 'civicrm_action_schedule', 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Group', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'msg_template_id' => array( + ] + ], + 'msg_template_id' => [ 'name' => 'msg_template_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Reminder Template') , + 'title' => ts('Reminder Template'), 'description' => 'FK to the message template.', 'table_name' => 'civicrm_action_schedule', 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_MessageTemplate', - ) , - 'sms_template_id' => array( + ], + 'sms_template_id' => [ 'name' => 'sms_template_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('SMS Reminder Template') , + 'title' => ts('SMS Reminder Template'), 'description' => 'FK to the message template.', 'table_name' => 'civicrm_action_schedule', 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_MessageTemplate', - ) , - 'absolute_date' => array( + ], + 'absolute_date' => [ 'name' => 'absolute_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Fixed Date for Reminder') , + 'title' => ts('Fixed Date for Reminder'), 'description' => 'Date on which the reminder be sent.', 'table_name' => 'civicrm_action_schedule', 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'from_name' => array( + ], + 'from_name' => [ 'name' => 'from_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Reminder from Name') , + 'title' => ts('Reminder from Name'), 'description' => 'Name in "from" field', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -690,11 +705,11 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'from_email' => array( + ], + 'from_email' => [ 'name' => 'from_email', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Reminder From Email') , + 'title' => ts('Reminder From Email'), 'description' => 'Email address in "from" field', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -702,11 +717,11 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'mode' => array( + ], + 'mode' => [ 'name' => 'mode', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Message Mode') , + 'title' => ts('Message Mode'), 'description' => 'Send the message as email or sms or both.', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -715,31 +730,31 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'msg_mode', 'optionEditPath' => 'civicrm/admin/options/msg_mode', - ) - ) , - 'sms_provider_id' => array( + ] + ], + 'sms_provider_id' => [ 'name' => 'sms_provider_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('SMS Provider') , + 'title' => ts('SMS Provider'), 'table_name' => 'civicrm_action_schedule', 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, 'FKClassName' => 'CRM_SMS_DAO_Provider', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - ) , - 'used_for' => array( + ], + ], + 'used_for' => [ 'name' => 'used_for', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Used For') , + 'title' => ts('Used For'), 'description' => 'Used for repeating entity', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -747,11 +762,11 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'filter_contact_language' => array( + ], + 'filter_contact_language' => [ 'name' => 'filter_contact_language', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Filter Contact Language') , + 'title' => ts('Filter Contact Language'), 'description' => 'Used for multilingual installation', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -759,11 +774,11 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - 'communication_language' => array( + ], + 'communication_language' => [ 'name' => 'communication_language', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Communication Language') , + 'title' => ts('Communication Language'), 'description' => 'Used for multilingual installation', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -771,40 +786,44 @@ static function &fields() { 'entity' => 'ActionSchedule', 'bao' => 'CRM_Core_BAO_ActionSchedule', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -812,10 +831,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'action_schedule', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'action_schedule', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -823,15 +843,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'action_schedule', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'action_schedule', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Address.php b/CRM/Core/DAO/Address.php index 924980b4654f..462cb832a887 100644 --- a/CRM/Core/DAO/Address.php +++ b/CRM/Core/DAO/Address.php @@ -1,29 +1,5 @@ __table = 'civicrm_address'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'county_id', 'civicrm_county', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'state_province_id', 'civicrm_state_province', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'country_id', 'civicrm_country', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'master_id', 'civicrm_address', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'county_id', 'civicrm_county', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'state_province_id', 'civicrm_state_province', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'country_id', 'civicrm_country', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'master_id', 'civicrm_address', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Address ID') , + 'title' => ts('Address ID'), 'description' => 'Unique Address ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'FK to Contact ID', 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'location_type_id' => array( + ], + 'location_type_id' => [ 'name' => 'location_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Address Location Type') , + 'title' => ts('Address Location Type'), 'description' => 'Which Location does this address belong to.', 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_location_type', 'keyColumn' => 'id', 'labelColumn' => 'display_name', - ) - ) , - 'is_primary' => array( + ] + ], + 'is_primary' => [ 'name' => 'is_primary', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Address Primary?') , + 'title' => ts('Is Address Primary?'), 'description' => 'Is this the primary address.', 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'is_billing' => array( + ], + ], + 'is_billing' => [ 'name' => 'is_billing', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Billing Address') , + 'title' => ts('Is Billing Address'), 'description' => 'Is this the billing address.', 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'street_address' => array( + ], + ], + 'street_address' => [ 'name' => 'street_address', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Street Address') , + 'title' => ts('Street Address'), 'description' => 'Concatenation of all routable street address components (prefix, street number, street name, suffix, unit number OR P.O. Box). Apps should be able to determine physical location with this data (for mapping, mail delivery, etc.). ', 'maxlength' => 96, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_address.street_address', 'headerPattern' => '/(street|address)/i', 'dataPattern' => '/^(\d{1,5}( [0-9A-Za-z]+)+)$|^(P\.?O\.\? Box \d{1,5})$/i', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'street_number' => array( + ], + ], + 'street_number' => [ 'name' => 'street_number', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Street Number') , + 'title' => ts('Street Number'), 'description' => 'Numeric portion of address number on the street, e.g. For 112A Main St, the street_number = 112.', - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_address.street_number', 'headerPattern' => '', 'dataPattern' => '', @@ -360,19 +368,19 @@ static function &fields() { 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'street_number_suffix' => array( + ], + ], + 'street_number_suffix' => [ 'name' => 'street_number_suffix', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Street Number Suffix') , + 'title' => ts('Street Number Suffix'), 'description' => 'Non-numeric portion of address number on the street, e.g. For 112A Main St, the street_number_suffix = A ', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_address.street_number_suffix', 'headerPattern' => '', 'dataPattern' => '', @@ -380,14 +388,14 @@ static function &fields() { 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'street_number_predirectional' => array( + ], + ], + 'street_number_predirectional' => [ 'name' => 'street_number_predirectional', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Street Direction Prefix') , + 'title' => ts('Street Direction Prefix'), 'description' => 'Directional prefix, e.g. SE Main St, SE is the prefix.', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -395,18 +403,18 @@ static function &fields() { 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'street_name' => array( + ], + ], + 'street_name' => [ 'name' => 'street_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Street Name') , + 'title' => ts('Street Name'), 'description' => 'Actual street name, excluding St, Dr, Rd, Ave, e.g. For 112 Main St, the street_name = Main.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_address.street_name', 'headerPattern' => '', 'dataPattern' => '', @@ -414,14 +422,14 @@ static function &fields() { 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'street_type' => array( + ], + ], + 'street_type' => [ 'name' => 'street_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Street Type') , + 'title' => ts('Street Type'), 'description' => 'St, Rd, Dr, etc.', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -429,14 +437,14 @@ static function &fields() { 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'street_number_postdirectional' => array( + ], + ], + 'street_number_postdirectional' => [ 'name' => 'street_number_postdirectional', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Street Direction Suffix') , + 'title' => ts('Street Direction Suffix'), 'description' => 'Directional prefix, e.g. Main St S, S is the suffix.', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -444,18 +452,18 @@ static function &fields() { 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'street_unit' => array( + ], + ], + 'street_unit' => [ 'name' => 'street_unit', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Street Unit') , + 'title' => ts('Street Unit'), 'description' => 'Secondary unit designator, e.g. Apt 3 or Unit # 14, or Bldg 1200', 'maxlength' => 16, 'size' => CRM_Utils_Type::TWELVE, - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_address.street_unit', 'headerPattern' => '', 'dataPattern' => '', @@ -463,172 +471,172 @@ static function &fields() { 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'supplemental_address_1' => array( + ], + ], + 'supplemental_address_1' => [ 'name' => 'supplemental_address_1', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Supplemental Address 1') , + 'title' => ts('Supplemental Address 1'), 'description' => 'Supplemental Address Information, Line 1', 'maxlength' => 96, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_address.supplemental_address_1', 'headerPattern' => '/(supplemental(\s)?)?address(\s\d+)?/i', 'dataPattern' => '/unit|ap(ar)?t(ment)?\s(\d|\w)+/i', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'supplemental_address_2' => array( + ], + ], + 'supplemental_address_2' => [ 'name' => 'supplemental_address_2', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Supplemental Address 2') , + 'title' => ts('Supplemental Address 2'), 'description' => 'Supplemental Address Information, Line 2', 'maxlength' => 96, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_address.supplemental_address_2', 'headerPattern' => '/(supplemental(\s)?)?address(\s\d+)?/i', 'dataPattern' => '/unit|ap(ar)?t(ment)?\s(\d|\w)+/i', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'supplemental_address_3' => array( + ], + ], + 'supplemental_address_3' => [ 'name' => 'supplemental_address_3', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Supplemental Address 3') , + 'title' => ts('Supplemental Address 3'), 'description' => 'Supplemental Address Information, Line 3', 'maxlength' => 96, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_address.supplemental_address_3', 'headerPattern' => '/(supplemental(\s)?)?address(\s\d+)?/i', 'dataPattern' => '/unit|ap(ar)?t(ment)?\s(\d|\w)+/i', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'city' => array( + ], + ], + 'city' => [ 'name' => 'city', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('City') , + 'title' => ts('City'), 'description' => 'City, Town or Village Name.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_address.city', 'headerPattern' => '/city/i', 'dataPattern' => '/^[A-Za-z]+(\.?)(\s?[A-Za-z]+){0,2}$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'county_id' => array( + ], + ], + 'county_id' => [ 'name' => 'county_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('County') , + 'title' => ts('County'), 'description' => 'Which County does this address belong to.', 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_County', - 'html' => array( + 'html' => [ 'type' => 'ChainSelect', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_county', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'state_province_id' => array( + ] + ], + 'state_province_id' => [ 'name' => 'state_province_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('State/Province') , + 'title' => ts('State/Province'), 'description' => 'Which State_Province does this address belong to.', 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_StateProvince', - 'html' => array( + 'html' => [ 'type' => 'ChainSelect', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_state_province', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'postal_code_suffix' => array( + ] + ], + 'postal_code_suffix' => [ 'name' => 'postal_code_suffix', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Postal Code Suffix') , + 'title' => ts('Postal Code Suffix'), 'description' => 'Store the suffix, like the +4 part in the USPS system.', 'maxlength' => 12, 'size' => 3, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_address.postal_code_suffix', 'headerPattern' => '/p(ostal)\sc(ode)\ss(uffix)/i', 'dataPattern' => '/\d?\d{4}(-\d{4})?/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'postal_code' => array( + ], + ], + 'postal_code' => [ 'name' => 'postal_code', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Postal Code') , + 'title' => ts('Postal Code'), 'description' => 'Store both US (zip5) AND international postal codes. App is responsible for country/region appropriate validation.', 'maxlength' => 64, 'size' => 6, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_address.postal_code', 'headerPattern' => '/postal|zip/i', 'dataPattern' => '/\d?\d{4}(-\d{4})?/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'usps_adc' => array( + ], + ], + 'usps_adc' => [ 'name' => 'usps_adc', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('USPS Code') , + 'title' => ts('USPS Code'), 'description' => 'USPS Bulk mailing code.', 'maxlength' => 32, 'size' => CRM_Utils_Type::MEDIUM, @@ -636,80 +644,80 @@ static function &fields() { 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - ) , - 'country_id' => array( + ], + 'country_id' => [ 'name' => 'country_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Country') , + 'title' => ts('Country'), 'description' => 'Which Country does this address belong to.', 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Country', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_country', 'keyColumn' => 'id', 'labelColumn' => 'name', 'nameColumn' => 'iso_code', - ) - ) , - 'geo_code_1' => array( + ] + ], + 'geo_code_1' => [ 'name' => 'geo_code_1', 'type' => CRM_Utils_Type::T_FLOAT, - 'title' => ts('Latitude') , + 'title' => ts('Latitude'), 'description' => 'Latitude', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_address.geo_code_1', 'headerPattern' => '/geo/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'geo_code_2' => array( + ], + ], + 'geo_code_2' => [ 'name' => 'geo_code_2', 'type' => CRM_Utils_Type::T_FLOAT, - 'title' => ts('Longitude') , + 'title' => ts('Longitude'), 'description' => 'Longitude', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_address.geo_code_2', 'headerPattern' => '/geo/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'manual_geo_code' => array( + ], + ], + 'manual_geo_code' => [ 'name' => 'manual_geo_code', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is manually geocoded') , + 'title' => ts('Is manually geocoded'), 'description' => 'Is this a manually entered geo code', 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'timezone' => array( + ], + ], + 'timezone' => [ 'name' => 'timezone', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Timezone') , + 'title' => ts('Timezone'), 'description' => 'Timezone expressed as a UTC offset - e.g. United States CST would be written as "UTC-6".', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -717,78 +725,82 @@ static function &fields() { 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'address_name' => array( + ], + ], + 'address_name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Address Name') , + 'title' => ts('Address Name'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_address.name', 'headerPattern' => '/^location|(l(ocation\s)?name)$/i', 'dataPattern' => '/^\w+$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'master_id' => array( + ], + ], + 'master_id' => [ 'name' => 'master_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Master Address Belongs To') , + 'title' => ts('Master Address Belongs To'), 'description' => 'FK to Address ID', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_address.master_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_address', 'entity' => 'Address', 'bao' => 'CRM_Core_BAO_Address', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Address', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -796,14 +808,15 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'address', $prefix, array( + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'address', $prefix, [ 'CRM_Core_DAO_County', 'CRM_Core_DAO_StateProvince', 'CRM_Core_DAO_Country', - )); + ]); return $r; } + /** * Returns the list of fields that can be exported * @@ -811,60 +824,66 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'address', $prefix, array( + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'address', $prefix, [ 'CRM_Core_DAO_County', 'CRM_Core_DAO_StateProvince', 'CRM_Core_DAO_Country', - )); + ]); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_location_type' => array( + $indices = [ + 'index_location_type' => [ 'name' => 'index_location_type', - 'field' => array( + 'field' => [ 0 => 'location_type_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_address::0::location_type_id', - ) , - 'index_is_primary' => array( + ], + 'index_is_primary' => [ 'name' => 'index_is_primary', - 'field' => array( + 'field' => [ 0 => 'is_primary', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_address::0::is_primary', - ) , - 'index_is_billing' => array( + ], + 'index_is_billing' => [ 'name' => 'index_is_billing', - 'field' => array( + 'field' => [ 0 => 'is_billing', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_address::0::is_billing', - ) , - 'index_street_name' => array( + ], + 'index_street_name' => [ 'name' => 'index_street_name', - 'field' => array( + 'field' => [ 0 => 'street_name', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_address::0::street_name', - ) , - 'index_city' => array( + ], + 'index_city' => [ 'name' => 'index_city', - 'field' => array( + 'field' => [ 0 => 'city', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_address::0::city', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/AddressFormat.php b/CRM/Core/DAO/AddressFormat.php index 0bdaa0e80601..3689bbca190d 100644 --- a/CRM/Core/DAO/AddressFormat.php +++ b/CRM/Core/DAO/AddressFormat.php @@ -1,29 +1,5 @@ __table = 'civicrm_address_format'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Address Format ID') , + 'title' => ts('Address Format ID'), 'description' => 'Address Format Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_address_format', 'entity' => 'AddressFormat', 'bao' => 'CRM_Core_DAO_AddressFormat', 'localizable' => 0, - ) , - 'format' => array( + ], + 'format' => [ 'name' => 'format', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Address Format') , + 'title' => ts('Address Format'), 'description' => 'The format of an address', 'table_name' => 'civicrm_address_format', 'entity' => 'AddressFormat', 'bao' => 'CRM_Core_DAO_AddressFormat', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -138,10 +123,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'address_format', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'address_format', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -149,15 +135,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'address_format', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'address_format', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Cache.php b/CRM/Core/DAO/Cache.php index 805ba4577241..2845d05342dc 100644 --- a/CRM/Core/DAO/Cache.php +++ b/CRM/Core/DAO/Cache.php @@ -1,29 +1,5 @@ __table = 'civicrm_cache'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'component_id', 'civicrm_component', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'component_id', 'civicrm_component', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_cache', 'entity' => 'Cache', 'bao' => 'CRM_Core_BAO_Cache', 'localizable' => 0, - ) , - 'group_name' => array( + ], + 'group_name' => [ 'name' => 'group_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Group Name') , + 'title' => ts('Group Name'), 'description' => 'group name for cache element, useful in cleaning cache elements', - 'required' => true, + 'required' => TRUE, 'maxlength' => 32, 'size' => CRM_Utils_Type::MEDIUM, 'table_name' => 'civicrm_cache', 'entity' => 'Cache', 'bao' => 'CRM_Core_BAO_Cache', 'localizable' => 0, - ) , - 'path' => array( + ], + 'path' => [ 'name' => 'path', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Path') , + 'title' => ts('Path'), 'description' => 'Unique path name for cache element', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -153,18 +139,18 @@ static function &fields() { 'entity' => 'Cache', 'bao' => 'CRM_Core_BAO_Cache', 'localizable' => 0, - ) , - 'data' => array( + ], + 'data' => [ 'name' => 'data', 'type' => CRM_Utils_Type::T_LONGTEXT, - 'title' => ts('Data') , + 'title' => ts('Data'), 'description' => 'data associated with this path', 'table_name' => 'civicrm_cache', 'entity' => 'Cache', 'bao' => 'CRM_Core_BAO_Cache', 'localizable' => 0, - ) , - 'component_id' => array( + ], + 'component_id' => [ 'name' => 'component_id', 'type' => CRM_Utils_Type::T_INT, 'description' => 'Component that this menu item belongs to', @@ -173,71 +159,75 @@ static function &fields() { 'bao' => 'CRM_Core_BAO_Cache', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Component', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_component', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'created_date' => array( + ] + ], + 'created_date' => [ 'name' => 'created_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Created Date') , + 'title' => ts('Created Date'), 'description' => 'When was the cache item created', 'default' => 'CURRENT_TIMESTAMP', 'table_name' => 'civicrm_cache', 'entity' => 'Cache', 'bao' => 'CRM_Core_BAO_Cache', 'localizable' => 0, - ) , - 'expired_date' => array( + ], + 'expired_date' => [ 'name' => 'expired_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Expired Date') , + 'title' => ts('Expired Date'), 'description' => 'When should the cache item expire', - 'required' => false, + 'required' => FALSE, 'default' => 'NULL', 'table_name' => 'civicrm_cache', 'entity' => 'Cache', 'bao' => 'CRM_Core_BAO_Cache', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -245,10 +235,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'cache', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'cache', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -256,27 +247,33 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'cache', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'cache', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_group_path_date' => array( + $indices = [ + 'UI_group_path_date' => [ 'name' => 'UI_group_path_date', - 'field' => array( + 'field' => [ 0 => 'group_name', 1 => 'path', 2 => 'created_date', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_cache::1::group_name::path::created_date', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Component.php b/CRM/Core/DAO/Component.php index 2d9ec940e9fb..f5ac34bcc74c 100644 --- a/CRM/Core/DAO/Component.php +++ b/CRM/Core/DAO/Component.php @@ -1,29 +1,5 @@ __table = 'civicrm_component'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, 'description' => 'Component ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_component', 'entity' => 'Component', 'bao' => 'CRM_Core_DAO_Component', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Component name') , + 'title' => ts('Component name'), 'description' => 'Name of the component.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_component', 'entity' => 'Component', 'bao' => 'CRM_Core_DAO_Component', 'localizable' => 0, - ) , - 'namespace' => array( + ], + 'namespace' => [ 'name' => 'namespace', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Namespace reserved for component.') , + 'title' => ts('Namespace reserved for component.'), 'description' => 'Path to components main directory in a form of a class namespace. ', @@ -120,40 +102,44 @@ static function &fields() { 'entity' => 'Component', 'bao' => 'CRM_Core_DAO_Component', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -161,10 +147,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'component', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'component', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -172,15 +159,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'component', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'component', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Country.php b/CRM/Core/DAO/Country.php index a0c63179920b..a837062a55df 100644 --- a/CRM/Core/DAO/Country.php +++ b/CRM/Core/DAO/Country.php @@ -1,29 +1,5 @@ __table = 'civicrm_country'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'address_format_id', 'civicrm_address_format', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'region_id', 'civicrm_worldregion', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'address_format_id', 'civicrm_address_format', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'region_id', 'civicrm_worldregion', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Country ID') , + 'title' => ts('Country ID'), 'description' => 'Country Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_country', 'entity' => 'Country', 'bao' => 'CRM_Core_BAO_Country', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Country') , + 'title' => ts('Country'), 'description' => 'Country Name', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_country.name', 'headerPattern' => '/country/i', 'dataPattern' => '/^[A-Z][a-z]+\.?(\s+[A-Z][a-z]+){0,3}$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_country', 'entity' => 'Country', 'bao' => 'CRM_Core_BAO_Country', 'localizable' => 0, - ) , - 'iso_code' => array( + ], + 'iso_code' => [ 'name' => 'iso_code', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Country ISO Code') , + 'title' => ts('Country ISO Code'), 'description' => 'ISO Code', 'maxlength' => 2, 'size' => CRM_Utils_Type::TWO, @@ -173,11 +162,11 @@ static function &fields() { 'entity' => 'Country', 'bao' => 'CRM_Core_BAO_Country', 'localizable' => 0, - ) , - 'country_code' => array( + ], + 'country_code' => [ 'name' => 'country_code', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Country Phone Prefix') , + 'title' => ts('Country Phone Prefix'), 'description' => 'National prefix to be used when dialing TO this country.', 'maxlength' => 4, 'size' => CRM_Utils_Type::FOUR, @@ -185,22 +174,22 @@ static function &fields() { 'entity' => 'Country', 'bao' => 'CRM_Core_BAO_Country', 'localizable' => 0, - ) , - 'address_format_id' => array( + ], + 'address_format_id' => [ 'name' => 'address_format_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Address Format') , + 'title' => ts('Address Format'), 'description' => 'Foreign key to civicrm_address_format.id.', 'table_name' => 'civicrm_country', 'entity' => 'Country', 'bao' => 'CRM_Core_BAO_Country', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_AddressFormat', - ) , - 'idd_prefix' => array( + ], + 'idd_prefix' => [ 'name' => 'idd_prefix', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Outgoing Phone Prefix') , + 'title' => ts('Outgoing Phone Prefix'), 'description' => 'International direct dialing prefix from within the country TO another country', 'maxlength' => 4, 'size' => CRM_Utils_Type::FOUR, @@ -208,11 +197,11 @@ static function &fields() { 'entity' => 'Country', 'bao' => 'CRM_Core_BAO_Country', 'localizable' => 0, - ) , - 'ndd_prefix' => array( + ], + 'ndd_prefix' => [ 'name' => 'ndd_prefix', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Area Code') , + 'title' => ts('Area Code'), 'description' => 'Access prefix to call within a country to a different area', 'maxlength' => 4, 'size' => CRM_Utils_Type::FOUR, @@ -220,62 +209,66 @@ static function &fields() { 'entity' => 'Country', 'bao' => 'CRM_Core_BAO_Country', 'localizable' => 0, - ) , - 'region_id' => array( + ], + 'region_id' => [ 'name' => 'region_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Region') , + 'title' => ts('Region'), 'description' => 'Foreign key to civicrm_worldregion.id.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_country', 'entity' => 'Country', 'bao' => 'CRM_Core_BAO_Country', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Worldregion', - ) , - 'is_province_abbreviated' => array( + ], + 'is_province_abbreviated' => [ 'name' => 'is_province_abbreviated', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Abbreviate Province?') , + 'title' => ts('Abbreviate Province?'), 'description' => 'Should state/province be displayed as abbreviation for contacts from this country?', 'table_name' => 'civicrm_country', 'entity' => 'Country', 'bao' => 'CRM_Core_BAO_Country', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -283,10 +276,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'country', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'country', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -294,26 +288,32 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'country', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'country', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_name_iso_code' => array( + $indices = [ + 'UI_name_iso_code' => [ 'name' => 'UI_name_iso_code', - 'field' => array( + 'field' => [ 0 => 'name', 1 => 'iso_code', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_country::1::name::iso_code', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/County.php b/CRM/Core/DAO/County.php index 833e19e120d7..e1e686db8f27 100644 --- a/CRM/Core/DAO/County.php +++ b/CRM/Core/DAO/County.php @@ -1,29 +1,5 @@ __table = 'civicrm_county'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'state_province_id', 'civicrm_state_province', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'state_province_id', 'civicrm_state_province', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('County ID') , + 'title' => ts('County ID'), 'description' => 'County ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_county', 'entity' => 'County', 'bao' => 'CRM_Core_DAO_County', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('County') , + 'title' => ts('County'), 'description' => 'Name of County', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_county.name', 'headerPattern' => '/county/i', 'dataPattern' => '/[A-Z]{2}/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_county', 'entity' => 'County', 'bao' => 'CRM_Core_DAO_County', 'localizable' => 0, - ) , - 'abbreviation' => array( + ], + 'abbreviation' => [ 'name' => 'abbreviation', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('County Abbreviation') , + 'title' => ts('County Abbreviation'), 'description' => '2-4 Character Abbreviation of County', 'maxlength' => 4, 'size' => CRM_Utils_Type::FOUR, @@ -142,52 +126,56 @@ static function &fields() { 'entity' => 'County', 'bao' => 'CRM_Core_DAO_County', 'localizable' => 0, - ) , - 'state_province_id' => array( + ], + 'state_province_id' => [ 'name' => 'state_province_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('State') , + 'title' => ts('State'), 'description' => 'ID of State/Province that County belongs', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_county', 'entity' => 'County', 'bao' => 'CRM_Core_DAO_County', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_StateProvince', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -195,10 +183,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'county', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'county', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -206,26 +195,32 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'county', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'county', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_name_state_id' => array( + $indices = [ + 'UI_name_state_id' => [ 'name' => 'UI_name_state_id', - 'field' => array( + 'field' => [ 0 => 'name', 1 => 'state_province_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_county::1::name::state_province_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/CustomField.php b/CRM/Core/DAO/CustomField.php index 973f23a734f1..42f04e959fca 100644 --- a/CRM/Core/DAO/CustomField.php +++ b/CRM/Core/DAO/CustomField.php @@ -1,29 +1,5 @@ __table = 'civicrm_custom_field'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'custom_group_id', 'civicrm_custom_group', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'custom_group_id', 'civicrm_custom_group', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Custom Field ID') , + 'title' => ts('Custom Field ID'), 'description' => 'Unique Custom Field ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'custom_group_id' => array( + ], + 'custom_group_id' => [ 'name' => 'custom_group_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Custom Group') , + 'title' => ts('Custom Group'), 'description' => 'FK to civicrm_custom_group.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_CustomGroup', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_custom_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'name' => array( + ] + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Custom Field Name') , + 'title' => ts('Custom Field Name'), 'description' => 'Variable name/programmatic handle for this group.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -301,59 +311,59 @@ static function &fields() { 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'label' => array( + ], + 'label' => [ 'name' => 'label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Custom Field Label') , + 'title' => ts('Custom Field Label'), 'description' => 'Text for form field label (also friendly name for administering this custom property).', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 1, - ) , - 'data_type' => array( + ], + 'data_type' => [ 'name' => 'data_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Custom Field Data Type') , + 'title' => ts('Custom Field Data Type'), 'description' => 'Controls location of data storage in extended_data table.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 16, 'size' => CRM_Utils_Type::TWELVE, 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_BAO_CustomField::dataType', - ) - ) , - 'html_type' => array( + ] + ], + 'html_type' => [ 'name' => 'html_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Custom Field HTML Type') , + 'title' => ts('Custom Field HTML Type'), 'description' => 'HTML types plus several built-in extended types.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 32, 'size' => CRM_Utils_Type::MEDIUM, 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::customHtmlType', - ) - ) , - 'default_value' => array( + ] + ], + 'default_value' => [ 'name' => 'default_value', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Custom Field Default') , + 'title' => ts('Custom Field Default'), 'description' => 'Use form_options.is_default for field_types which use options.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -361,73 +371,73 @@ static function &fields() { 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'is_required' => array( + ], + 'is_required' => [ 'name' => 'is_required', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Custom Field Is Required?') , + 'title' => ts('Custom Field Is Required?'), 'description' => 'Is a value required for this property.', 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'is_searchable' => array( + ], + 'is_searchable' => [ 'name' => 'is_searchable', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Allow Searching on Field?') , + 'title' => ts('Allow Searching on Field?'), 'description' => 'Is this property searchable.', 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'is_search_range' => array( + ], + 'is_search_range' => [ 'name' => 'is_search_range', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Search as a Range') , + 'title' => ts('Search as a Range'), 'description' => 'Is this property range searchable.', 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'weight' => array( + ], + 'weight' => [ 'name' => 'weight', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Order') , + 'title' => ts('Order'), 'description' => 'Controls field display order within an extended property group.', - 'required' => true, + 'required' => TRUE, 'default' => '1', 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'help_pre' => array( + ], + 'help_pre' => [ 'name' => 'help_pre', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Custom Field Pre Text') , + 'title' => ts('Custom Field Pre Text'), 'description' => 'Description and/or help text to display before this field.', 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 1, - ) , - 'help_post' => array( + ], + 'help_post' => [ 'name' => 'help_post', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Custom Field Post Text') , + 'title' => ts('Custom Field Post Text'), 'description' => 'Description and/or help text to display after this field.', 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 1, - ) , - 'mask' => array( + ], + 'mask' => [ 'name' => 'mask', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Custom Field Formatting') , + 'title' => ts('Custom Field Formatting'), 'description' => 'Optional format instructions for specific field types, like date types.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -435,11 +445,11 @@ static function &fields() { 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'attributes' => array( + ], + 'attributes' => [ 'name' => 'attributes', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Custom Field Attributes') , + 'title' => ts('Custom Field Attributes'), 'description' => 'Store collection of type-appropriate attributes, e.g. textarea needs rows/cols attributes', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -447,11 +457,11 @@ static function &fields() { 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'javascript' => array( + ], + 'javascript' => [ 'name' => 'javascript', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Custom Field Javascript') , + 'title' => ts('Custom Field Javascript'), 'description' => 'Optional scripting attributes for field.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -459,71 +469,71 @@ static function &fields() { 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Custom Field Is Active?') , + 'title' => ts('Custom Field Is Active?'), 'description' => 'Is this property active?', 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'is_view' => array( + ], + 'is_view' => [ 'name' => 'is_view', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Field is Viewable') , + 'title' => ts('Field is Viewable'), 'description' => 'Is this property set by PHP Code? A code field is viewable but not editable', 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'options_per_line' => array( + ], + 'options_per_line' => [ 'name' => 'options_per_line', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Field Options Per Line') , + 'title' => ts('Field Options Per Line'), 'description' => 'number of options per line for checkbox and radio', 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'text_length' => array( + ], + 'text_length' => [ 'name' => 'text_length', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Field Length') , + 'title' => ts('Field Length'), 'description' => 'field length if alphanumeric', 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'start_date_years' => array( + ], + 'start_date_years' => [ 'name' => 'start_date_years', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Field Start Date') , + 'title' => ts('Field Start Date'), 'description' => 'Date may be up to start_date_years years prior to the current date.', 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'end_date_years' => array( + ], + 'end_date_years' => [ 'name' => 'end_date_years', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Field End Date') , + 'title' => ts('Field End Date'), 'description' => 'Date may be up to end_date_years years after the current date.', 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'date_format' => array( + ], + 'date_format' => [ 'name' => 'date_format', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Field Data Format') , + 'title' => ts('Field Data Format'), 'description' => 'date format for custom date', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -531,41 +541,41 @@ static function &fields() { 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'time_format' => array( + ], + 'time_format' => [ 'name' => 'time_format', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Field Time Format') , + 'title' => ts('Field Time Format'), 'description' => 'time format for custom date', 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'note_columns' => array( + ], + 'note_columns' => [ 'name' => 'note_columns', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Field Note Columns') , + 'title' => ts('Field Note Columns'), 'description' => ' Number of columns in Note Field ', 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'note_rows' => array( + ], + 'note_rows' => [ 'name' => 'note_rows', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Field Note Rows') , + 'title' => ts('Field Note Rows'), 'description' => ' Number of rows in Note Field ', 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'column_name' => array( + ], + 'column_name' => [ 'name' => 'column_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Field Column Name') , + 'title' => ts('Field Column Name'), 'description' => 'Name of the column that holds the values for this field.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -573,21 +583,21 @@ static function &fields() { 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'option_group_id' => array( + ], + 'option_group_id' => [ 'name' => 'option_group_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Field Option Group') , + 'title' => ts('Field Option Group'), 'description' => 'For elements with options, the option group id that is used', 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'filter' => array( + ], + 'filter' => [ 'name' => 'filter', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Field Filter') , + 'title' => ts('Field Filter'), 'description' => 'Stores Contact Get API params contact reference custom fields. May be used for other filters in the future.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -595,50 +605,54 @@ static function &fields() { 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - 'in_selector' => array( + ], + 'in_selector' => [ 'name' => 'in_selector', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Field Display') , + 'title' => ts('Field Display'), 'description' => 'Should the multi-record custom field values be displayed in tab table listing', 'table_name' => 'civicrm_custom_field', 'entity' => 'CustomField', 'bao' => 'CRM_Core_BAO_CustomField', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -646,10 +660,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_field', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_field', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -657,36 +672,42 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_field', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_field', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_label_custom_group_id' => array( + $indices = [ + 'UI_label_custom_group_id' => [ 'name' => 'UI_label_custom_group_id', - 'field' => array( + 'field' => [ 0 => 'label', 1 => 'custom_group_id', - ) , - 'localizable' => true, - 'unique' => true, + ], + 'localizable' => TRUE, + 'unique' => TRUE, 'sig' => 'civicrm_custom_field::1::label::custom_group_id', - ) , - 'UI_name_custom_group_id' => array( + ], + 'UI_name_custom_group_id' => [ 'name' => 'UI_name_custom_group_id', - 'field' => array( + 'field' => [ 0 => 'name', 1 => 'custom_group_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_custom_field::1::name::custom_group_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/CustomGroup.php b/CRM/Core/DAO/CustomGroup.php index 48f3b186fde1..671d4d635006 100644 --- a/CRM/Core/DAO/CustomGroup.php +++ b/CRM/Core/DAO/CustomGroup.php @@ -1,29 +1,5 @@ __table = 'civicrm_custom_group'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Custom Group ID') , + 'title' => ts('Custom Group ID'), 'description' => 'Unique Custom Group ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_custom_group', 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Custom Group Name') , + 'title' => ts('Custom Group Name'), 'description' => 'Variable name/programmatic handle for this group.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -227,24 +228,24 @@ static function &fields() { 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 0, - ) , - 'title' => array( + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Custom Group Title') , + 'title' => ts('Custom Group Title'), 'description' => 'Friendly Name.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_custom_group', 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 1, - ) , - 'extends' => array( + ], + 'extends' => [ 'name' => 'extends', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Custom Group Extends') , + 'title' => ts('Custom Group Extends'), 'description' => 'Type of object this group extends (can add other options later e.g. contact_address, etc.).', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -253,22 +254,22 @@ static function &fields() { 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 0, - ) , - 'extends_entity_column_id' => array( + ], + 'extends_entity_column_id' => [ 'name' => 'extends_entity_column_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Custom Group Subtype List') , + 'title' => ts('Custom Group Subtype List'), 'description' => 'FK to civicrm_option_value.id (for option group custom_data_type.)', 'default' => 'NULL', 'table_name' => 'civicrm_custom_group', 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 0, - ) , - 'extends_entity_column_value' => array( + ], + 'extends_entity_column_value' => [ 'name' => 'extends_entity_column_value', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Custom Group Subtype') , + 'title' => ts('Custom Group Subtype'), 'description' => 'linking custom group for dynamic object', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -277,11 +278,11 @@ static function &fields() { 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 0, 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND, - ) , - 'style' => array( + ], + 'style' => [ 'name' => 'style', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Custom Group Style') , + 'title' => ts('Custom Group Style'), 'description' => 'Visual relationship between this form and its parent.', 'maxlength' => 15, 'size' => CRM_Utils_Type::TWELVE, @@ -289,27 +290,27 @@ static function &fields() { 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::customGroupStyle', - ) - ) , - 'collapse_display' => array( + ] + ], + 'collapse_display' => [ 'name' => 'collapse_display', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Collapse Custom Group?') , + 'title' => ts('Collapse Custom Group?'), 'description' => 'Will this group be in collapsed or expanded mode on initial display ?', 'table_name' => 'civicrm_custom_group', 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 0, - ) , - 'help_pre' => array( + ], + 'help_pre' => [ 'name' => 'help_pre', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Custom Group Pre Text') , + 'title' => ts('Custom Group Pre Text'), 'description' => 'Description and/or help text to display before fields in form.', 'rows' => 4, 'cols' => 80, @@ -317,14 +318,14 @@ static function &fields() { 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'help_post' => array( + ], + ], + 'help_post' => [ 'name' => 'help_post', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Custom Group Post Text') , + 'title' => ts('Custom Group Post Text'), 'description' => 'Description and/or help text to display after fields in form.', 'rows' => 4, 'cols' => 80, @@ -332,36 +333,36 @@ static function &fields() { 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'weight' => array( + ], + ], + 'weight' => [ 'name' => 'weight', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Order') , + 'title' => ts('Order'), 'description' => 'Controls display order when multiple extended property groups are setup for the same class.', - 'required' => true, + 'required' => TRUE, 'default' => '1', 'table_name' => 'civicrm_custom_group', 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Custom Group Is Active?') , + 'title' => ts('Custom Group Is Active?'), 'description' => 'Is this property active?', 'table_name' => 'civicrm_custom_group', 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 0, - ) , - 'table_name' => array( + ], + 'table_name' => [ 'name' => 'table_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Table Name') , + 'title' => ts('Table Name'), 'description' => 'Name of the table that holds the values for this group.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -369,122 +370,126 @@ static function &fields() { 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 0, - ) , - 'is_multiple' => array( + ], + 'is_multiple' => [ 'name' => 'is_multiple', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Supports Multiple Records') , + 'title' => ts('Supports Multiple Records'), 'description' => 'Does this group hold multiple values?', 'table_name' => 'civicrm_custom_group', 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 0, - ) , - 'min_multiple' => array( + ], + 'min_multiple' => [ 'name' => 'min_multiple', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Minimum Multiple Records') , + 'title' => ts('Minimum Multiple Records'), 'description' => 'minimum number of multiple records (typically 0?)', 'table_name' => 'civicrm_custom_group', 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 0, - ) , - 'max_multiple' => array( + ], + 'max_multiple' => [ 'name' => 'max_multiple', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Maximum Multiple Records') , + 'title' => ts('Maximum Multiple Records'), 'description' => 'maximum number of multiple records, if 0 - no max', 'table_name' => 'civicrm_custom_group', 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 0, - ) , - 'collapse_adv_display' => array( + ], + 'collapse_adv_display' => [ 'name' => 'collapse_adv_display', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Collapse Group Display') , + 'title' => ts('Collapse Group Display'), 'description' => 'Will this group be in collapsed or expanded mode on advanced search display ?', 'table_name' => 'civicrm_custom_group', 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 0, - ) , - 'created_id' => array( + ], + 'created_id' => [ 'name' => 'created_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Custom Group Created By') , + 'title' => ts('Custom Group Created By'), 'description' => 'FK to civicrm_contact, who created this custom group', 'table_name' => 'civicrm_custom_group', 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'created_date' => array( + ], + 'created_date' => [ 'name' => 'created_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Custom Group Created Date') , + 'title' => ts('Custom Group Created Date'), 'description' => 'Date and time this custom group was created.', 'table_name' => 'civicrm_custom_group', 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 0, - ) , - 'is_reserved' => array( + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Reserved Group?') , + 'title' => ts('Reserved Group?'), 'description' => 'Is this a reserved Custom Group?', 'table_name' => 'civicrm_custom_group', 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 0, - ) , - 'is_public' => array( + ], + 'is_public' => [ 'name' => 'is_public', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Custom Group Is Public?') , + 'title' => ts('Custom Group Is Public?'), 'description' => 'Is this property public?', 'default' => '1', 'table_name' => 'civicrm_custom_group', 'entity' => 'CustomGroup', 'bao' => 'CRM_Core_BAO_CustomGroup', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -492,10 +497,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_group', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_group', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -503,36 +509,42 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_group', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_group', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_title_extends' => array( + $indices = [ + 'UI_title_extends' => [ 'name' => 'UI_title_extends', - 'field' => array( + 'field' => [ 0 => 'title', 1 => 'extends', - ) , - 'localizable' => true, - 'unique' => true, + ], + 'localizable' => TRUE, + 'unique' => TRUE, 'sig' => 'civicrm_custom_group::1::title::extends', - ) , - 'UI_name_extends' => array( + ], + 'UI_name_extends' => [ 'name' => 'UI_name_extends', - 'field' => array( + 'field' => [ 0 => 'name', 1 => 'extends', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_custom_group::1::name::extends', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Dashboard.php b/CRM/Core/DAO/Dashboard.php index b51fd7433292..fe618862a4a4 100644 --- a/CRM/Core/DAO/Dashboard.php +++ b/CRM/Core/DAO/Dashboard.php @@ -1,29 +1,5 @@ __table = 'civicrm_dashboard'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('DashletID') , - 'required' => true, + 'title' => ts('DashletID'), + 'required' => TRUE, 'table_name' => 'civicrm_dashboard', 'entity' => 'Dashboard', 'bao' => 'CRM_Core_BAO_Dashboard', 'localizable' => 0, - ) , - 'domain_id' => array( + ], + 'domain_id' => [ 'name' => 'domain_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Dashlet Domain') , + 'title' => ts('Dashlet Domain'), 'description' => 'Domain for dashboard', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_dashboard', 'entity' => 'Dashboard', 'bao' => 'CRM_Core_BAO_Dashboard', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Domain', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'name' => array( + ] + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Dashlet Name') , + 'title' => ts('Dashlet Name'), 'description' => 'Internal name of dashlet.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -182,11 +172,11 @@ static function &fields() { 'entity' => 'Dashboard', 'bao' => 'CRM_Core_BAO_Dashboard', 'localizable' => 0, - ) , - 'label' => array( + ], + 'label' => [ 'name' => 'label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Dashlet Title') , + 'title' => ts('Dashlet Title'), 'description' => 'dashlet title', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -194,11 +184,11 @@ static function &fields() { 'entity' => 'Dashboard', 'bao' => 'CRM_Core_BAO_Dashboard', 'localizable' => 1, - ) , - 'url' => array( + ], + 'url' => [ 'name' => 'url', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Dashlet URL') , + 'title' => ts('Dashlet URL'), 'description' => 'url in case of external dashlet', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -206,11 +196,11 @@ static function &fields() { 'entity' => 'Dashboard', 'bao' => 'CRM_Core_BAO_Dashboard', 'localizable' => 0, - ) , - 'permission' => array( + ], + 'permission' => [ 'name' => 'permission', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Dashlet Permission') , + 'title' => ts('Dashlet Permission'), 'description' => 'Permission for the dashlet', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -218,11 +208,11 @@ static function &fields() { 'entity' => 'Dashboard', 'bao' => 'CRM_Core_BAO_Dashboard', 'localizable' => 0, - ) , - 'permission_operator' => array( + ], + 'permission_operator' => [ 'name' => 'permission_operator', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Dashlet Permission Operator') , + 'title' => ts('Dashlet Permission Operator'), 'description' => 'Permission Operator', 'maxlength' => 3, 'size' => CRM_Utils_Type::FOUR, @@ -230,11 +220,11 @@ static function &fields() { 'entity' => 'Dashboard', 'bao' => 'CRM_Core_BAO_Dashboard', 'localizable' => 0, - ) , - 'fullscreen_url' => array( + ], + 'fullscreen_url' => [ 'name' => 'fullscreen_url', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Fullscreen URL') , + 'title' => ts('Fullscreen URL'), 'description' => 'fullscreen url for dashlet', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -242,72 +232,76 @@ static function &fields() { 'entity' => 'Dashboard', 'bao' => 'CRM_Core_BAO_Dashboard', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Dashlet Active?') , + 'title' => ts('Is Dashlet Active?'), 'description' => 'Is this dashlet active?', 'table_name' => 'civicrm_dashboard', 'entity' => 'Dashboard', 'bao' => 'CRM_Core_BAO_Dashboard', 'localizable' => 0, - ) , - 'is_reserved' => array( + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Dashlet Reserved?') , + 'title' => ts('Is Dashlet Reserved?'), 'description' => 'Is this dashlet reserved?', 'table_name' => 'civicrm_dashboard', 'entity' => 'Dashboard', 'bao' => 'CRM_Core_BAO_Dashboard', 'localizable' => 0, - ) , - 'cache_minutes' => array( + ], + 'cache_minutes' => [ 'name' => 'cache_minutes', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Cache Minutes') , + 'title' => ts('Cache Minutes'), 'description' => 'Number of minutes to cache dashlet content in browser localStorage.', - 'required' => true, + 'required' => TRUE, 'default' => '60', 'table_name' => 'civicrm_dashboard', 'entity' => 'Dashboard', 'bao' => 'CRM_Core_BAO_Dashboard', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -315,10 +309,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dashboard', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dashboard', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -326,15 +321,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dashboard', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dashboard', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Discount.php b/CRM/Core/DAO/Discount.php index 8edba7e1794d..b35720a11b44 100644 --- a/CRM/Core/DAO/Discount.php +++ b/CRM/Core/DAO/Discount.php @@ -1,29 +1,5 @@ __table = 'civicrm_discount'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'price_set_id', 'civicrm_price_set', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'price_set_id', 'civicrm_price_set', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Discount ID') , + 'title' => ts('Discount ID'), 'description' => 'primary key', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_discount', 'entity' => 'Discount', 'bao' => 'CRM_Core_BAO_Discount', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Table') , + 'title' => ts('Entity Table'), 'description' => 'physical tablename for entity being joined to discount, e.g. civicrm_event', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -138,25 +124,25 @@ static function &fields() { 'entity' => 'Discount', 'bao' => 'CRM_Core_BAO_Discount', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity ID') , + 'title' => ts('Entity ID'), 'description' => 'FK to entity table specified in entity_table column.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_discount', 'entity' => 'Discount', 'bao' => 'CRM_Core_BAO_Discount', 'localizable' => 0, - ) , - 'participant_discount_name' => array( + ], + 'participant_discount_name' => [ 'name' => 'price_set_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Discount Name') , + 'title' => ts('Discount Name'), 'description' => 'FK to civicrm_price_set', - 'required' => true, - 'export' => true, + 'required' => TRUE, + 'export' => TRUE, 'where' => 'civicrm_discount.price_set_id', 'headerPattern' => '', 'dataPattern' => '', @@ -165,60 +151,64 @@ static function &fields() { 'bao' => 'CRM_Core_BAO_Discount', 'localizable' => 0, 'FKClassName' => 'CRM_Price_DAO_PriceSet', - ) , - 'start_date' => array( + ], + 'start_date' => [ 'name' => 'start_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Discount Start Date') , + 'title' => ts('Discount Start Date'), 'description' => 'Date when discount starts.', 'table_name' => 'civicrm_discount', 'entity' => 'Discount', 'bao' => 'CRM_Core_BAO_Discount', 'localizable' => 0, - ) , - 'end_date' => array( + ], + 'end_date' => [ 'name' => 'end_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Discount End Date') , + 'title' => ts('Discount End Date'), 'description' => 'Date when discount ends.', 'table_name' => 'civicrm_discount', 'entity' => 'Discount', 'bao' => 'CRM_Core_BAO_Discount', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -226,10 +216,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'discount', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'discount', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -237,35 +228,41 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'discount', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'discount', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_entity' => array( + $indices = [ + 'index_entity' => [ 'name' => 'index_entity', - 'field' => array( + 'field' => [ 0 => 'entity_table', 1 => 'entity_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_discount::0::entity_table::entity_id', - ) , - 'index_entity_option_id' => array( + ], + 'index_entity_option_id' => [ 'name' => 'index_entity_option_id', - 'field' => array( + 'field' => [ 0 => 'entity_table', 1 => 'entity_id', 2 => 'price_set_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_discount::0::entity_table::entity_id::price_set_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Domain.php b/CRM/Core/DAO/Domain.php index 9a7adf6461f4..a85742e93211 100644 --- a/CRM/Core/DAO/Domain.php +++ b/CRM/Core/DAO/Domain.php @@ -1,29 +1,5 @@ __table = 'civicrm_domain'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Domain ID') , + 'title' => ts('Domain ID'), 'description' => 'Domain ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_domain', 'entity' => 'Domain', 'bao' => 'CRM_Core_BAO_Domain', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Domain Name') , + 'title' => ts('Domain Name'), 'description' => 'Name of Domain / Organization', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -149,14 +137,14 @@ static function &fields() { 'entity' => 'Domain', 'bao' => 'CRM_Core_BAO_Domain', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'description' => array( + ], + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Domain Description') , + 'title' => ts('Domain Description'), 'description' => 'Description of Domain.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -164,25 +152,25 @@ static function &fields() { 'entity' => 'Domain', 'bao' => 'CRM_Core_BAO_Domain', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'config_backend' => array( + ], + ], + 'config_backend' => [ 'name' => 'config_backend', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Domain Configuration') , + 'title' => ts('Domain Configuration'), 'description' => 'Backend configuration.', 'table_name' => 'civicrm_domain', 'entity' => 'Domain', 'bao' => 'CRM_Core_BAO_Domain', 'localizable' => 0, 'serialize' => self::SERIALIZE_PHP, - ) , - 'version' => array( + ], + 'version' => [ 'name' => 'version', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('CiviCRM Version') , + 'title' => ts('CiviCRM Version'), 'description' => 'The civicrm version this instance is running', 'maxlength' => 32, 'size' => CRM_Utils_Type::MEDIUM, @@ -190,72 +178,76 @@ static function &fields() { 'entity' => 'Domain', 'bao' => 'CRM_Core_BAO_Domain', 'localizable' => 0, - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Domain Contact') , + 'title' => ts('Domain Contact'), 'description' => 'FK to Contact ID. This is specifically not an FK to avoid circular constraints', 'table_name' => 'civicrm_domain', 'entity' => 'Domain', 'bao' => 'CRM_Core_BAO_Domain', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'locales' => array( + ], + 'locales' => [ 'name' => 'locales', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Supported Languages') , + 'title' => ts('Supported Languages'), 'description' => 'list of locales supported by the current db state (NULL for single-lang install)', 'table_name' => 'civicrm_domain', 'entity' => 'Domain', 'bao' => 'CRM_Core_BAO_Domain', 'localizable' => 0, - ) , - 'locale_custom_strings' => array( + ], + 'locale_custom_strings' => [ 'name' => 'locale_custom_strings', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Language Customizations') , + 'title' => ts('Language Customizations'), 'description' => 'Locale specific string overrides', 'table_name' => 'civicrm_domain', 'entity' => 'Domain', 'bao' => 'CRM_Core_BAO_Domain', 'localizable' => 0, 'serialize' => self::SERIALIZE_PHP, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -263,10 +255,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'domain', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'domain', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -274,25 +267,31 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'domain', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'domain', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_name' => array( + $indices = [ + 'UI_name' => [ 'name' => 'UI_name', - 'field' => array( + 'field' => [ 0 => 'name', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_domain::1::name', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Email.php b/CRM/Core/DAO/Email.php index 7f02cf55558b..45d97d1b90f4 100644 --- a/CRM/Core/DAO/Email.php +++ b/CRM/Core/DAO/Email.php @@ -1,29 +1,5 @@ __table = 'civicrm_email'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Email ID') , + 'title' => ts('Email ID'), 'description' => 'Unique Email ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_email', 'entity' => 'Email', 'bao' => 'CRM_Core_BAO_Email', 'localizable' => 0, - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Email Contact') , + 'title' => ts('Email Contact'), 'description' => 'FK to Contact ID', 'table_name' => 'civicrm_email', 'entity' => 'Email', 'bao' => 'CRM_Core_BAO_Email', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'location_type_id' => array( + ], + 'location_type_id' => [ 'name' => 'location_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Email Location Type') , + 'title' => ts('Email Location Type'), 'description' => 'Which Location does this email belong to.', 'table_name' => 'civicrm_email', 'entity' => 'Email', 'bao' => 'CRM_Core_BAO_Email', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_location_type', 'keyColumn' => 'id', 'labelColumn' => 'display_name', - ) - ) , - 'email' => array( + ] + ], + 'email' => [ 'name' => 'email', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Email') , + 'title' => ts('Email'), 'description' => 'Email address', 'maxlength' => 254, 'size' => 30, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_email.email', 'headerPattern' => '/e.?mail/i', 'dataPattern' => '/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/', - 'export' => true, + 'export' => TRUE, 'rule' => 'email', 'table_name' => 'civicrm_email', 'entity' => 'Email', 'bao' => 'CRM_Core_BAO_Email', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'is_primary' => array( + ], + ], + 'is_primary' => [ 'name' => 'is_primary', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Primary email') , + 'title' => ts('Is Primary email'), 'description' => 'Is this the primary?', 'table_name' => 'civicrm_email', 'entity' => 'Email', 'bao' => 'CRM_Core_BAO_Email', 'localizable' => 0, - ) , - 'is_billing' => array( + ], + 'is_billing' => [ 'name' => 'is_billing', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Billing Email?') , + 'title' => ts('Is Billing Email?'), 'description' => 'Is this the billing?', 'table_name' => 'civicrm_email', 'entity' => 'Email', 'bao' => 'CRM_Core_BAO_Email', 'localizable' => 0, - ) , - 'on_hold' => array( + ], + 'on_hold' => [ 'name' => 'on_hold', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('On Hold') , + 'title' => ts('On Hold'), 'description' => 'Is this address on bounce hold?', - 'required' => true, - 'export' => true, + 'required' => TRUE, + 'export' => TRUE, 'where' => 'civicrm_email.on_hold', 'headerPattern' => '', 'dataPattern' => '', @@ -246,17 +238,17 @@ static function &fields() { 'entity' => 'Email', 'bao' => 'CRM_Core_BAO_Email', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'is_bulkmail' => array( + ], + ], + 'is_bulkmail' => [ 'name' => 'is_bulkmail', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Use for Bulk Mail') , + 'title' => ts('Use for Bulk Mail'), 'description' => 'Is this address for bulk mail ?', - 'required' => true, - 'export' => true, + 'required' => TRUE, + 'export' => TRUE, 'where' => 'civicrm_email.is_bulkmail', 'headerPattern' => '', 'dataPattern' => '', @@ -264,92 +256,96 @@ static function &fields() { 'entity' => 'Email', 'bao' => 'CRM_Core_BAO_Email', 'localizable' => 0, - ) , - 'hold_date' => array( + ], + 'hold_date' => [ 'name' => 'hold_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Hold Date') , + 'title' => ts('Hold Date'), 'description' => 'When the address went on bounce hold', 'table_name' => 'civicrm_email', 'entity' => 'Email', 'bao' => 'CRM_Core_BAO_Email', 'localizable' => 0, - ) , - 'reset_date' => array( + ], + 'reset_date' => [ 'name' => 'reset_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Reset Date') , + 'title' => ts('Reset Date'), 'description' => 'When the address bounce status was last reset', 'table_name' => 'civicrm_email', 'entity' => 'Email', 'bao' => 'CRM_Core_BAO_Email', 'localizable' => 0, - ) , - 'signature_text' => array( + ], + 'signature_text' => [ 'name' => 'signature_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Signature Text') , + 'title' => ts('Signature Text'), 'description' => 'Text formatted signature for the email.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_email.signature_text', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'default' => 'NULL', 'table_name' => 'civicrm_email', 'entity' => 'Email', 'bao' => 'CRM_Core_BAO_Email', 'localizable' => 0, - ) , - 'signature_html' => array( + ], + 'signature_html' => [ 'name' => 'signature_html', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Signature Html') , + 'title' => ts('Signature Html'), 'description' => 'HTML formatted signature for the email.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_email.signature_html', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'default' => 'NULL', 'table_name' => 'civicrm_email', 'entity' => 'Email', 'bao' => 'CRM_Core_BAO_Email', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -357,10 +353,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'email', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'email', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -368,48 +365,54 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'email', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'email', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_location_type' => array( + $indices = [ + 'index_location_type' => [ 'name' => 'index_location_type', - 'field' => array( + 'field' => [ 0 => 'location_type_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_email::0::location_type_id', - ) , - 'UI_email' => array( + ], + 'UI_email' => [ 'name' => 'UI_email', - 'field' => array( + 'field' => [ 0 => 'email', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_email::0::email', - ) , - 'index_is_primary' => array( + ], + 'index_is_primary' => [ 'name' => 'index_is_primary', - 'field' => array( + 'field' => [ 0 => 'is_primary', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_email::0::is_primary', - ) , - 'index_is_billing' => array( + ], + 'index_is_billing' => [ 'name' => 'index_is_billing', - 'field' => array( + 'field' => [ 0 => 'is_billing', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_email::0::is_billing', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/EntityFile.php b/CRM/Core/DAO/EntityFile.php index c8c2a55c314c..5423d59386d4 100644 --- a/CRM/Core/DAO/EntityFile.php +++ b/CRM/Core/DAO/EntityFile.php @@ -1,29 +1,5 @@ __table = 'civicrm_entity_file'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'file_id', 'civicrm_file', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'file_id', 'civicrm_file', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity File ID') , + 'title' => ts('Entity File ID'), 'description' => 'primary key', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_entity_file', 'entity' => 'EntityFile', 'bao' => 'CRM_Core_DAO_EntityFile', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Table') , + 'title' => ts('Entity Table'), 'description' => 'physical tablename for entity being joined to file, e.g. civicrm_contact', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -126,63 +110,67 @@ static function &fields() { 'entity' => 'EntityFile', 'bao' => 'CRM_Core_DAO_EntityFile', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity ID') , + 'title' => ts('Entity ID'), 'description' => 'FK to entity table specified in entity_table column.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_entity_file', 'entity' => 'EntityFile', 'bao' => 'CRM_Core_DAO_EntityFile', 'localizable' => 0, - ) , - 'file_id' => array( + ], + 'file_id' => [ 'name' => 'file_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('File') , + 'title' => ts('File'), 'description' => 'FK to civicrm_file', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_entity_file', 'entity' => 'EntityFile', 'bao' => 'CRM_Core_DAO_EntityFile', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_File', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -190,10 +178,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_file', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_file', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -201,35 +190,41 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_file', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_file', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_entity' => array( + $indices = [ + 'index_entity' => [ 'name' => 'index_entity', - 'field' => array( + 'field' => [ 0 => 'entity_table', 1 => 'entity_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_entity_file::0::entity_table::entity_id', - ) , - 'index_entity_file_id' => array( + ], + 'index_entity_file_id' => [ 'name' => 'index_entity_file_id', - 'field' => array( + 'field' => [ 0 => 'entity_table', 1 => 'entity_id', 2 => 'file_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_entity_file::0::entity_table::entity_id::file_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/EntityTag.php b/CRM/Core/DAO/EntityTag.php index ec0eb42f4282..717ad3e63975 100644 --- a/CRM/Core/DAO/EntityTag.php +++ b/CRM/Core/DAO/EntityTag.php @@ -1,29 +1,5 @@ __table = 'civicrm_entity_tag'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'tag_id', 'civicrm_tag', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'tag_id', 'civicrm_tag', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity Tag ID') , + 'title' => ts('Entity Tag ID'), 'description' => 'primary key', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_entity_tag', 'entity' => 'EntityTag', 'bao' => 'CRM_Core_BAO_EntityTag', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Table') , + 'title' => ts('Entity Table'), 'description' => 'physical tablename for entity being joined to file, e.g. civicrm_contact', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -126,75 +110,79 @@ static function &fields() { 'entity' => 'EntityTag', 'bao' => 'CRM_Core_BAO_EntityTag', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'tag_used_for', 'optionEditPath' => 'civicrm/admin/options/tag_used_for', - ) - ) , - 'entity_id' => array( + ] + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity ID') , + 'title' => ts('Entity ID'), 'description' => 'FK to entity table specified in entity_table column.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_entity_tag', 'entity' => 'EntityTag', 'bao' => 'CRM_Core_BAO_EntityTag', 'localizable' => 0, - ) , - 'tag_id' => array( + ], + 'tag_id' => [ 'name' => 'tag_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Tag') , + 'title' => ts('Tag'), 'description' => 'FK to civicrm_tag', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_entity_tag', 'entity' => 'EntityTag', 'bao' => 'CRM_Core_BAO_EntityTag', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Tag', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_tag', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -202,10 +190,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_tag', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_tag', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -213,27 +202,33 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_tag', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_tag', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_entity_id_entity_table_tag_id' => array( + $indices = [ + 'UI_entity_id_entity_table_tag_id' => [ 'name' => 'UI_entity_id_entity_table_tag_id', - 'field' => array( + 'field' => [ 0 => 'entity_id', 1 => 'entity_table', 2 => 'tag_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_entity_tag::1::entity_id::entity_table::tag_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Extension.php b/CRM/Core/DAO/Extension.php index 83194dcb07be..e6c97ea25817 100644 --- a/CRM/Core/DAO/Extension.php +++ b/CRM/Core/DAO/Extension.php @@ -1,29 +1,5 @@ __table = 'civicrm_extension'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Extension ID') , + 'title' => ts('Extension ID'), 'description' => 'Local Extension ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_extension', 'entity' => 'Extension', 'bao' => 'CRM_Core_BAO_Extension', 'localizable' => 0, - ) , - 'type' => array( + ], + 'type' => [ 'name' => 'type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Type') , - 'required' => true, + 'title' => ts('Type'), + 'required' => TRUE, 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, 'table_name' => 'civicrm_extension', 'entity' => 'Extension', 'bao' => 'CRM_Core_BAO_Extension', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getExtensionTypes', - ) - ) , - 'full_name' => array( + ] + ], + 'full_name' => [ 'name' => 'full_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Key') , + 'title' => ts('Key'), 'description' => 'Fully qualified extension name', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_extension', 'entity' => 'Extension', 'bao' => 'CRM_Core_BAO_Extension', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Name') , + 'title' => ts('Name'), 'description' => 'Short name', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_extension.name', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_extension', 'entity' => 'Extension', 'bao' => 'CRM_Core_BAO_Extension', 'localizable' => 0, - ) , - 'label' => array( + ], + 'label' => [ 'name' => 'label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Label') , + 'title' => ts('Label'), 'description' => 'Short, printable name', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_extension.label', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_extension', 'entity' => 'Extension', 'bao' => 'CRM_Core_BAO_Extension', 'localizable' => 0, - ) , - 'file' => array( + ], + 'file' => [ 'name' => 'file', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('File') , + 'title' => ts('File'), 'description' => 'Primary PHP file', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_extension.file', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_extension', 'entity' => 'Extension', 'bao' => 'CRM_Core_BAO_Extension', 'localizable' => 0, - ) , - 'schema_version' => array( + ], + 'schema_version' => [ 'name' => 'schema_version', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Schema Version') , + 'title' => ts('Schema Version'), 'description' => 'Revision code of the database schema; the format is module-defined', 'maxlength' => 63, 'size' => CRM_Utils_Type::BIG, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_extension.schema_version', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_extension', 'entity' => 'Extension', 'bao' => 'CRM_Core_BAO_Extension', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Extension is Active?') , + 'title' => ts('Extension is Active?'), 'description' => 'Is this extension active?', 'default' => '1', 'table_name' => 'civicrm_extension', 'entity' => 'Extension', 'bao' => 'CRM_Core_BAO_Extension', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -273,10 +263,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'extension', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'extension', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -284,33 +275,39 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'extension', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'extension', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_extension_full_name' => array( + $indices = [ + 'UI_extension_full_name' => [ 'name' => 'UI_extension_full_name', - 'field' => array( + 'field' => [ 0 => 'full_name', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_extension::1::full_name', - ) , - 'UI_extension_name' => array( + ], + 'UI_extension_name' => [ 'name' => 'UI_extension_name', - 'field' => array( + 'field' => [ 0 => 'name', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_extension::0::name', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/File.php b/CRM/Core/DAO/File.php index 16f25a604f07..b948be0b5878 100644 --- a/CRM/Core/DAO/File.php +++ b/CRM/Core/DAO/File.php @@ -1,29 +1,5 @@ __table = 'civicrm_file'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('File ID') , + 'title' => ts('File ID'), 'description' => 'Unique ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_file', 'entity' => 'File', 'bao' => 'CRM_Core_BAO_File', 'localizable' => 0, - ) , - 'file_type_id' => array( + ], + 'file_type_id' => [ 'name' => 'file_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('File Type') , + 'title' => ts('File Type'), 'description' => 'Type of file (e.g. Transcript, Income Tax Return, etc). FK to civicrm_option_value.', 'table_name' => 'civicrm_file', 'entity' => 'File', 'bao' => 'CRM_Core_BAO_File', 'localizable' => 0, - ) , - 'mime_type' => array( + ], + 'mime_type' => [ 'name' => 'mime_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mime Type') , + 'title' => ts('Mime Type'), 'description' => 'mime type of the document', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -139,11 +125,11 @@ static function &fields() { 'entity' => 'File', 'bao' => 'CRM_Core_BAO_File', 'localizable' => 0, - ) , - 'uri' => array( + ], + 'uri' => [ 'name' => 'uri', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Path') , + 'title' => ts('Path'), 'description' => 'uri of the file on disk', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -151,21 +137,21 @@ static function &fields() { 'entity' => 'File', 'bao' => 'CRM_Core_BAO_File', 'localizable' => 0, - ) , - 'document' => array( + ], + 'document' => [ 'name' => 'document', 'type' => CRM_Utils_Type::T_MEDIUMBLOB, - 'title' => ts('File Contents') , + 'title' => ts('File Contents'), 'description' => 'contents of the document', 'table_name' => 'civicrm_file', 'entity' => 'File', 'bao' => 'CRM_Core_BAO_File', 'localizable' => 0, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('File Description') , + 'title' => ts('File Description'), 'description' => 'Additional descriptive text regarding this attachment (optional).', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -173,50 +159,54 @@ static function &fields() { 'entity' => 'File', 'bao' => 'CRM_Core_BAO_File', 'localizable' => 0, - ) , - 'upload_date' => array( + ], + 'upload_date' => [ 'name' => 'upload_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('File Upload Date') , + 'title' => ts('File Upload Date'), 'description' => 'Date and time that this attachment was uploaded or written to server.', 'table_name' => 'civicrm_file', 'entity' => 'File', 'bao' => 'CRM_Core_BAO_File', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -224,10 +214,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'file', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'file', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -235,15 +226,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'file', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'file', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/IM.php b/CRM/Core/DAO/IM.php index ec3883a16e47..d1e8289435de 100644 --- a/CRM/Core/DAO/IM.php +++ b/CRM/Core/DAO/IM.php @@ -1,29 +1,5 @@ __table = 'civicrm_im'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Instant Messenger ID') , + 'title' => ts('Instant Messenger ID'), 'description' => 'Unique IM ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_im', 'entity' => 'IM', 'bao' => 'CRM_Core_BAO_IM', 'localizable' => 0, - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('IM Contact') , + 'title' => ts('IM Contact'), 'description' => 'FK to Contact ID', 'table_name' => 'civicrm_im', 'entity' => 'IM', 'bao' => 'CRM_Core_BAO_IM', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'location_type_id' => array( + ], + 'location_type_id' => [ 'name' => 'location_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('IM Location Type') , + 'title' => ts('IM Location Type'), 'description' => 'Which Location does this email belong to.', 'table_name' => 'civicrm_im', 'entity' => 'IM', 'bao' => 'CRM_Core_BAO_IM', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_location_type', 'keyColumn' => 'id', 'labelColumn' => 'display_name', - ) - ) , - 'name' => array( + ] + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('IM Screen Name') , + 'title' => ts('IM Screen Name'), 'description' => 'IM screen name', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_im.name', 'headerPattern' => '/I(nstant )?M(ess.*)?|screen(\s+)?name/i', 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_im', 'entity' => 'IM', 'bao' => 'CRM_Core_BAO_IM', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'provider_id' => array( + ], + ], + 'provider_id' => [ 'name' => 'provider_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('IM Provider') , + 'title' => ts('IM Provider'), 'description' => 'Which IM Provider does this screen name belong to.', 'table_name' => 'civicrm_im', 'entity' => 'IM', 'bao' => 'CRM_Core_BAO_IM', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'instant_messenger_service', 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service', - ) - ) , - 'is_primary' => array( + ] + ], + 'is_primary' => [ 'name' => 'is_primary', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is IM Primary?') , + 'title' => ts('Is IM Primary?'), 'description' => 'Is this the primary IM for this contact and location.', 'table_name' => 'civicrm_im', 'entity' => 'IM', 'bao' => 'CRM_Core_BAO_IM', 'localizable' => 0, - ) , - 'is_billing' => array( + ], + 'is_billing' => [ 'name' => 'is_billing', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is IM Billing?') , + 'title' => ts('Is IM Billing?'), 'description' => 'Is this the billing?', 'table_name' => 'civicrm_im', 'entity' => 'IM', 'bao' => 'CRM_Core_BAO_IM', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -258,10 +249,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'im', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'im', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -269,48 +261,54 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'im', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'im', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_location_type' => array( + $indices = [ + 'index_location_type' => [ 'name' => 'index_location_type', - 'field' => array( + 'field' => [ 0 => 'location_type_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_im::0::location_type_id', - ) , - 'UI_provider_id' => array( + ], + 'UI_provider_id' => [ 'name' => 'UI_provider_id', - 'field' => array( + 'field' => [ 0 => 'provider_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_im::0::provider_id', - ) , - 'index_is_primary' => array( + ], + 'index_is_primary' => [ 'name' => 'index_is_primary', - 'field' => array( + 'field' => [ 0 => 'is_primary', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_im::0::is_primary', - ) , - 'index_is_billing' => array( + ], + 'index_is_billing' => [ 'name' => 'index_is_billing', - 'field' => array( + 'field' => [ 0 => 'is_billing', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_im::0::is_billing', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Job.php b/CRM/Core/DAO/Job.php index 8a5af2af35dc..2a3abb54f68a 100644 --- a/CRM/Core/DAO/Job.php +++ b/CRM/Core/DAO/Job.php @@ -1,29 +1,5 @@ __table = 'civicrm_job'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Job ID') , + 'title' => ts('Job ID'), 'description' => 'Job Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_job', 'entity' => 'Job', 'bao' => 'CRM_Core_BAO_Job', 'localizable' => 0, - ) , - 'domain_id' => array( + ], + 'domain_id' => [ 'name' => 'domain_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Job Domain') , + 'title' => ts('Job Domain'), 'description' => 'Which Domain is this scheduled job for', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_job', 'entity' => 'Job', 'bao' => 'CRM_Core_BAO_Job', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Domain', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'run_frequency' => array( + ] + ], + 'run_frequency' => [ 'name' => 'run_frequency', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Job Frequency') , + 'title' => ts('Job Frequency'), 'description' => 'Scheduled job run frequency.', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -185,41 +176,41 @@ static function &fields() { 'entity' => 'Job', 'bao' => 'CRM_Core_BAO_Job', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getJobFrequency', - ) - ) , - 'last_run' => array( + ] + ], + 'last_run' => [ 'name' => 'last_run', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Last Run') , + 'title' => ts('Last Run'), 'description' => 'When was this cron entry last run', - 'required' => false, + 'required' => FALSE, 'default' => 'NULL', 'table_name' => 'civicrm_job', 'entity' => 'Job', 'bao' => 'CRM_Core_BAO_Job', 'localizable' => 0, - ) , - 'scheduled_run_date' => array( + ], + 'scheduled_run_date' => [ 'name' => 'scheduled_run_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Scheduled Run Date') , + 'title' => ts('Scheduled Run Date'), 'description' => 'When is this cron entry scheduled to run', - 'required' => false, + 'required' => FALSE, 'default' => 'NULL', 'table_name' => 'civicrm_job', 'entity' => 'Job', 'bao' => 'CRM_Core_BAO_Job', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Job Name') , + 'title' => ts('Job Name'), 'description' => 'Title of the job', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -227,11 +218,11 @@ static function &fields() { 'entity' => 'Job', 'bao' => 'CRM_Core_BAO_Job', 'localizable' => 0, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Job Description') , + 'title' => ts('Job Description'), 'description' => 'Description of the job', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -239,11 +230,11 @@ static function &fields() { 'entity' => 'Job', 'bao' => 'CRM_Core_BAO_Job', 'localizable' => 0, - ) , - 'api_entity' => array( + ], + 'api_entity' => [ 'name' => 'api_entity', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('API Entity') , + 'title' => ts('API Entity'), 'description' => 'Entity of the job api call', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -251,11 +242,11 @@ static function &fields() { 'entity' => 'Job', 'bao' => 'CRM_Core_BAO_Job', 'localizable' => 0, - ) , - 'api_action' => array( + ], + 'api_action' => [ 'name' => 'api_action', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('API Action') , + 'title' => ts('API Action'), 'description' => 'Action of the job api call', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -263,11 +254,11 @@ static function &fields() { 'entity' => 'Job', 'bao' => 'CRM_Core_BAO_Job', 'localizable' => 0, - ) , - 'parameters' => array( + ], + 'parameters' => [ 'name' => 'parameters', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('API Parameters') , + 'title' => ts('API Parameters'), 'description' => 'List of parameters to the command.', 'rows' => 4, 'cols' => 60, @@ -275,53 +266,57 @@ static function &fields() { 'entity' => 'Job', 'bao' => 'CRM_Core_BAO_Job', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'is_active' => array( + ], + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Job Is Active?') , + 'title' => ts('Job Is Active?'), 'description' => 'Is this job active?', 'table_name' => 'civicrm_job', 'entity' => 'Job', 'bao' => 'CRM_Core_BAO_Job', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -329,10 +324,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -340,15 +336,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/JobLog.php b/CRM/Core/DAO/JobLog.php index caf58d8c82a4..f441f19c34b3 100644 --- a/CRM/Core/DAO/JobLog.php +++ b/CRM/Core/DAO/JobLog.php @@ -1,29 +1,5 @@ __table = 'civicrm_job_log'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Job Log ID') , + 'title' => ts('Job Log ID'), 'description' => 'Job log entry Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_job_log', 'entity' => 'JobLog', 'bao' => 'CRM_Core_DAO_JobLog', 'localizable' => 0, - ) , - 'domain_id' => array( + ], + 'domain_id' => [ 'name' => 'domain_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Domain ID') , + 'title' => ts('Domain ID'), 'description' => 'Which Domain is this scheduled job for', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_job_log', 'entity' => 'JobLog', 'bao' => 'CRM_Core_DAO_JobLog', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Domain', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'run_time' => array( + ] + ], + 'run_time' => [ 'name' => 'run_time', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Timestamp') , + 'title' => ts('Timestamp'), 'description' => 'Log entry date', 'table_name' => 'civicrm_job_log', 'entity' => 'JobLog', 'bao' => 'CRM_Core_DAO_JobLog', 'localizable' => 0, - ) , - 'job_id' => array( + ], + 'job_id' => [ 'name' => 'job_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Job ID') , + 'title' => ts('Job ID'), 'description' => 'Pointer to job id - not a FK though, just for logging purposes', 'table_name' => 'civicrm_job_log', 'entity' => 'JobLog', 'bao' => 'CRM_Core_DAO_JobLog', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Job Name') , + 'title' => ts('Job Name'), 'description' => 'Title of the job', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -186,11 +174,11 @@ static function &fields() { 'entity' => 'JobLog', 'bao' => 'CRM_Core_DAO_JobLog', 'localizable' => 0, - ) , - 'command' => array( + ], + 'command' => [ 'name' => 'command', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Command') , + 'title' => ts('Command'), 'description' => 'Full path to file containing job script', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -198,11 +186,11 @@ static function &fields() { 'entity' => 'JobLog', 'bao' => 'CRM_Core_DAO_JobLog', 'localizable' => 0, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Description') , + 'title' => ts('Description'), 'description' => 'Title line of log entry', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -210,50 +198,54 @@ static function &fields() { 'entity' => 'JobLog', 'bao' => 'CRM_Core_DAO_JobLog', 'localizable' => 0, - ) , - 'data' => array( + ], + 'data' => [ 'name' => 'data', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Extended Data') , + 'title' => ts('Extended Data'), 'description' => 'Potential extended data for specific job run (e.g. tracebacks).', 'table_name' => 'civicrm_job_log', 'entity' => 'JobLog', 'bao' => 'CRM_Core_DAO_JobLog', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -261,10 +253,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job_log', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job_log', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -272,15 +265,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job_log', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job_log', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/LocBlock.php b/CRM/Core/DAO/LocBlock.php index e4afbe8607b6..e6edb4d73c39 100644 --- a/CRM/Core/DAO/LocBlock.php +++ b/CRM/Core/DAO/LocBlock.php @@ -1,29 +1,5 @@ __table = 'civicrm_loc_block'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'address_id', 'civicrm_address', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'email_id', 'civicrm_email', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'phone_id', 'civicrm_phone', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'im_id', 'civicrm_im', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'address_2_id', 'civicrm_address', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'email_2_id', 'civicrm_email', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'phone_2_id', 'civicrm_phone', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'im_2_id', 'civicrm_im', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'address_id', 'civicrm_address', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_id', 'civicrm_email', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_id', 'civicrm_phone', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'im_id', 'civicrm_im', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'address_2_id', 'civicrm_address', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_2_id', 'civicrm_email', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_2_id', 'civicrm_phone', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'im_2_id', 'civicrm_im', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Location Block ID') , + 'title' => ts('Location Block ID'), 'description' => 'Unique ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_loc_block', 'entity' => 'LocBlock', 'bao' => 'CRM_Core_DAO_LocBlock', 'localizable' => 0, - ) , - 'address_id' => array( + ], + 'address_id' => [ 'name' => 'address_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Location Block Address') , + 'title' => ts('Location Block Address'), 'table_name' => 'civicrm_loc_block', 'entity' => 'LocBlock', 'bao' => 'CRM_Core_DAO_LocBlock', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Address', - ) , - 'email_id' => array( + ], + 'email_id' => [ 'name' => 'email_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Location Block Email') , + 'title' => ts('Location Block Email'), 'table_name' => 'civicrm_loc_block', 'entity' => 'LocBlock', 'bao' => 'CRM_Core_DAO_LocBlock', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Email', - ) , - 'phone_id' => array( + ], + 'phone_id' => [ 'name' => 'phone_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Location Block Phone') , + 'title' => ts('Location Block Phone'), 'table_name' => 'civicrm_loc_block', 'entity' => 'LocBlock', 'bao' => 'CRM_Core_DAO_LocBlock', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Phone', - ) , - 'im_id' => array( + ], + 'im_id' => [ 'name' => 'im_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Location Block IM') , + 'title' => ts('Location Block IM'), 'table_name' => 'civicrm_loc_block', 'entity' => 'LocBlock', 'bao' => 'CRM_Core_DAO_LocBlock', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_IM', - ) , - 'address_2_id' => array( + ], + 'address_2_id' => [ 'name' => 'address_2_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Location Block IM 2') , + 'title' => ts('Location Block IM 2'), 'table_name' => 'civicrm_loc_block', 'entity' => 'LocBlock', 'bao' => 'CRM_Core_DAO_LocBlock', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Address', - ) , - 'email_2_id' => array( + ], + 'email_2_id' => [ 'name' => 'email_2_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Email 2') , + 'title' => ts('Email 2'), 'table_name' => 'civicrm_loc_block', 'entity' => 'LocBlock', 'bao' => 'CRM_Core_DAO_LocBlock', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Email', - ) , - 'phone_2_id' => array( + ], + 'phone_2_id' => [ 'name' => 'phone_2_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Phone 2') , + 'title' => ts('Phone 2'), 'table_name' => 'civicrm_loc_block', 'entity' => 'LocBlock', 'bao' => 'CRM_Core_DAO_LocBlock', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Phone', - ) , - 'im_2_id' => array( + ], + 'im_2_id' => [ 'name' => 'im_2_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Instant Messenger 2') , + 'title' => ts('Instant Messenger 2'), 'table_name' => 'civicrm_loc_block', 'entity' => 'LocBlock', 'bao' => 'CRM_Core_DAO_LocBlock', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_IM', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -263,10 +248,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'loc_block', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'loc_block', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -274,15 +260,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'loc_block', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'loc_block', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/LocationType.php b/CRM/Core/DAO/LocationType.php index 4c09e883ef7b..fedb851cc357 100644 --- a/CRM/Core/DAO/LocationType.php +++ b/CRM/Core/DAO/LocationType.php @@ -1,29 +1,5 @@ __table = 'civicrm_location_type'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Location Type ID') , + 'title' => ts('Location Type ID'), 'description' => 'Location Type ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_location_type', 'entity' => 'LocationType', 'bao' => 'CRM_Core_BAO_LocationType', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Location Type') , + 'title' => ts('Location Type'), 'description' => 'Location Type Name.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -135,11 +122,11 @@ static function &fields() { 'entity' => 'LocationType', 'bao' => 'CRM_Core_BAO_LocationType', 'localizable' => 0, - ) , - 'display_name' => array( + ], + 'display_name' => [ 'name' => 'display_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Display Name') , + 'title' => ts('Display Name'), 'description' => 'Location Type Display Name.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -147,11 +134,11 @@ static function &fields() { 'entity' => 'LocationType', 'bao' => 'CRM_Core_BAO_LocationType', 'localizable' => 1, - ) , - 'vcard_name' => array( + ], + 'vcard_name' => [ 'name' => 'vcard_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('vCard Location Type') , + 'title' => ts('vCard Location Type'), 'description' => 'vCard Location Type Name.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -159,11 +146,11 @@ static function &fields() { 'entity' => 'LocationType', 'bao' => 'CRM_Core_BAO_LocationType', 'localizable' => 0, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Description') , + 'title' => ts('Description'), 'description' => 'Location Type Description.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -171,70 +158,74 @@ static function &fields() { 'entity' => 'LocationType', 'bao' => 'CRM_Core_BAO_LocationType', 'localizable' => 0, - ) , - 'is_reserved' => array( + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Location Type is Reserved?') , + 'title' => ts('Location Type is Reserved?'), 'description' => 'Is this location type a predefined system location?', 'table_name' => 'civicrm_location_type', 'entity' => 'LocationType', 'bao' => 'CRM_Core_BAO_LocationType', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Location Type is Active?') , + 'title' => ts('Location Type is Active?'), 'description' => 'Is this property active?', 'table_name' => 'civicrm_location_type', 'entity' => 'LocationType', 'bao' => 'CRM_Core_BAO_LocationType', 'localizable' => 0, - ) , - 'is_default' => array( + ], + 'is_default' => [ 'name' => 'is_default', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Default Location Type?') , + 'title' => ts('Default Location Type?'), 'description' => 'Is this location type the default?', 'table_name' => 'civicrm_location_type', 'entity' => 'LocationType', 'bao' => 'CRM_Core_BAO_LocationType', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -242,10 +233,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'location_type', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'location_type', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -253,25 +245,31 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'location_type', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'location_type', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_name' => array( + $indices = [ + 'UI_name' => [ 'name' => 'UI_name', - 'field' => array( + 'field' => [ 0 => 'name', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_location_type::1::name', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Log.php b/CRM/Core/DAO/Log.php index 3a0b9685d68d..9c265e4747b4 100644 --- a/CRM/Core/DAO/Log.php +++ b/CRM/Core/DAO/Log.php @@ -1,29 +1,5 @@ __table = 'civicrm_log'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'modified_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'modified_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Log ID') , + 'title' => ts('Log ID'), 'description' => 'Log ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_log', 'entity' => 'Log', 'bao' => 'CRM_Core_BAO_Log', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Table') , + 'title' => ts('Entity Table'), 'description' => 'Name of table where item being referenced is stored.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_log', 'entity' => 'Log', 'bao' => 'CRM_Core_BAO_Log', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity ID ') , + 'title' => ts('Entity ID '), 'description' => 'Foreign key to the referenced item.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_log', 'entity' => 'Log', 'bao' => 'CRM_Core_BAO_Log', 'localizable' => 0, - ) , - 'data' => array( + ], + 'data' => [ 'name' => 'data', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Data') , + 'title' => ts('Data'), 'description' => 'Updates does to this object if any.', 'table_name' => 'civicrm_log', 'entity' => 'Log', 'bao' => 'CRM_Core_BAO_Log', 'localizable' => 0, - ) , - 'modified_id' => array( + ], + 'modified_id' => [ 'name' => 'modified_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Modified By') , + 'title' => ts('Modified By'), 'description' => 'FK to Contact ID of person under whose credentials this data modification was made.', 'table_name' => 'civicrm_log', 'entity' => 'Log', 'bao' => 'CRM_Core_BAO_Log', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'modified_date' => array( + ], + 'modified_date' => [ 'name' => 'modified_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Modified Date') , + 'title' => ts('Modified Date'), 'description' => 'When was the referenced entity created or modified or deleted.', 'table_name' => 'civicrm_log', 'entity' => 'Log', 'bao' => 'CRM_Core_BAO_Log', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -222,10 +212,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'log', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'log', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -233,25 +224,31 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'log', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'log', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_entity' => array( + $indices = [ + 'index_entity' => [ 'name' => 'index_entity', - 'field' => array( + 'field' => [ 0 => 'entity_table', 1 => 'entity_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_log::0::entity_table::entity_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/MailSettings.php b/CRM/Core/DAO/MailSettings.php index 10b2a914df47..3b1964d6fe5a 100644 --- a/CRM/Core/DAO/MailSettings.php +++ b/CRM/Core/DAO/MailSettings.php @@ -1,29 +1,5 @@ __table = 'civicrm_mail_settings'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mail Settings ID') , + 'title' => ts('Mail Settings ID'), 'description' => 'primary key', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mail_settings', 'entity' => 'MailSettings', 'bao' => 'CRM_Core_BAO_MailSettings', 'localizable' => 0, - ) , - 'domain_id' => array( + ], + 'domain_id' => [ 'name' => 'domain_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mail Settings Domain') , + 'title' => ts('Mail Settings Domain'), 'description' => 'Which Domain is this match entry for', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mail_settings', 'entity' => 'MailSettings', 'bao' => 'CRM_Core_BAO_MailSettings', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Domain', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'name' => array( + ] + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mail Settings Name') , + 'title' => ts('Mail Settings Name'), 'description' => 'name of this group of settings', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -208,21 +203,21 @@ static function &fields() { 'entity' => 'MailSettings', 'bao' => 'CRM_Core_BAO_MailSettings', 'localizable' => 0, - ) , - 'is_default' => array( + ], + 'is_default' => [ 'name' => 'is_default', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Default Mail Settings?') , + 'title' => ts('Is Default Mail Settings?'), 'description' => 'whether this is the default set of settings for this domain', 'table_name' => 'civicrm_mail_settings', 'entity' => 'MailSettings', 'bao' => 'CRM_Core_BAO_MailSettings', 'localizable' => 0, - ) , - 'domain' => array( + ], + 'domain' => [ 'name' => 'domain', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('email Domain') , + 'title' => ts('email Domain'), 'description' => 'email address domain (the part after @)', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -230,11 +225,11 @@ static function &fields() { 'entity' => 'MailSettings', 'bao' => 'CRM_Core_BAO_MailSettings', 'localizable' => 0, - ) , - 'localpart' => array( + ], + 'localpart' => [ 'name' => 'localpart', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('email Local Part') , + 'title' => ts('email Local Part'), 'description' => 'optional local part (like civimail+ for addresses like civimail+s.1.2@example.com)', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -242,11 +237,11 @@ static function &fields() { 'entity' => 'MailSettings', 'bao' => 'CRM_Core_BAO_MailSettings', 'localizable' => 0, - ) , - 'return_path' => array( + ], + 'return_path' => [ 'name' => 'return_path', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Return Path') , + 'title' => ts('Return Path'), 'description' => 'contents of the Return-Path header', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -254,11 +249,11 @@ static function &fields() { 'entity' => 'MailSettings', 'bao' => 'CRM_Core_BAO_MailSettings', 'localizable' => 0, - ) , - 'protocol' => array( + ], + 'protocol' => [ 'name' => 'protocol', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Protocol') , + 'title' => ts('Protocol'), 'description' => 'name of the protocol to use for polling (like IMAP, POP3 or Maildir)', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -266,18 +261,18 @@ static function &fields() { 'entity' => 'MailSettings', 'bao' => 'CRM_Core_BAO_MailSettings', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'mail_protocol', 'optionEditPath' => 'civicrm/admin/options/mail_protocol', - ) - ) , - 'server' => array( + ] + ], + 'server' => [ 'name' => 'server', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mail Server') , + 'title' => ts('Mail Server'), 'description' => 'server to use when polling', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -285,21 +280,21 @@ static function &fields() { 'entity' => 'MailSettings', 'bao' => 'CRM_Core_BAO_MailSettings', 'localizable' => 0, - ) , - 'port' => array( + ], + 'port' => [ 'name' => 'port', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mail Port') , + 'title' => ts('Mail Port'), 'description' => 'port to use when polling', 'table_name' => 'civicrm_mail_settings', 'entity' => 'MailSettings', 'bao' => 'CRM_Core_BAO_MailSettings', 'localizable' => 0, - ) , - 'username' => array( + ], + 'username' => [ 'name' => 'username', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mail Account Username') , + 'title' => ts('Mail Account Username'), 'description' => 'username to use when polling', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -307,11 +302,11 @@ static function &fields() { 'entity' => 'MailSettings', 'bao' => 'CRM_Core_BAO_MailSettings', 'localizable' => 0, - ) , - 'password' => array( + ], + 'password' => [ 'name' => 'password', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mail Account Password') , + 'title' => ts('Mail Account Password'), 'description' => 'password to use when polling', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -319,21 +314,21 @@ static function &fields() { 'entity' => 'MailSettings', 'bao' => 'CRM_Core_BAO_MailSettings', 'localizable' => 0, - ) , - 'is_ssl' => array( + ], + 'is_ssl' => [ 'name' => 'is_ssl', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Mail Account Uses SSL') , + 'title' => ts('Mail Account Uses SSL'), 'description' => 'whether to use SSL or not', 'table_name' => 'civicrm_mail_settings', 'entity' => 'MailSettings', 'bao' => 'CRM_Core_BAO_MailSettings', 'localizable' => 0, - ) , - 'source' => array( + ], + 'source' => [ 'name' => 'source', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mail Folder') , + 'title' => ts('Mail Folder'), 'description' => 'folder to poll from when using IMAP, path to poll from when using Maildir, etc.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -341,11 +336,11 @@ static function &fields() { 'entity' => 'MailSettings', 'bao' => 'CRM_Core_BAO_MailSettings', 'localizable' => 0, - ) , - 'activity_status' => array( + ], + 'activity_status' => [ 'name' => 'activity_status', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Activity Status') , + 'title' => ts('Activity Status'), 'description' => 'Name of status to use when creating email to activity.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -353,48 +348,52 @@ static function &fields() { 'entity' => 'MailSettings', 'bao' => 'CRM_Core_BAO_MailSettings', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'activity_status', 'keyColumn' => 'name', 'optionEditPath' => 'civicrm/admin/options/activity_status', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -402,10 +401,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mail_settings', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mail_settings', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -413,15 +413,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mail_settings', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mail_settings', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Managed.php b/CRM/Core/DAO/Managed.php index d1d2e9517822..3349673c5299 100644 --- a/CRM/Core/DAO/Managed.php +++ b/CRM/Core/DAO/Managed.php @@ -1,29 +1,5 @@ __table = 'civicrm_managed'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Managed ID') , + 'title' => ts('Managed ID'), 'description' => 'Surrogate Key', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_managed', 'entity' => 'Managed', 'bao' => 'CRM_Core_DAO_Managed', 'localizable' => 0, - ) , - 'module' => array( + ], + 'module' => [ 'name' => 'module', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Module') , + 'title' => ts('Module'), 'description' => 'Name of the module which declared this object', - 'required' => true, + 'required' => TRUE, 'maxlength' => 127, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_managed', 'entity' => 'Managed', 'bao' => 'CRM_Core_DAO_Managed', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Name') , + 'title' => ts('Name'), 'description' => 'Symbolic name used by the module to identify the object', 'maxlength' => 127, 'size' => CRM_Utils_Type::HUGE, @@ -136,35 +121,35 @@ static function &fields() { 'entity' => 'Managed', 'bao' => 'CRM_Core_DAO_Managed', 'localizable' => 0, - ) , - 'entity_type' => array( + ], + 'entity_type' => [ 'name' => 'entity_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Type') , + 'title' => ts('Entity Type'), 'description' => 'API entity type', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_managed', 'entity' => 'Managed', 'bao' => 'CRM_Core_DAO_Managed', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity ID') , + 'title' => ts('Entity ID'), 'description' => 'Foreign key to the referenced item.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_managed', 'entity' => 'Managed', 'bao' => 'CRM_Core_DAO_Managed', 'localizable' => 0, - ) , - 'cleanup' => array( + ], + 'cleanup' => [ 'name' => 'cleanup', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Cleanup Setting') , + 'title' => ts('Cleanup Setting'), 'description' => 'Policy on when to cleanup entity (always, never, unused)', 'maxlength' => 32, 'size' => CRM_Utils_Type::MEDIUM, @@ -172,46 +157,50 @@ static function &fields() { 'entity' => 'Managed', 'bao' => 'CRM_Core_DAO_Managed', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_ManagedEntities::getCleanupOptions', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -219,10 +208,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'managed', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'managed', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -230,34 +220,40 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'managed', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'managed', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_managed_module_name' => array( + $indices = [ + 'UI_managed_module_name' => [ 'name' => 'UI_managed_module_name', - 'field' => array( + 'field' => [ 0 => 'module', 1 => 'name', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_managed::0::module::name', - ) , - 'UI_managed_entity' => array( + ], + 'UI_managed_entity' => [ 'name' => 'UI_managed_entity', - 'field' => array( + 'field' => [ 0 => 'entity_type', 1 => 'entity_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_managed::0::entity_type::entity_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Mapping.php b/CRM/Core/DAO/Mapping.php index b9d66a767a2e..80d1edda9aa4 100644 --- a/CRM/Core/DAO/Mapping.php +++ b/CRM/Core/DAO/Mapping.php @@ -1,29 +1,5 @@ __table = 'civicrm_mapping'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mapping ID') , + 'title' => ts('Mapping ID'), 'description' => 'Mapping ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mapping', 'entity' => 'Mapping', 'bao' => 'CRM_Core_BAO_Mapping', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Name') , + 'title' => ts('Name'), 'description' => 'Name of Mapping', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -111,11 +94,11 @@ static function &fields() { 'entity' => 'Mapping', 'bao' => 'CRM_Core_BAO_Mapping', 'localizable' => 0, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Description') , + 'title' => ts('Description'), 'description' => 'Description of Mapping.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -123,57 +106,61 @@ static function &fields() { 'entity' => 'Mapping', 'bao' => 'CRM_Core_BAO_Mapping', 'localizable' => 0, - ) , - 'mapping_type_id' => array( + ], + 'mapping_type_id' => [ 'name' => 'mapping_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mapping Type') , + 'title' => ts('Mapping Type'), 'description' => 'Mapping Type', 'table_name' => 'civicrm_mapping', 'entity' => 'Mapping', 'bao' => 'CRM_Core_BAO_Mapping', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'mapping_type', 'optionEditPath' => 'civicrm/admin/options/mapping_type', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -181,10 +168,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mapping', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mapping', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -192,24 +180,30 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mapping', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mapping', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_name' => array( + $indices = [ + 'UI_name' => [ 'name' => 'UI_name', - 'field' => array( + 'field' => [ 0 => 'name', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_mapping::0::name', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/MappingField.php b/CRM/Core/DAO/MappingField.php index 7b22b73f4085..6216bb9398d7 100644 --- a/CRM/Core/DAO/MappingField.php +++ b/CRM/Core/DAO/MappingField.php @@ -1,29 +1,5 @@ __table = 'civicrm_mapping_field'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'mapping_id', 'civicrm_mapping', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'location_type_id', 'civicrm_location_type', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'relationship_type_id', 'civicrm_relationship_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mapping_id', 'civicrm_mapping', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'location_type_id', 'civicrm_location_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'relationship_type_id', 'civicrm_relationship_type', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mapping Field ID') , + 'title' => ts('Mapping Field ID'), 'description' => 'Mapping Field ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mapping_field', 'entity' => 'MappingField', 'bao' => 'CRM_Core_DAO_MappingField', 'localizable' => 0, - ) , - 'mapping_id' => array( + ], + 'mapping_id' => [ 'name' => 'mapping_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mapping ID') , + 'title' => ts('Mapping ID'), 'description' => 'Mapping to which this field belongs', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mapping_field', 'entity' => 'MappingField', 'bao' => 'CRM_Core_DAO_MappingField', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Mapping', - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Name') , + 'title' => ts('Name'), 'description' => 'Mapping field key', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -199,11 +192,11 @@ static function &fields() { 'entity' => 'MappingField', 'bao' => 'CRM_Core_DAO_MappingField', 'localizable' => 0, - ) , - 'contact_type' => array( + ], + 'contact_type' => [ 'name' => 'contact_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Contact Type') , + 'title' => ts('Contact Type'), 'description' => 'Contact Type in mapping', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -211,102 +204,102 @@ static function &fields() { 'entity' => 'MappingField', 'bao' => 'CRM_Core_DAO_MappingField', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - ) , - 'column_number' => array( + ], + ], + 'column_number' => [ 'name' => 'column_number', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Column Number') , + 'title' => ts('Column Number'), 'description' => 'Column number for mapping set', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mapping_field', 'entity' => 'MappingField', 'bao' => 'CRM_Core_DAO_MappingField', 'localizable' => 0, - ) , - 'location_type_id' => array( + ], + 'location_type_id' => [ 'name' => 'location_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Location type ID') , + 'title' => ts('Location type ID'), 'description' => 'Location type of this mapping, if required', 'table_name' => 'civicrm_mapping_field', 'entity' => 'MappingField', 'bao' => 'CRM_Core_DAO_MappingField', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_LocationType', - ) , - 'phone_type_id' => array( + ], + 'phone_type_id' => [ 'name' => 'phone_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Phone type ID') , + 'title' => ts('Phone type ID'), 'description' => 'Which type of phone does this number belongs.', 'table_name' => 'civicrm_mapping_field', 'entity' => 'MappingField', 'bao' => 'CRM_Core_DAO_MappingField', 'localizable' => 0, - ) , - 'im_provider_id' => array( + ], + 'im_provider_id' => [ 'name' => 'im_provider_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('IM provider ID') , + 'title' => ts('IM provider ID'), 'description' => 'Which type of IM Provider does this name belong.', 'table_name' => 'civicrm_mapping_field', 'entity' => 'MappingField', 'bao' => 'CRM_Core_DAO_MappingField', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'instant_messenger_service', 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service', - ) - ) , - 'website_type_id' => array( + ] + ], + 'website_type_id' => [ 'name' => 'website_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Website type ID') , + 'title' => ts('Website type ID'), 'description' => 'Which type of website does this site belong', 'table_name' => 'civicrm_mapping_field', 'entity' => 'MappingField', 'bao' => 'CRM_Core_DAO_MappingField', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'website_type', 'optionEditPath' => 'civicrm/admin/options/website_type', - ) - ) , - 'relationship_type_id' => array( + ] + ], + 'relationship_type_id' => [ 'name' => 'relationship_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Relationship type ID') , + 'title' => ts('Relationship type ID'), 'description' => 'Relationship type, if required', 'table_name' => 'civicrm_mapping_field', 'entity' => 'MappingField', 'bao' => 'CRM_Core_DAO_MappingField', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_RelationshipType', - ) , - 'relationship_direction' => array( + ], + 'relationship_direction' => [ 'name' => 'relationship_direction', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Relationship Direction') , + 'title' => ts('Relationship Direction'), 'maxlength' => 6, 'size' => CRM_Utils_Type::SIX, 'table_name' => 'civicrm_mapping_field', 'entity' => 'MappingField', 'bao' => 'CRM_Core_DAO_MappingField', 'localizable' => 0, - ) , - 'grouping' => array( + ], + 'grouping' => [ 'name' => 'grouping', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Grouping') , + 'title' => ts('Grouping'), 'description' => 'Used to group mapping_field records into related sets (e.g. for criteria sets in search builder mappings). ', @@ -315,11 +308,11 @@ static function &fields() { 'entity' => 'MappingField', 'bao' => 'CRM_Core_DAO_MappingField', 'localizable' => 0, - ) , - 'operator' => array( + ], + 'operator' => [ 'name' => 'operator', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Operator') , + 'title' => ts('Operator'), 'description' => 'SQL WHERE operator for search-builder mapping fields (search criteria).', 'maxlength' => 16, 'size' => CRM_Utils_Type::TWELVE, @@ -327,17 +320,17 @@ static function &fields() { 'entity' => 'MappingField', 'bao' => 'CRM_Core_DAO_MappingField', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators', - ) - ) , - 'value' => array( + ] + ], + 'value' => [ 'name' => 'value', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Value') , + 'title' => ts('Value'), 'description' => 'SQL WHERE value for search-builder mapping fields.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -345,40 +338,44 @@ static function &fields() { 'entity' => 'MappingField', 'bao' => 'CRM_Core_DAO_MappingField', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -386,10 +383,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mapping_field', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mapping_field', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -397,15 +395,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mapping_field', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mapping_field', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Menu.php b/CRM/Core/DAO/Menu.php index 47e561c1f12b..ab2eb48eff7d 100644 --- a/CRM/Core/DAO/Menu.php +++ b/CRM/Core/DAO/Menu.php @@ -1,29 +1,5 @@ __table = 'civicrm_menu'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'component_id', 'civicrm_component', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'component_id', 'civicrm_component', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Menu ID') , - 'required' => true, + 'title' => ts('Menu ID'), + 'required' => TRUE, 'table_name' => 'civicrm_menu', 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'domain_id' => array( + ], + 'domain_id' => [ 'name' => 'domain_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Domain') , + 'title' => ts('Domain'), 'description' => 'Which Domain is this menu item for', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_menu', 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Domain', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'path' => array( + ] + ], + 'path' => [ 'name' => 'path', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Path') , + 'title' => ts('Path'), 'description' => 'Path Name', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -248,32 +248,32 @@ static function &fields() { 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'path_arguments' => array( + ], + 'path_arguments' => [ 'name' => 'path_arguments', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Arguments') , + 'title' => ts('Arguments'), 'description' => 'Arguments to pass to the url', 'table_name' => 'civicrm_menu', 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'title' => array( + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Menu Title') , + 'title' => ts('Menu Title'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_menu', 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'access_callback' => array( + ], + 'access_callback' => [ 'name' => 'access_callback', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Access Callback') , + 'title' => ts('Access Callback'), 'description' => 'Function to call to check access permissions', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -281,21 +281,21 @@ static function &fields() { 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'access_arguments' => array( + ], + 'access_arguments' => [ 'name' => 'access_arguments', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Access Arguments') , + 'title' => ts('Access Arguments'), 'description' => 'Arguments to pass to access callback', 'table_name' => 'civicrm_menu', 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'page_callback' => array( + ], + 'page_callback' => [ 'name' => 'page_callback', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Page Callback') , + 'title' => ts('Page Callback'), 'description' => 'function to call for this url', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -303,31 +303,31 @@ static function &fields() { 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'page_arguments' => array( + ], + 'page_arguments' => [ 'name' => 'page_arguments', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Page Arguments') , + 'title' => ts('Page Arguments'), 'description' => 'Arguments to pass to page callback', 'table_name' => 'civicrm_menu', 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'breadcrumb' => array( + ], + 'breadcrumb' => [ 'name' => 'breadcrumb', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Breadcrumb') , + 'title' => ts('Breadcrumb'), 'description' => 'Breadcrumb for the path.', 'table_name' => 'civicrm_menu', 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'return_url' => array( + ], + 'return_url' => [ 'name' => 'return_url', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Return Url') , + 'title' => ts('Return Url'), 'description' => 'Url where a page should redirected to, if next url not known.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -335,11 +335,11 @@ static function &fields() { 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'return_url_args' => array( + ], + 'return_url_args' => [ 'name' => 'return_url_args', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Return Url Args') , + 'title' => ts('Return Url Args'), 'description' => 'Arguments to pass to return_url', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -347,155 +347,159 @@ static function &fields() { 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'component_id' => array( + ], + 'component_id' => [ 'name' => 'component_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Component') , + 'title' => ts('Component'), 'description' => 'Component that this menu item belongs to', 'table_name' => 'civicrm_menu', 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Component', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_component', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'is_active' => array( + ] + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Enabled?') , + 'title' => ts('Enabled?'), 'description' => 'Is this menu item active?', 'table_name' => 'civicrm_menu', 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'is_public' => array( + ], + 'is_public' => [ 'name' => 'is_public', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Public?') , + 'title' => ts('Public?'), 'description' => 'Is this menu accessible to the public?', 'table_name' => 'civicrm_menu', 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'is_exposed' => array( + ], + 'is_exposed' => [ 'name' => 'is_exposed', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Exposed?') , + 'title' => ts('Exposed?'), 'description' => 'Is this menu exposed to the navigation system?', 'table_name' => 'civicrm_menu', 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'is_ssl' => array( + ], + 'is_ssl' => [ 'name' => 'is_ssl', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Use SSL?') , + 'title' => ts('Use SSL?'), 'description' => 'Should this menu be exposed via SSL if enabled?', 'table_name' => 'civicrm_menu', 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'weight' => array( + ], + 'weight' => [ 'name' => 'weight', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Order') , + 'title' => ts('Order'), 'description' => 'Ordering of the menu items in various blocks.', - 'required' => true, + 'required' => TRUE, 'default' => '1', 'table_name' => 'civicrm_menu', 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'type' => array( + ], + 'type' => [ 'name' => 'type', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Type') , + 'title' => ts('Type'), 'description' => 'Drupal menu type.', - 'required' => true, + 'required' => TRUE, 'default' => '1', 'table_name' => 'civicrm_menu', 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'page_type' => array( + ], + 'page_type' => [ 'name' => 'page_type', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Page Type') , + 'title' => ts('Page Type'), 'description' => 'CiviCRM menu type.', - 'required' => true, + 'required' => TRUE, 'default' => '1', 'table_name' => 'civicrm_menu', 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'skipBreadcrumb' => array( + ], + 'skipBreadcrumb' => [ 'name' => 'skipBreadcrumb', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Hide Breadcrumb?') , + 'title' => ts('Hide Breadcrumb?'), 'description' => 'skip this url being exposed to breadcrumb', 'table_name' => 'civicrm_menu', 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - 'module_data' => array( + ], + 'module_data' => [ 'name' => 'module_data', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Other menu data') , + 'title' => ts('Other menu data'), 'description' => 'All other menu metadata not stored in other fields', 'table_name' => 'civicrm_menu', 'entity' => 'Menu', 'bao' => 'CRM_Core_DAO_Menu', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -503,10 +507,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'menu', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'menu', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -514,26 +519,32 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'menu', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'menu', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_path_domain_id' => array( + $indices = [ + 'UI_path_domain_id' => [ 'name' => 'UI_path_domain_id', - 'field' => array( + 'field' => [ 0 => 'path', 1 => 'domain_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_menu::1::path::domain_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/MessageTemplate.php b/CRM/Core/DAO/MessageTemplate.php index 0cad129c32bb..af00820f9101 100644 --- a/CRM/Core/DAO/MessageTemplate.php +++ b/CRM/Core/DAO/MessageTemplate.php @@ -1,29 +1,5 @@ __table = 'civicrm_msg_template'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Message Template ID') , + 'title' => ts('Message Template ID'), 'description' => 'Message Template ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_msg_template', 'entity' => 'MessageTemplate', 'bao' => 'CRM_Core_BAO_MessageTemplate', 'localizable' => 0, - ) , - 'msg_title' => array( + ], + 'msg_title' => [ 'name' => 'msg_title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Message Template Title') , + 'title' => ts('Message Template Title'), 'description' => 'Descriptive title of message', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -152,142 +141,146 @@ static function &fields() { 'entity' => 'MessageTemplate', 'bao' => 'CRM_Core_BAO_MessageTemplate', 'localizable' => 0, - ) , - 'msg_subject' => array( + ], + 'msg_subject' => [ 'name' => 'msg_subject', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Message Template Subject') , + 'title' => ts('Message Template Subject'), 'description' => 'Subject for email message.', 'table_name' => 'civicrm_msg_template', 'entity' => 'MessageTemplate', 'bao' => 'CRM_Core_BAO_MessageTemplate', 'localizable' => 0, - ) , - 'msg_text' => array( + ], + 'msg_text' => [ 'name' => 'msg_text', 'type' => CRM_Utils_Type::T_LONGTEXT, - 'title' => ts('Message Template Text') , + 'title' => ts('Message Template Text'), 'description' => 'Text formatted message', 'table_name' => 'civicrm_msg_template', 'entity' => 'MessageTemplate', 'bao' => 'CRM_Core_BAO_MessageTemplate', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'msg_html' => array( + ], + ], + 'msg_html' => [ 'name' => 'msg_html', 'type' => CRM_Utils_Type::T_LONGTEXT, - 'title' => ts('Message Template HTML') , + 'title' => ts('Message Template HTML'), 'description' => 'HTML formatted message', 'table_name' => 'civicrm_msg_template', 'entity' => 'MessageTemplate', 'bao' => 'CRM_Core_BAO_MessageTemplate', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'RichTextEditor', - ) , - ) , - 'is_active' => array( + ], + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Active') , + 'title' => ts('Is Active'), 'default' => '1', 'table_name' => 'civicrm_msg_template', 'entity' => 'MessageTemplate', 'bao' => 'CRM_Core_BAO_MessageTemplate', 'localizable' => 0, - ) , - 'workflow_id' => array( + ], + 'workflow_id' => [ 'name' => 'workflow_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Message Template Workflow') , + 'title' => ts('Message Template Workflow'), 'description' => 'a pseudo-FK to civicrm_option_value', 'table_name' => 'civicrm_msg_template', 'entity' => 'MessageTemplate', 'bao' => 'CRM_Core_BAO_MessageTemplate', 'localizable' => 0, - ) , - 'is_default' => array( + ], + 'is_default' => [ 'name' => 'is_default', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Message Template Is Default?') , + 'title' => ts('Message Template Is Default?'), 'description' => 'is this the default message template for the workflow referenced by workflow_id?', 'default' => '1', 'table_name' => 'civicrm_msg_template', 'entity' => 'MessageTemplate', 'bao' => 'CRM_Core_BAO_MessageTemplate', 'localizable' => 0, - ) , - 'is_reserved' => array( + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Message Template Is Reserved?') , + 'title' => ts('Message Template Is Reserved?'), 'description' => 'is this the reserved message template which we ship for the workflow referenced by workflow_id?', 'table_name' => 'civicrm_msg_template', 'entity' => 'MessageTemplate', 'bao' => 'CRM_Core_BAO_MessageTemplate', 'localizable' => 0, - ) , - 'is_sms' => array( + ], + 'is_sms' => [ 'name' => 'is_sms', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Message Template is used for SMS?') , + 'title' => ts('Message Template is used for SMS?'), 'description' => 'Is this message template used for sms?', 'table_name' => 'civicrm_msg_template', 'entity' => 'MessageTemplate', 'bao' => 'CRM_Core_BAO_MessageTemplate', 'localizable' => 0, - ) , - 'pdf_format_id' => array( + ], + 'pdf_format_id' => [ 'name' => 'pdf_format_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Message Template Format') , + 'title' => ts('Message Template Format'), 'description' => 'a pseudo-FK to civicrm_option_value containing PDF Page Format.', 'table_name' => 'civicrm_msg_template', 'entity' => 'MessageTemplate', 'bao' => 'CRM_Core_BAO_MessageTemplate', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'pdf_format', 'keyColumn' => 'id', 'optionEditPath' => 'civicrm/admin/options/pdf_format', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -295,10 +288,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'msg_template', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'msg_template', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -306,15 +300,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'msg_template', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'msg_template', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Navigation.php b/CRM/Core/DAO/Navigation.php index 3033214a49fc..8bc617a6248f 100644 --- a/CRM/Core/DAO/Navigation.php +++ b/CRM/Core/DAO/Navigation.php @@ -1,29 +1,5 @@ __table = 'civicrm_navigation'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_navigation', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_navigation', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Navigation ID') , - 'required' => true, + 'title' => ts('Navigation ID'), + 'required' => TRUE, 'table_name' => 'civicrm_navigation', 'entity' => 'Navigation', 'bao' => 'CRM_Core_BAO_Navigation', 'localizable' => 0, - ) , - 'domain_id' => array( + ], + 'domain_id' => [ 'name' => 'domain_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Navigation Domain') , + 'title' => ts('Navigation Domain'), 'description' => 'Which Domain is this navigation item for', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_navigation', 'entity' => 'Navigation', 'bao' => 'CRM_Core_BAO_Navigation', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Domain', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'label' => array( + ] + ], + 'label' => [ 'name' => 'label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Navigation Item Label') , + 'title' => ts('Navigation Item Label'), 'description' => 'Navigation Title', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -189,11 +180,11 @@ static function &fields() { 'entity' => 'Navigation', 'bao' => 'CRM_Core_BAO_Navigation', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Navigation Item Machine Name') , + 'title' => ts('Navigation Item Machine Name'), 'description' => 'Internal Name', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -201,11 +192,11 @@ static function &fields() { 'entity' => 'Navigation', 'bao' => 'CRM_Core_BAO_Navigation', 'localizable' => 0, - ) , - 'url' => array( + ], + 'url' => [ 'name' => 'url', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Url') , + 'title' => ts('Url'), 'description' => 'url in case of custom navigation link', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -213,13 +204,13 @@ static function &fields() { 'entity' => 'Navigation', 'bao' => 'CRM_Core_BAO_Navigation', 'localizable' => 0, - ) , - 'icon' => array( + ], + 'icon' => [ 'name' => 'icon', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Icon') , + 'title' => ts('Icon'), 'description' => 'CSS class name for an icon', - 'required' => false, + 'required' => FALSE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'default' => 'NULL', @@ -227,11 +218,11 @@ static function &fields() { 'entity' => 'Navigation', 'bao' => 'CRM_Core_BAO_Navigation', 'localizable' => 0, - ) , - 'permission' => array( + ], + 'permission' => [ 'name' => 'permission', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Required Permission') , + 'title' => ts('Required Permission'), 'description' => 'Permission for menu item', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -239,11 +230,11 @@ static function &fields() { 'entity' => 'Navigation', 'bao' => 'CRM_Core_BAO_Navigation', 'localizable' => 0, - ) , - 'permission_operator' => array( + ], + 'permission_operator' => [ 'name' => 'permission_operator', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Permission Operator') , + 'title' => ts('Permission Operator'), 'description' => 'Permission Operator', 'maxlength' => 3, 'size' => CRM_Utils_Type::FOUR, @@ -251,87 +242,91 @@ static function &fields() { 'entity' => 'Navigation', 'bao' => 'CRM_Core_BAO_Navigation', 'localizable' => 0, - ) , - 'parent_id' => array( + ], + 'parent_id' => [ 'name' => 'parent_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Navigation parent ID') , + 'title' => ts('Navigation parent ID'), 'description' => 'Parent navigation item, used for grouping', 'table_name' => 'civicrm_navigation', 'entity' => 'Navigation', 'bao' => 'CRM_Core_BAO_Navigation', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Navigation', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_navigation', 'keyColumn' => 'id', 'labelColumn' => 'label', 'nameColumn' => 'name', - ) - ) , - 'is_active' => array( + ] + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Active') , + 'title' => ts('Is Active'), 'description' => 'Is this navigation item active?', 'table_name' => 'civicrm_navigation', 'entity' => 'Navigation', 'bao' => 'CRM_Core_BAO_Navigation', 'localizable' => 0, - ) , - 'has_separator' => array( + ], + 'has_separator' => [ 'name' => 'has_separator', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Use separator') , + 'title' => ts('Use separator'), 'description' => 'If separator needs to be added after this menu item', 'table_name' => 'civicrm_navigation', 'entity' => 'Navigation', 'bao' => 'CRM_Core_BAO_Navigation', 'localizable' => 0, - ) , - 'weight' => array( + ], + 'weight' => [ 'name' => 'weight', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Order') , + 'title' => ts('Order'), 'description' => 'Ordering of the navigation items in various blocks.', 'table_name' => 'civicrm_navigation', 'entity' => 'Navigation', 'bao' => 'CRM_Core_BAO_Navigation', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -339,10 +334,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'navigation', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'navigation', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -350,15 +346,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'navigation', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'navigation', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Note.php b/CRM/Core/DAO/Note.php index 56c776d517bd..70ce136ff38b 100644 --- a/CRM/Core/DAO/Note.php +++ b/CRM/Core/DAO/Note.php @@ -1,29 +1,5 @@ __table = 'civicrm_note'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Note ID') , + 'title' => ts('Note ID'), 'description' => 'Note ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_note', 'entity' => 'Note', 'bao' => 'CRM_Core_BAO_Note', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Note Entity') , + 'title' => ts('Note Entity'), 'description' => 'Name of table where item being referenced is stored.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_note', 'entity' => 'Note', 'bao' => 'CRM_Core_BAO_Note', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Core_BAO_Note::entityTables', - ) - ) , - 'entity_id' => array( + ] + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Note Entity ID') , + 'title' => ts('Note Entity ID'), 'description' => 'Foreign key to the referenced item.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_note', 'entity' => 'Note', 'bao' => 'CRM_Core_BAO_Note', 'localizable' => 0, - ) , - 'note' => array( + ], + 'note' => [ 'name' => 'note', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Note') , + 'title' => ts('Note'), 'description' => 'Note and/or Comment.', 'rows' => 4, 'cols' => 60, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_note.note', 'headerPattern' => '/Note|Comment/i', 'dataPattern' => '//', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_note', 'entity' => 'Note', 'bao' => 'CRM_Core_BAO_Note', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'contact_id' => array( + ], + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Note Created By') , + 'title' => ts('Note Created By'), 'description' => 'FK to Contact ID creator', 'table_name' => 'civicrm_note', 'entity' => 'Note', 'bao' => 'CRM_Core_BAO_Note', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'modified_date' => array( + ], + 'modified_date' => [ 'name' => 'modified_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Note Modified By') , + 'title' => ts('Note Modified By'), 'description' => 'When was this note last modified/edited', 'table_name' => 'civicrm_note', 'entity' => 'Note', 'bao' => 'CRM_Core_BAO_Note', 'localizable' => 0, - ) , - 'subject' => array( + ], + 'subject' => [ 'name' => 'subject', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Subject') , + 'title' => ts('Subject'), 'description' => 'subject of note description', 'maxlength' => 255, 'size' => 60, @@ -218,14 +206,14 @@ static function &fields() { 'entity' => 'Note', 'bao' => 'CRM_Core_BAO_Note', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'privacy' => array( + ], + ], + 'privacy' => [ 'name' => 'privacy', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Privacy') , + 'title' => ts('Privacy'), 'description' => 'Foreign Key to Note Privacy Level (which is an option value pair and hence an implicit FK)', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -233,44 +221,48 @@ static function &fields() { 'entity' => 'Note', 'bao' => 'CRM_Core_BAO_Note', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'note_privacy', 'optionEditPath' => 'civicrm/admin/options/note_privacy', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -278,10 +270,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'note', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'note', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -289,25 +282,31 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'note', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'note', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_entity' => array( + $indices = [ + 'index_entity' => [ 'name' => 'index_entity', - 'field' => array( + 'field' => [ 0 => 'entity_table', 1 => 'entity_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_note::0::entity_table::entity_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/OpenID.php b/CRM/Core/DAO/OpenID.php index 06192ee60e52..b995ace61d09 100644 --- a/CRM/Core/DAO/OpenID.php +++ b/CRM/Core/DAO/OpenID.php @@ -1,29 +1,5 @@ __table = 'civicrm_openid'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Open ID identifier') , + 'title' => ts('Open ID identifier'), 'description' => 'Unique OpenID ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_openid', 'entity' => 'OpenID', 'bao' => 'CRM_Core_BAO_OpenID', 'localizable' => 0, - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('OpenID Contact') , + 'title' => ts('OpenID Contact'), 'description' => 'FK to Contact ID', 'table_name' => 'civicrm_openid', 'entity' => 'OpenID', 'bao' => 'CRM_Core_BAO_OpenID', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'location_type_id' => array( + ], + 'location_type_id' => [ 'name' => 'location_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('OpenID Location Type') , + 'title' => ts('OpenID Location Type'), 'description' => 'Which Location does this email belong to.', 'table_name' => 'civicrm_openid', 'entity' => 'OpenID', 'bao' => 'CRM_Core_BAO_OpenID', 'localizable' => 0, - ) , - 'openid' => array( + ], + 'openid' => [ 'name' => 'openid', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('OpenID') , + 'title' => ts('OpenID'), 'description' => 'the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_openid.openid', 'headerPattern' => '/^Open.?ID|u(niq\w*)?.?ID/i', 'dataPattern' => '/^[\w\/\:\.]+$/', - 'export' => true, + 'export' => TRUE, 'rule' => 'url', 'table_name' => 'civicrm_openid', 'entity' => 'OpenID', 'bao' => 'CRM_Core_BAO_OpenID', 'localizable' => 0, - ) , - 'allowed_to_login' => array( + ], + 'allowed_to_login' => [ 'name' => 'allowed_to_login', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Allowed to login?') , + 'title' => ts('Allowed to login?'), 'description' => 'Whether or not this user is allowed to login', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_openid', 'entity' => 'OpenID', 'bao' => 'CRM_Core_BAO_OpenID', 'localizable' => 0, - ) , - 'is_primary' => array( + ], + 'is_primary' => [ 'name' => 'is_primary', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is OpenID Primary?') , + 'title' => ts('Is OpenID Primary?'), 'description' => 'Is this the primary email for this contact and location.', 'table_name' => 'civicrm_openid', 'entity' => 'OpenID', 'bao' => 'CRM_Core_BAO_OpenID', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -226,10 +216,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'openid', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'openid', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -237,33 +228,39 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'openid', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'openid', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_location_type' => array( + $indices = [ + 'index_location_type' => [ 'name' => 'index_location_type', - 'field' => array( + 'field' => [ 0 => 'location_type_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_openid::0::location_type_id', - ) , - 'UI_openid' => array( + ], + 'UI_openid' => [ 'name' => 'UI_openid', - 'field' => array( + 'field' => [ 0 => 'openid', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_openid::1::openid', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/OptionGroup.php b/CRM/Core/DAO/OptionGroup.php index 9340fbda9e18..6bc57c52852c 100644 --- a/CRM/Core/DAO/OptionGroup.php +++ b/CRM/Core/DAO/OptionGroup.php @@ -1,29 +1,5 @@ __table = 'civicrm_option_group'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Option Group ID') , + 'title' => ts('Option Group ID'), 'description' => 'Option Group ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_option_group', 'entity' => 'OptionGroup', 'bao' => 'CRM_Core_BAO_OptionGroup', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Option Group Name') , + 'title' => ts('Option Group Name'), 'description' => 'Option group name. Used as selection key by class properties which lookup options in civicrm_option_value.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_option_group', 'entity' => 'OptionGroup', 'bao' => 'CRM_Core_BAO_OptionGroup', 'localizable' => 0, - ) , - 'title' => array( + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Option Group title') , + 'title' => ts('Option Group title'), 'description' => 'Option Group title.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -148,11 +135,11 @@ static function &fields() { 'entity' => 'OptionGroup', 'bao' => 'CRM_Core_BAO_OptionGroup', 'localizable' => 1, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Option Group Description') , + 'title' => ts('Option Group Description'), 'description' => 'Option group description.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -160,11 +147,11 @@ static function &fields() { 'entity' => 'OptionGroup', 'bao' => 'CRM_Core_BAO_OptionGroup', 'localizable' => 1, - ) , - 'data_type' => array( + ], + 'data_type' => [ 'name' => 'data_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Data Type for this option group') , + 'title' => ts('Data Type for this option group'), 'description' => 'Option group description.', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -172,74 +159,78 @@ static function &fields() { 'entity' => 'OptionGroup', 'bao' => 'CRM_Core_BAO_OptionGroup', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Utils_Type::dataTypes', - ) - ) , - 'is_reserved' => array( + ] + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Option Group Is Reserved?') , + 'title' => ts('Option Group Is Reserved?'), 'description' => 'Is this a predefined system option group (i.e. it can not be deleted)?', 'default' => '1', 'table_name' => 'civicrm_option_group', 'entity' => 'OptionGroup', 'bao' => 'CRM_Core_BAO_OptionGroup', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Option Group Is Active?') , + 'title' => ts('Option Group Is Active?'), 'description' => 'Is this option group active?', 'table_name' => 'civicrm_option_group', 'entity' => 'OptionGroup', 'bao' => 'CRM_Core_BAO_OptionGroup', 'localizable' => 0, - ) , - 'is_locked' => array( + ], + 'is_locked' => [ 'name' => 'is_locked', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Option Group Is Locked') , + 'title' => ts('Option Group Is Locked'), 'description' => 'A lock to remove the ability to add new options via the UI.', 'table_name' => 'civicrm_option_group', 'entity' => 'OptionGroup', 'bao' => 'CRM_Core_BAO_OptionGroup', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -247,10 +238,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'option_group', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'option_group', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -258,25 +250,31 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'option_group', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'option_group', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_name' => array( + $indices = [ + 'UI_name' => [ 'name' => 'UI_name', - 'field' => array( + 'field' => [ 0 => 'name', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_option_group::1::name', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/OptionValue.php b/CRM/Core/DAO/OptionValue.php index e09985ef66f2..ea930c63e884 100644 --- a/CRM/Core/DAO/OptionValue.php +++ b/CRM/Core/DAO/OptionValue.php @@ -1,29 +1,5 @@ __table = 'civicrm_option_value'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'option_group_id', 'civicrm_option_group', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'component_id', 'civicrm_component', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'option_group_id', 'civicrm_option_group', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'component_id', 'civicrm_component', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Option Value ID') , + 'title' => ts('Option Value ID'), 'description' => 'Option ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_option_value', 'entity' => 'OptionValue', 'bao' => 'CRM_Core_BAO_OptionValue', 'localizable' => 0, - ) , - 'option_group_id' => array( + ], + 'option_group_id' => [ 'name' => 'option_group_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Option Group ID') , + 'title' => ts('Option Group ID'), 'description' => 'Group which this option belongs to.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_option_value', 'entity' => 'OptionValue', 'bao' => 'CRM_Core_BAO_OptionValue', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_OptionGroup', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_option_group', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'label' => array( + ] + ], + 'label' => [ 'name' => 'label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Option Label') , + 'title' => ts('Option Label'), 'description' => 'Option string as displayed to users - e.g. the label in an HTML OPTION tag.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 512, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_option_value', 'entity' => 'OptionValue', 'bao' => 'CRM_Core_BAO_OptionValue', 'localizable' => 1, - ) , - 'value' => array( + ], + 'value' => [ 'name' => 'value', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Option Value') , + 'title' => ts('Option Value'), 'description' => 'The actual value stored (as a foreign key) in the data record. Functions which need lookup option_value.title should use civicrm_option_value.option_group_id plus civicrm_option_value.value as the key.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 512, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_option_value', 'entity' => 'OptionValue', 'bao' => 'CRM_Core_BAO_OptionValue', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Option Name') , + 'title' => ts('Option Name'), 'description' => 'Stores a fixed (non-translated) name for this option value. Lookup functions should use the name as the key for the option value row.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_option_value.name', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_option_value', 'entity' => 'OptionValue', 'bao' => 'CRM_Core_BAO_OptionValue', 'localizable' => 0, - ) , - 'grouping' => array( + ], + 'grouping' => [ 'name' => 'grouping', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Option Grouping Name') , + 'title' => ts('Option Grouping Name'), 'description' => 'Use to sort and/or set display properties for sub-set(s) of options within an option group. EXAMPLE: Use for college_interest field, to differentiate partners from non-partners.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -273,42 +270,42 @@ static function &fields() { 'entity' => 'OptionValue', 'bao' => 'CRM_Core_BAO_OptionValue', 'localizable' => 0, - ) , - 'filter' => array( + ], + 'filter' => [ 'name' => 'filter', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Filter') , + 'title' => ts('Filter'), 'description' => 'Bitwise logic can be used to create subsets of options within an option_group for different uses.', 'table_name' => 'civicrm_option_value', 'entity' => 'OptionValue', 'bao' => 'CRM_Core_BAO_OptionValue', 'localizable' => 0, - ) , - 'is_default' => array( + ], + 'is_default' => [ 'name' => 'is_default', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Option is Default?') , + 'title' => ts('Option is Default?'), 'description' => 'Is this the default option for the group?', 'table_name' => 'civicrm_option_value', 'entity' => 'OptionValue', 'bao' => 'CRM_Core_BAO_OptionValue', 'localizable' => 0, - ) , - 'weight' => array( + ], + 'weight' => [ 'name' => 'weight', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Order') , + 'title' => ts('Order'), 'description' => 'Controls display sort order.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_option_value', 'entity' => 'OptionValue', 'bao' => 'CRM_Core_BAO_OptionValue', 'localizable' => 0, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Option Description') , + 'title' => ts('Option Description'), 'description' => 'Optional description.', 'rows' => 8, 'cols' => 60, @@ -316,90 +313,90 @@ static function &fields() { 'entity' => 'OptionValue', 'bao' => 'CRM_Core_BAO_OptionValue', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'is_optgroup' => array( + ], + ], + 'is_optgroup' => [ 'name' => 'is_optgroup', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Option is Header?') , + 'title' => ts('Option is Header?'), 'description' => 'Is this row simply a display header? Expected usage is to render these as OPTGROUP tags within a SELECT field list of options?', 'table_name' => 'civicrm_option_value', 'entity' => 'OptionValue', 'bao' => 'CRM_Core_BAO_OptionValue', 'localizable' => 0, - ) , - 'is_reserved' => array( + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Option Is Reserved?') , + 'title' => ts('Option Is Reserved?'), 'description' => 'Is this a predefined system object?', 'table_name' => 'civicrm_option_value', 'entity' => 'OptionValue', 'bao' => 'CRM_Core_BAO_OptionValue', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Option Is Active') , + 'title' => ts('Option Is Active'), 'description' => 'Is this option active?', 'default' => '1', 'table_name' => 'civicrm_option_value', 'entity' => 'OptionValue', 'bao' => 'CRM_Core_BAO_OptionValue', 'localizable' => 0, - ) , - 'component_id' => array( + ], + 'component_id' => [ 'name' => 'component_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Option Component') , + 'title' => ts('Option Component'), 'description' => 'Component that this option value belongs/caters to.', 'table_name' => 'civicrm_option_value', 'entity' => 'OptionValue', 'bao' => 'CRM_Core_BAO_OptionValue', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Component', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_component', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'domain_id' => array( + ] + ], + 'domain_id' => [ 'name' => 'domain_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Option Domain') , + 'title' => ts('Option Domain'), 'description' => 'Which Domain is this option value for', 'table_name' => 'civicrm_option_value', 'entity' => 'OptionValue', 'bao' => 'CRM_Core_BAO_OptionValue', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Domain', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'visibility_id' => array( + ] + ], + 'visibility_id' => [ 'name' => 'visibility_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Option Visibility') , + 'title' => ts('Option Visibility'), 'default' => 'NULL', 'table_name' => 'civicrm_option_value', 'entity' => 'OptionValue', 'bao' => 'CRM_Core_BAO_OptionValue', 'localizable' => 0, - ) , - 'icon' => array( + ], + 'icon' => [ 'name' => 'icon', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Icon') , + 'title' => ts('Icon'), 'description' => 'crm-i icon class', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -408,11 +405,11 @@ static function &fields() { 'entity' => 'OptionValue', 'bao' => 'CRM_Core_BAO_OptionValue', 'localizable' => 0, - ) , - 'color' => array( + ], + 'color' => [ 'name' => 'color', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Color') , + 'title' => ts('Color'), 'description' => 'Hex color value e.g. #ffffff', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -421,40 +418,44 @@ static function &fields() { 'entity' => 'OptionValue', 'bao' => 'CRM_Core_BAO_OptionValue', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -462,10 +463,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'option_value', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'option_value', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -473,34 +475,40 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'option_value', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'option_value', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_option_group_id_value' => array( + $indices = [ + 'index_option_group_id_value' => [ 'name' => 'index_option_group_id_value', - 'field' => array( + 'field' => [ 0 => 'value(128)', 1 => 'option_group_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_option_value::0::value(128)::option_group_id', - ) , - 'index_option_group_id_name' => array( + ], + 'index_option_group_id_name' => [ 'name' => 'index_option_group_id_name', - 'field' => array( + 'field' => [ 0 => 'name(128)', 1 => 'option_group_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_option_value::0::name(128)::option_group_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Persistent.php b/CRM/Core/DAO/Persistent.php index b8b5b1ea3674..1fcf034a2e14 100644 --- a/CRM/Core/DAO/Persistent.php +++ b/CRM/Core/DAO/Persistent.php @@ -1,29 +1,5 @@ __table = 'civicrm_persistent'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Persistent ID') , + 'title' => ts('Persistent ID'), 'description' => 'Persistent Record Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_persistent', 'entity' => 'Persistent', 'bao' => 'CRM_Core_BAO_Persistent', 'localizable' => 0, - ) , - 'context' => array( + ], + 'context' => [ 'name' => 'context', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Context') , + 'title' => ts('Context'), 'description' => 'Context for which name data pair is to be stored', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_persistent', 'entity' => 'Persistent', 'bao' => 'CRM_Core_BAO_Persistent', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Name') , + 'title' => ts('Name'), 'description' => 'Name of Context', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_persistent', 'entity' => 'Persistent', 'bao' => 'CRM_Core_BAO_Persistent', 'localizable' => 0, - ) , - 'data' => array( + ], + 'data' => [ 'name' => 'data', 'type' => CRM_Utils_Type::T_LONGTEXT, - 'title' => ts('Data') , + 'title' => ts('Data'), 'description' => 'data associated with name', 'table_name' => 'civicrm_persistent', 'entity' => 'Persistent', 'bao' => 'CRM_Core_BAO_Persistent', 'localizable' => 0, - ) , - 'is_config' => array( + ], + 'is_config' => [ 'name' => 'is_config', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Configuration?') , + 'title' => ts('Is Configuration?'), 'description' => 'Config Settings', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_persistent', 'entity' => 'Persistent', 'bao' => 'CRM_Core_BAO_Persistent', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -193,10 +181,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'persistent', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'persistent', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -204,15 +193,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'persistent', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'persistent', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Phone.php b/CRM/Core/DAO/Phone.php index 7c594b5d9cb1..28ab1b174ccd 100644 --- a/CRM/Core/DAO/Phone.php +++ b/CRM/Core/DAO/Phone.php @@ -1,29 +1,5 @@ __table = 'civicrm_phone'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Phone ID') , + 'title' => ts('Phone ID'), 'description' => 'Unique Phone ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_phone', 'entity' => 'Phone', 'bao' => 'CRM_Core_BAO_Phone', 'localizable' => 0, - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Phone Contact') , + 'title' => ts('Phone Contact'), 'description' => 'FK to Contact ID', 'table_name' => 'civicrm_phone', 'entity' => 'Phone', 'bao' => 'CRM_Core_BAO_Phone', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'location_type_id' => array( + ], + 'location_type_id' => [ 'name' => 'location_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Phone Location Type') , + 'title' => ts('Phone Location Type'), 'description' => 'Which Location does this phone belong to.', 'table_name' => 'civicrm_phone', 'entity' => 'Phone', 'bao' => 'CRM_Core_BAO_Phone', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_location_type', 'keyColumn' => 'id', 'labelColumn' => 'display_name', - ) - ) , - 'is_primary' => array( + ] + ], + 'is_primary' => [ 'name' => 'is_primary', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Phone Primary?') , + 'title' => ts('Is Phone Primary?'), 'description' => 'Is this the primary phone for this contact and location.', 'table_name' => 'civicrm_phone', 'entity' => 'Phone', 'bao' => 'CRM_Core_BAO_Phone', 'localizable' => 0, - ) , - 'is_billing' => array( + ], + 'is_billing' => [ 'name' => 'is_billing', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Billing Phone') , + 'title' => ts('Is Billing Phone'), 'description' => 'Is this the billing?', 'table_name' => 'civicrm_phone', 'entity' => 'Phone', 'bao' => 'CRM_Core_BAO_Phone', 'localizable' => 0, - ) , - 'mobile_provider_id' => array( + ], + 'mobile_provider_id' => [ 'name' => 'mobile_provider_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mobile Provider') , + 'title' => ts('Mobile Provider'), 'description' => 'Which Mobile Provider does this phone belong to.', 'table_name' => 'civicrm_phone', 'entity' => 'Phone', 'bao' => 'CRM_Core_BAO_Phone', 'localizable' => 0, - ) , - 'phone' => array( + ], + 'phone' => [ 'name' => 'phone', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Phone') , + 'title' => ts('Phone'), 'description' => 'Complete phone number.', 'maxlength' => 32, 'size' => CRM_Utils_Type::MEDIUM, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_phone.phone', 'headerPattern' => '/phone/i', 'dataPattern' => '/^[\d\(\)\-\.\s]+$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_phone', 'entity' => 'Phone', 'bao' => 'CRM_Core_BAO_Phone', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'phone_ext' => array( + ], + ], + 'phone_ext' => [ 'name' => 'phone_ext', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Phone Extension') , + 'title' => ts('Phone Extension'), 'description' => 'Optional extension for a phone number.', 'maxlength' => 16, 'size' => 4, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_phone.phone_ext', 'headerPattern' => '/extension/i', 'dataPattern' => '/^\d+$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_phone', 'entity' => 'Phone', 'bao' => 'CRM_Core_BAO_Phone', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'phone_numeric' => array( + ], + ], + 'phone_numeric' => [ 'name' => 'phone_numeric', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Phone Numeric') , + 'title' => ts('Phone Numeric'), 'description' => 'Phone number stripped of all whitespace, letters, and punctuation.', 'maxlength' => 32, 'size' => CRM_Utils_Type::MEDIUM, @@ -260,57 +250,61 @@ static function &fields() { 'entity' => 'Phone', 'bao' => 'CRM_Core_BAO_Phone', 'localizable' => 0, - ) , - 'phone_type_id' => array( + ], + 'phone_type_id' => [ 'name' => 'phone_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Phone Type') , + 'title' => ts('Phone Type'), 'description' => 'Which type of phone does this number belongs.', 'table_name' => 'civicrm_phone', 'entity' => 'Phone', 'bao' => 'CRM_Core_BAO_Phone', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'phone_type', 'optionEditPath' => 'civicrm/admin/options/phone_type', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -318,10 +312,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'phone', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'phone', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -329,56 +324,62 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'phone', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'phone', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_location_type' => array( + $indices = [ + 'index_location_type' => [ 'name' => 'index_location_type', - 'field' => array( + 'field' => [ 0 => 'location_type_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_phone::0::location_type_id', - ) , - 'index_is_primary' => array( + ], + 'index_is_primary' => [ 'name' => 'index_is_primary', - 'field' => array( + 'field' => [ 0 => 'is_primary', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_phone::0::is_primary', - ) , - 'index_is_billing' => array( + ], + 'index_is_billing' => [ 'name' => 'index_is_billing', - 'field' => array( + 'field' => [ 0 => 'is_billing', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_phone::0::is_billing', - ) , - 'UI_mobile_provider_id' => array( + ], + 'UI_mobile_provider_id' => [ 'name' => 'UI_mobile_provider_id', - 'field' => array( + 'field' => [ 0 => 'mobile_provider_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_phone::0::mobile_provider_id', - ) , - 'index_phone_numeric' => array( + ], + 'index_phone_numeric' => [ 'name' => 'index_phone_numeric', - 'field' => array( + 'field' => [ 0 => 'phone_numeric', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_phone::0::phone_numeric', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/PreferencesDate.php b/CRM/Core/DAO/PreferencesDate.php index 1f8b3b660235..8d395e56acc4 100644 --- a/CRM/Core/DAO/PreferencesDate.php +++ b/CRM/Core/DAO/PreferencesDate.php @@ -1,29 +1,5 @@ __table = 'civicrm_preferences_date'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Date Preference ID') , - 'required' => true, + 'title' => ts('Date Preference ID'), + 'required' => TRUE, 'table_name' => 'civicrm_preferences_date', 'entity' => 'PreferencesDate', 'bao' => 'CRM_Core_BAO_PreferencesDate', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Date Preference Name') , + 'title' => ts('Date Preference Name'), 'description' => 'The meta name for this date (fixed in code)', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_preferences_date', 'entity' => 'PreferencesDate', 'bao' => 'CRM_Core_BAO_PreferencesDate', 'localizable' => 0, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Description') , + 'title' => ts('Description'), 'description' => 'Description of this date type.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -140,33 +125,33 @@ static function &fields() { 'entity' => 'PreferencesDate', 'bao' => 'CRM_Core_BAO_PreferencesDate', 'localizable' => 0, - ) , - 'start' => array( + ], + 'start' => [ 'name' => 'start', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Start') , + 'title' => ts('Start'), 'description' => 'The start offset relative to current year', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_preferences_date', 'entity' => 'PreferencesDate', 'bao' => 'CRM_Core_BAO_PreferencesDate', 'localizable' => 0, - ) , - 'end' => array( + ], + 'end' => [ 'name' => 'end', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('End Offset') , + 'title' => ts('End Offset'), 'description' => 'The end offset relative to current year, can be negative', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_preferences_date', 'entity' => 'PreferencesDate', 'bao' => 'CRM_Core_BAO_PreferencesDate', 'localizable' => 0, - ) , - 'date_format' => array( + ], + 'date_format' => [ 'name' => 'date_format', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Date Format') , + 'title' => ts('Date Format'), 'description' => 'The date type', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -174,11 +159,11 @@ static function &fields() { 'entity' => 'PreferencesDate', 'bao' => 'CRM_Core_BAO_PreferencesDate', 'localizable' => 0, - ) , - 'time_format' => array( + ], + 'time_format' => [ 'name' => 'time_format', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Time Format') , + 'title' => ts('Time Format'), 'description' => 'time format', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -186,40 +171,44 @@ static function &fields() { 'entity' => 'PreferencesDate', 'bao' => 'CRM_Core_BAO_PreferencesDate', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -227,10 +216,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'preferences_date', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'preferences_date', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -238,24 +228,30 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'preferences_date', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'preferences_date', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_name' => array( + $indices = [ + 'index_name' => [ 'name' => 'index_name', - 'field' => array( + 'field' => [ 0 => 'name', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_preferences_date::0::name', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/PrevNextCache.php b/CRM/Core/DAO/PrevNextCache.php index 0c5af39cc594..a68699984b41 100644 --- a/CRM/Core/DAO/PrevNextCache.php +++ b/CRM/Core/DAO/PrevNextCache.php @@ -1,29 +1,5 @@ __table = 'civicrm_prevnext_cache'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Prev Next Cache ID') , - 'required' => true, + 'title' => ts('Prev Next Cache ID'), + 'required' => TRUE, 'table_name' => 'civicrm_prevnext_cache', 'entity' => 'PrevNextCache', 'bao' => 'CRM_Core_BAO_PrevNextCache', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Prev Next Entity Table') , + 'title' => ts('Prev Next Entity Table'), 'description' => 'physical tablename for entity being joined to discount, e.g. civicrm_event', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -126,33 +110,33 @@ static function &fields() { 'entity' => 'PrevNextCache', 'bao' => 'CRM_Core_BAO_PrevNextCache', 'localizable' => 0, - ) , - 'entity_id1' => array( + ], + 'entity_id1' => [ 'name' => 'entity_id1', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Prev Next Entity ID 1') , + 'title' => ts('Prev Next Entity ID 1'), 'description' => 'FK to entity table specified in entity_table column.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_prevnext_cache', 'entity' => 'PrevNextCache', 'bao' => 'CRM_Core_BAO_PrevNextCache', 'localizable' => 0, - ) , - 'entity_id2' => array( + ], + 'entity_id2' => [ 'name' => 'entity_id2', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Prev Next Entity ID 2') , + 'title' => ts('Prev Next Entity ID 2'), 'description' => 'FK to entity table specified in entity_table column.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_prevnext_cache', 'entity' => 'PrevNextCache', 'bao' => 'CRM_Core_BAO_PrevNextCache', 'localizable' => 0, - ) , - 'cacheKey' => array( + ], + 'cacheKey' => [ 'name' => 'cacheKey', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Cache Key') , + 'title' => ts('Cache Key'), 'description' => 'Unique path name for cache element of the searched item', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -160,60 +144,64 @@ static function &fields() { 'entity' => 'PrevNextCache', 'bao' => 'CRM_Core_BAO_PrevNextCache', 'localizable' => 0, - ) , - 'data' => array( + ], + 'data' => [ 'name' => 'data', 'type' => CRM_Utils_Type::T_LONGTEXT, - 'title' => ts('Prev Next Data') , + 'title' => ts('Prev Next Data'), 'description' => 'cached snapshot of the serialized data', 'table_name' => 'civicrm_prevnext_cache', 'entity' => 'PrevNextCache', 'bao' => 'CRM_Core_BAO_PrevNextCache', 'localizable' => 0, 'serialize' => self::SERIALIZE_PHP, - ) , - 'is_selected' => array( + ], + 'is_selected' => [ 'name' => 'is_selected', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Selected') , + 'title' => ts('Is Selected'), 'table_name' => 'civicrm_prevnext_cache', 'entity' => 'PrevNextCache', 'bao' => 'CRM_Core_BAO_PrevNextCache', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -221,10 +209,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'prevnext_cache', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'prevnext_cache', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -232,28 +221,34 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'prevnext_cache', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'prevnext_cache', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_all' => array( + $indices = [ + 'index_all' => [ 'name' => 'index_all', - 'field' => array( + 'field' => [ 0 => 'cacheKey', 1 => 'entity_id1', 2 => 'entity_id2', 3 => 'entity_table', 4 => 'is_selected', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_prevnext_cache::0::cacheKey::entity_id1::entity_id2::entity_table::is_selected', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/PrintLabel.php b/CRM/Core/DAO/PrintLabel.php index 59847d370481..49367c294735 100644 --- a/CRM/Core/DAO/PrintLabel.php +++ b/CRM/Core/DAO/PrintLabel.php @@ -1,29 +1,5 @@ __table = 'civicrm_print_label'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Print Label ID') , - 'required' => true, + 'title' => ts('Print Label ID'), + 'required' => TRUE, 'table_name' => 'civicrm_print_label', 'entity' => 'PrintLabel', 'bao' => 'CRM_Core_DAO_PrintLabel', 'localizable' => 0, - ) , - 'title' => array( + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Title') , + 'title' => ts('Title'), 'description' => 'User title for for this label layout', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -165,11 +155,11 @@ static function &fields() { 'entity' => 'PrintLabel', 'bao' => 'CRM_Core_DAO_PrintLabel', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Name') , + 'title' => ts('Name'), 'description' => 'variable name/programmatic handle for this field.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -177,21 +167,21 @@ static function &fields() { 'entity' => 'PrintLabel', 'bao' => 'CRM_Core_DAO_PrintLabel', 'localizable' => 0, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Description') , + 'title' => ts('Description'), 'description' => 'Description of this label layout', 'table_name' => 'civicrm_print_label', 'entity' => 'PrintLabel', 'bao' => 'CRM_Core_DAO_PrintLabel', 'localizable' => 0, - ) , - 'label_format_name' => array( + ], + 'label_format_name' => [ 'name' => 'label_format_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Label Format') , + 'title' => ts('Label Format'), 'description' => 'This refers to name column of civicrm_option_value row in name_badge option group', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -199,119 +189,123 @@ static function &fields() { 'entity' => 'PrintLabel', 'bao' => 'CRM_Core_DAO_PrintLabel', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'name_badge', 'optionEditPath' => 'civicrm/admin/options/name_badge', - ) - ) , - 'label_type_id' => array( + ] + ], + 'label_type_id' => [ 'name' => 'label_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Label Type') , + 'title' => ts('Label Type'), 'description' => 'Implicit FK to civicrm_option_value row in NEW label_type option group', 'table_name' => 'civicrm_print_label', 'entity' => 'PrintLabel', 'bao' => 'CRM_Core_DAO_PrintLabel', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'label_type', 'optionEditPath' => 'civicrm/admin/options/label_type', - ) - ) , - 'data' => array( + ] + ], + 'data' => [ 'name' => 'data', 'type' => CRM_Utils_Type::T_LONGTEXT, - 'title' => ts('Data') , + 'title' => ts('Data'), 'description' => 'contains json encode configurations options', 'table_name' => 'civicrm_print_label', 'entity' => 'PrintLabel', 'bao' => 'CRM_Core_DAO_PrintLabel', 'localizable' => 0, 'serialize' => self::SERIALIZE_JSON, - ) , - 'is_default' => array( + ], + 'is_default' => [ 'name' => 'is_default', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Label is Default?') , + 'title' => ts('Label is Default?'), 'description' => 'Is this default?', 'default' => '1', 'table_name' => 'civicrm_print_label', 'entity' => 'PrintLabel', 'bao' => 'CRM_Core_DAO_PrintLabel', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Label Is Active?') , + 'title' => ts('Label Is Active?'), 'description' => 'Is this option active?', 'default' => '1', 'table_name' => 'civicrm_print_label', 'entity' => 'PrintLabel', 'bao' => 'CRM_Core_DAO_PrintLabel', 'localizable' => 0, - ) , - 'is_reserved' => array( + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Label Reserved?') , + 'title' => ts('Is Label Reserved?'), 'description' => 'Is this reserved label?', 'default' => '1', 'table_name' => 'civicrm_print_label', 'entity' => 'PrintLabel', 'bao' => 'CRM_Core_DAO_PrintLabel', 'localizable' => 0, - ) , - 'created_id' => array( + ], + 'created_id' => [ 'name' => 'created_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Label Created By') , + 'title' => ts('Label Created By'), 'description' => 'FK to civicrm_contact, who created this label layout', 'table_name' => 'civicrm_print_label', 'entity' => 'PrintLabel', 'bao' => 'CRM_Core_DAO_PrintLabel', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -319,10 +313,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'print_label', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'print_label', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -330,15 +325,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'print_label', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'print_label', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/RecurringEntity.php b/CRM/Core/DAO/RecurringEntity.php index 81504b5909ba..9452995999c8 100644 --- a/CRM/Core/DAO/RecurringEntity.php +++ b/CRM/Core/DAO/RecurringEntity.php @@ -1,29 +1,5 @@ __table = 'civicrm_recurring_entity'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('ID') , - 'required' => true, + 'title' => ts('ID'), + 'required' => TRUE, 'table_name' => 'civicrm_recurring_entity', 'entity' => 'RecurringEntity', 'bao' => 'CRM_Core_BAO_RecurringEntity', 'localizable' => 0, - ) , - 'parent_id' => array( + ], + 'parent_id' => [ 'name' => 'parent_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Parent ID') , + 'title' => ts('Parent ID'), 'description' => 'Recurring Entity Parent ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_recurring_entity', 'entity' => 'RecurringEntity', 'bao' => 'CRM_Core_BAO_RecurringEntity', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity ID') , + 'title' => ts('Entity ID'), 'description' => 'Recurring Entity Child ID', 'table_name' => 'civicrm_recurring_entity', 'entity' => 'RecurringEntity', 'bao' => 'CRM_Core_BAO_RecurringEntity', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Table') , + 'title' => ts('Entity Table'), 'description' => 'Physical tablename for entity, e.g. civicrm_event', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_recurring_entity', 'entity' => 'RecurringEntity', 'bao' => 'CRM_Core_BAO_RecurringEntity', 'localizable' => 0, - ) , - 'mode' => array( + ], + 'mode' => [ 'name' => 'mode', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Cascade Type') , + 'title' => ts('Cascade Type'), 'description' => '1-this entity, 2-this and the following entities, 3-all the entities', - 'required' => true, + 'required' => TRUE, 'default' => '1', 'table_name' => 'civicrm_recurring_entity', 'entity' => 'RecurringEntity', 'bao' => 'CRM_Core_BAO_RecurringEntity', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -190,10 +177,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'recurring_entity', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'recurring_entity', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -201,15 +189,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'recurring_entity', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'recurring_entity', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Setting.php b/CRM/Core/DAO/Setting.php index 4449695e02bc..a16972205d7b 100644 --- a/CRM/Core/DAO/Setting.php +++ b/CRM/Core/DAO/Setting.php @@ -1,29 +1,5 @@ __table = 'civicrm_setting'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'component_id', 'civicrm_component', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'component_id', 'civicrm_component', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Setting ID') , - 'required' => true, + 'title' => ts('Setting ID'), + 'required' => TRUE, 'table_name' => 'civicrm_setting', 'entity' => 'Setting', 'bao' => 'CRM_Core_BAO_Setting', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Setting Name') , + 'title' => ts('Setting Name'), 'description' => 'Unique name for setting', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -156,129 +144,133 @@ static function &fields() { 'entity' => 'Setting', 'bao' => 'CRM_Core_BAO_Setting', 'localizable' => 0, - ) , - 'value' => array( + ], + 'value' => [ 'name' => 'value', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Value') , + 'title' => ts('Value'), 'description' => 'data associated with this group / name combo', 'table_name' => 'civicrm_setting', 'entity' => 'Setting', 'bao' => 'CRM_Core_BAO_Setting', 'localizable' => 0, 'serialize' => self::SERIALIZE_PHP, - ) , - 'domain_id' => array( + ], + 'domain_id' => [ 'name' => 'domain_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Setting Domain') , + 'title' => ts('Setting Domain'), 'description' => 'Which Domain is this menu item for', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_setting', 'entity' => 'Setting', 'bao' => 'CRM_Core_BAO_Setting', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Domain', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'contact_id' => array( + ] + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Setting Contact') , + 'title' => ts('Setting Contact'), 'description' => 'FK to Contact ID if the setting is localized to a contact', 'table_name' => 'civicrm_setting', 'entity' => 'Setting', 'bao' => 'CRM_Core_BAO_Setting', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'is_domain' => array( + ], + 'is_domain' => [ 'name' => 'is_domain', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Domain Setting?') , + 'title' => ts('Is Domain Setting?'), 'description' => 'Is this setting a contact specific or site wide setting?', 'table_name' => 'civicrm_setting', 'entity' => 'Setting', 'bao' => 'CRM_Core_BAO_Setting', 'localizable' => 0, - ) , - 'component_id' => array( + ], + 'component_id' => [ 'name' => 'component_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Setting Component') , + 'title' => ts('Setting Component'), 'description' => 'Component that this menu item belongs to', 'table_name' => 'civicrm_setting', 'entity' => 'Setting', 'bao' => 'CRM_Core_BAO_Setting', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Component', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_component', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'created_date' => array( + ] + ], + 'created_date' => [ 'name' => 'created_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Setting Created Date') , + 'title' => ts('Setting Created Date'), 'description' => 'When was the setting created', 'table_name' => 'civicrm_setting', 'entity' => 'Setting', 'bao' => 'CRM_Core_BAO_Setting', 'localizable' => 0, - ) , - 'created_id' => array( + ], + 'created_id' => [ 'name' => 'created_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Setting Created By') , + 'title' => ts('Setting Created By'), 'description' => 'FK to civicrm_contact, who created this setting', 'table_name' => 'civicrm_setting', 'entity' => 'Setting', 'bao' => 'CRM_Core_BAO_Setting', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -286,10 +278,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'setting', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'setting', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -297,27 +290,33 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'setting', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'setting', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_domain_contact_name' => array( + $indices = [ + 'index_domain_contact_name' => [ 'name' => 'index_domain_contact_name', - 'field' => array( + 'field' => [ 0 => 'domain_id', 1 => 'contact_id', 2 => 'name', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_setting::1::domain_id::contact_id::name', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/StateProvince.php b/CRM/Core/DAO/StateProvince.php index ef944d7736ab..ed6482e652eb 100644 --- a/CRM/Core/DAO/StateProvince.php +++ b/CRM/Core/DAO/StateProvince.php @@ -1,29 +1,5 @@ __table = 'civicrm_state_province'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'country_id', 'civicrm_country', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'country_id', 'civicrm_country', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('State ID') , + 'title' => ts('State ID'), 'description' => 'State/Province ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_state_province', 'entity' => 'StateProvince', 'bao' => 'CRM_Core_DAO_StateProvince', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('State') , + 'title' => ts('State'), 'description' => 'Name of State/Province', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_state_province.name', 'headerPattern' => '/state|prov(ince)?/i', 'dataPattern' => '/[A-Z]{2}/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_state_province', 'entity' => 'StateProvince', 'bao' => 'CRM_Core_DAO_StateProvince', 'localizable' => 0, - ) , - 'abbreviation' => array( + ], + 'abbreviation' => [ 'name' => 'abbreviation', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('State Abbreviation') , + 'title' => ts('State Abbreviation'), 'description' => '2-4 Character Abbreviation of State/Province', 'maxlength' => 4, 'size' => CRM_Utils_Type::FOUR, @@ -142,52 +126,56 @@ static function &fields() { 'entity' => 'StateProvince', 'bao' => 'CRM_Core_DAO_StateProvince', 'localizable' => 0, - ) , - 'country_id' => array( + ], + 'country_id' => [ 'name' => 'country_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Country') , + 'title' => ts('Country'), 'description' => 'ID of Country that State/Province belong', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_state_province', 'entity' => 'StateProvince', 'bao' => 'CRM_Core_DAO_StateProvince', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Country', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -195,10 +183,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'state_province', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'state_province', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -206,26 +195,32 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'state_province', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'state_province', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_name_country_id' => array( + $indices = [ + 'UI_name_country_id' => [ 'name' => 'UI_name_country_id', - 'field' => array( + 'field' => [ 0 => 'name', 1 => 'country_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_state_province::1::name::country_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/StatusPreference.php b/CRM/Core/DAO/StatusPreference.php index fd3b58477c70..5dc85d39c2c7 100644 --- a/CRM/Core/DAO/StatusPreference.php +++ b/CRM/Core/DAO/StatusPreference.php @@ -1,29 +1,5 @@ __table = 'civicrm_status_pref'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Status Preference ID') , + 'title' => ts('Status Preference ID'), 'description' => 'Unique Status Preference ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_status_pref', 'entity' => 'StatusPreference', 'bao' => 'CRM_Core_BAO_StatusPreference', 'localizable' => 0, - ) , - 'domain_id' => array( + ], + 'domain_id' => [ 'name' => 'domain_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Setting Domain') , + 'title' => ts('Setting Domain'), 'description' => 'Which Domain is this Status Preference for', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_status_pref', 'entity' => 'StatusPreference', 'bao' => 'CRM_Core_BAO_StatusPreference', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Domain', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'name' => array( + ] + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Status Check Name') , + 'title' => ts('Status Check Name'), 'description' => 'Name of the status check this preference references.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_status_pref.name', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_status_pref', 'entity' => 'StatusPreference', 'bao' => 'CRM_Core_BAO_StatusPreference', 'localizable' => 0, - ) , - 'hush_until' => array( + ], + 'hush_until' => [ 'name' => 'hush_until', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Snooze Status Notifications Until') , + 'title' => ts('Snooze Status Notifications Until'), 'description' => 'expires ignore_severity. NULL never hushes.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_status_pref.hush_until', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'default' => 'NULL', 'table_name' => 'civicrm_status_pref', 'entity' => 'StatusPreference', 'bao' => 'CRM_Core_BAO_StatusPreference', 'localizable' => 0, - ) , - 'ignore_severity' => array( + ], + 'ignore_severity' => [ 'name' => 'ignore_severity', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Ignore Severity') , + 'title' => ts('Ignore Severity'), 'description' => 'Hush messages up to and including this severity.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_status_pref.ignore_severity', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'default' => '1', 'table_name' => 'civicrm_status_pref', 'entity' => 'StatusPreference', 'bao' => 'CRM_Core_BAO_StatusPreference', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Utils_Check::getSeverityList', - ) - ) , - 'prefs' => array( + ] + ], + 'prefs' => [ 'name' => 'prefs', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Status Preferences') , + 'title' => ts('Status Preferences'), 'description' => 'These settings are per-check, and can\'t be compared across checks.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -213,11 +200,11 @@ static function &fields() { 'entity' => 'StatusPreference', 'bao' => 'CRM_Core_BAO_StatusPreference', 'localizable' => 0, - ) , - 'check_info' => array( + ], + 'check_info' => [ 'name' => 'check_info', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Check Info') , + 'title' => ts('Check Info'), 'description' => 'These values are per-check, and can\'t be compared across checks.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -225,40 +212,44 @@ static function &fields() { 'entity' => 'StatusPreference', 'bao' => 'CRM_Core_BAO_StatusPreference', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -266,10 +257,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'status_pref', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'status_pref', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -277,24 +269,30 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'status_pref', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'status_pref', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_status_pref_name' => array( + $indices = [ + 'UI_status_pref_name' => [ 'name' => 'UI_status_pref_name', - 'field' => array( + 'field' => [ 0 => 'name', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_status_pref::0::name', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/SystemLog.php b/CRM/Core/DAO/SystemLog.php index 74b20b4bd0c9..32df379c04b9 100644 --- a/CRM/Core/DAO/SystemLog.php +++ b/CRM/Core/DAO/SystemLog.php @@ -1,29 +1,5 @@ __table = 'civicrm_system_log'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('System Log ID') , + 'title' => ts('System Log ID'), 'description' => 'Primary key ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_system_log', 'entity' => 'SystemLog', 'bao' => 'CRM_Core_DAO_SystemLog', 'localizable' => 0, - ) , - 'message' => array( + ], + 'message' => [ 'name' => 'message', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('System Log Message') , + 'title' => ts('System Log Message'), 'description' => 'Standardized message', - 'required' => true, + 'required' => TRUE, 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_system_log', 'entity' => 'SystemLog', 'bao' => 'CRM_Core_DAO_SystemLog', 'localizable' => 0, - ) , - 'context' => array( + ], + 'context' => [ 'name' => 'context', 'type' => CRM_Utils_Type::T_LONGTEXT, - 'title' => ts('Detailed Log Data') , + 'title' => ts('Detailed Log Data'), 'description' => 'JSON encoded data', 'table_name' => 'civicrm_system_log', 'entity' => 'SystemLog', 'bao' => 'CRM_Core_DAO_SystemLog', 'localizable' => 0, - ) , - 'level' => array( + ], + 'level' => [ 'name' => 'level', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Detailed Log Data') , + 'title' => ts('Detailed Log Data'), 'description' => 'error level per PSR3', 'maxlength' => 9, 'size' => CRM_Utils_Type::TWELVE, @@ -153,32 +139,32 @@ static function &fields() { 'entity' => 'SystemLog', 'bao' => 'CRM_Core_DAO_SystemLog', 'localizable' => 0, - ) , - 'timestamp' => array( + ], + 'timestamp' => [ 'name' => 'timestamp', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Log Timestamp') , + 'title' => ts('Log Timestamp'), 'description' => 'Timestamp of when event occurred.', 'default' => 'CURRENT_TIMESTAMP', 'table_name' => 'civicrm_system_log', 'entity' => 'SystemLog', 'bao' => 'CRM_Core_DAO_SystemLog', 'localizable' => 0, - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Log Contact ID') , + 'title' => ts('Log Contact ID'), 'description' => 'Optional Contact ID that created the log. Not an FK as we keep this regardless', 'table_name' => 'civicrm_system_log', 'entity' => 'SystemLog', 'bao' => 'CRM_Core_DAO_SystemLog', 'localizable' => 0, - ) , - 'hostname' => array( + ], + 'hostname' => [ 'name' => 'hostname', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Log Host') , + 'title' => ts('Log Host'), 'description' => 'Optional Name of logging host', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -186,40 +172,44 @@ static function &fields() { 'entity' => 'SystemLog', 'bao' => 'CRM_Core_DAO_SystemLog', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -227,10 +217,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'system_log', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'system_log', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -238,15 +229,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'system_log', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'system_log', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Tag.php b/CRM/Core/DAO/Tag.php index bcbf74b54844..1ccdcc9cc294 100644 --- a/CRM/Core/DAO/Tag.php +++ b/CRM/Core/DAO/Tag.php @@ -1,29 +1,5 @@ __table = 'civicrm_tag'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_tag', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_tag', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Tag ID') , + 'title' => ts('Tag ID'), 'description' => 'Tag ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Tag Name') , + 'title' => ts('Tag Name'), 'description' => 'Name of Tag.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', 'localizable' => 0, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Description') , + 'title' => ts('Description'), 'description' => 'Optional verbose description of the tag.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -178,11 +166,11 @@ static function &fields() { 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', 'localizable' => 0, - ) , - 'parent_id' => array( + ], + 'parent_id' => [ 'name' => 'parent_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Parent Tag') , + 'title' => ts('Parent Tag'), 'description' => 'Optional parent id for this tag.', 'default' => 'NULL', 'table_name' => 'civicrm_tag', @@ -190,40 +178,40 @@ static function &fields() { 'bao' => 'CRM_Core_BAO_Tag', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Tag', - ) , - 'is_selectable' => array( + ], + 'is_selectable' => [ 'name' => 'is_selectable', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Display Tag?') , + 'title' => ts('Display Tag?'), 'description' => 'Is this tag selectable / displayed', 'default' => '1', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', 'localizable' => 0, - ) , - 'is_reserved' => array( + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Reserved') , + 'title' => ts('Reserved'), 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', 'localizable' => 0, - ) , - 'is_tagset' => array( + ], + 'is_tagset' => [ 'name' => 'is_tagset', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Tagset') , + 'title' => ts('Tagset'), 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', 'localizable' => 0, - ) , - 'used_for' => array( + ], + 'used_for' => [ 'name' => 'used_for', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Used For') , + 'title' => ts('Used For'), 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'default' => 'NULL', @@ -231,29 +219,29 @@ static function &fields() { 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'tag_used_for', 'optionEditPath' => 'civicrm/admin/options/tag_used_for', - ) - ) , - 'created_id' => array( + ] + ], + 'created_id' => [ 'name' => 'created_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Tag Created By') , + 'title' => ts('Tag Created By'), 'description' => 'FK to civicrm_contact, who created this tag', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'color' => array( + ], + 'color' => [ 'name' => 'color', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Color') , + 'title' => ts('Color'), 'description' => 'Hex color value e.g. #ffffff', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -262,50 +250,54 @@ static function &fields() { 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', 'localizable' => 0, - ) , - 'created_date' => array( + ], + 'created_date' => [ 'name' => 'created_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Tag Created Date') , + 'title' => ts('Tag Created Date'), 'description' => 'Date and time that tag was created.', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -313,10 +305,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'tag', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'tag', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -324,25 +317,31 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'tag', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'tag', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_name' => array( + $indices = [ + 'UI_name' => [ 'name' => 'UI_name', - 'field' => array( + 'field' => [ 0 => 'name', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_tag::1::name', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Timezone.php b/CRM/Core/DAO/Timezone.php index de019cb6cca6..820a77146a2f 100644 --- a/CRM/Core/DAO/Timezone.php +++ b/CRM/Core/DAO/Timezone.php @@ -1,29 +1,5 @@ __table = 'civicrm_timezone'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'country_id', 'civicrm_country', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'country_id', 'civicrm_country', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Timezone ID') , + 'title' => ts('Timezone ID'), 'description' => 'Timezone Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_timezone', 'entity' => 'Timezone', 'bao' => 'CRM_Core_DAO_Timezone', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Timezone Name') , + 'title' => ts('Timezone Name'), 'description' => 'Timezone full name', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -136,11 +121,11 @@ static function &fields() { 'entity' => 'Timezone', 'bao' => 'CRM_Core_DAO_Timezone', 'localizable' => 0, - ) , - 'abbreviation' => array( + ], + 'abbreviation' => [ 'name' => 'abbreviation', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Timezone Abbreviation') , + 'title' => ts('Timezone Abbreviation'), 'description' => 'ISO Code for timezone abbreviation', 'maxlength' => 3, 'size' => CRM_Utils_Type::FOUR, @@ -148,11 +133,11 @@ static function &fields() { 'entity' => 'Timezone', 'bao' => 'CRM_Core_DAO_Timezone', 'localizable' => 0, - ) , - 'gmt' => array( + ], + 'gmt' => [ 'name' => 'gmt', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('GMT Name of Timezone') , + 'title' => ts('GMT Name of Timezone'), 'description' => 'GMT name of the timezone', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -160,61 +145,65 @@ static function &fields() { 'entity' => 'Timezone', 'bao' => 'CRM_Core_DAO_Timezone', 'localizable' => 0, - ) , - 'offset' => array( + ], + 'offset' => [ 'name' => 'offset', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('GMT Offset') , + 'title' => ts('GMT Offset'), 'table_name' => 'civicrm_timezone', 'entity' => 'Timezone', 'bao' => 'CRM_Core_DAO_Timezone', 'localizable' => 0, - ) , - 'country_id' => array( + ], + 'country_id' => [ 'name' => 'country_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Country') , + 'title' => ts('Country'), 'description' => 'Country Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_timezone', 'entity' => 'Timezone', 'bao' => 'CRM_Core_DAO_Timezone', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Country', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -222,10 +211,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'timezone', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'timezone', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -233,15 +223,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'timezone', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'timezone', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/UFField.php b/CRM/Core/DAO/UFField.php index 29e55b450923..c59199760e64 100644 --- a/CRM/Core/DAO/UFField.php +++ b/CRM/Core/DAO/UFField.php @@ -1,29 +1,5 @@ __table = 'civicrm_uf_field'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'uf_group_id', 'civicrm_uf_group', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'location_type_id', 'civicrm_location_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'uf_group_id', 'civicrm_uf_group', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'location_type_id', 'civicrm_location_type', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Profile Field ID') , + 'title' => ts('Profile Field ID'), 'description' => 'Unique table ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_uf_field', 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 0, - ) , - 'uf_group_id' => array( + ], + 'uf_group_id' => [ 'name' => 'uf_group_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Profile ID') , + 'title' => ts('Profile ID'), 'description' => 'Which form does this field belong to.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_uf_field', 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_UFGroup', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_uf_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'field_name' => array( + ] + ], + 'field_name' => [ 'name' => 'field_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Profile Field Name') , + 'title' => ts('Profile Field Name'), 'description' => 'Name for CiviCRM field which is being exposed for sharing.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_uf_field', 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Profile Field Is Active') , + 'title' => ts('Profile Field Is Active'), 'description' => 'Is this field currently shareable? If false, hide the field for all sharing contexts.', 'default' => '1', 'table_name' => 'civicrm_uf_field', 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 0, - ) , - 'is_view' => array( + ], + 'is_view' => [ 'name' => 'is_view', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Profile Is View Only') , + 'title' => ts('Profile Is View Only'), 'description' => 'the field is view only and not editable in user forms.', 'table_name' => 'civicrm_uf_field', 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 0, - ) , - 'is_required' => array( + ], + 'is_required' => [ 'name' => 'is_required', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Profile Field Is Required') , + 'title' => ts('Profile Field Is Required'), 'description' => 'Is this field required when included in a user or registration form?', 'table_name' => 'civicrm_uf_field', 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 0, - ) , - 'weight' => array( + ], + 'weight' => [ 'name' => 'weight', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Order') , + 'title' => ts('Order'), 'description' => 'Controls field display order when user framework fields are displayed in registration and account editing forms.', - 'required' => true, + 'required' => TRUE, 'default' => '1', 'table_name' => 'civicrm_uf_field', 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 0, - ) , - 'help_post' => array( + ], + 'help_post' => [ 'name' => 'help_post', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Profile Field Post Help') , + 'title' => ts('Profile Field Post Help'), 'description' => 'Description and/or help text to display after this field.', 'table_name' => 'civicrm_uf_field', 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 1, - ) , - 'help_pre' => array( + ], + 'help_pre' => [ 'name' => 'help_pre', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Profile Field Pre Help') , + 'title' => ts('Profile Field Pre Help'), 'description' => 'Description and/or help text to display before this field.', 'table_name' => 'civicrm_uf_field', 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 1, - ) , - 'visibility' => array( + ], + 'visibility' => [ 'name' => 'visibility', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Profile Field Visibility') , + 'title' => ts('Profile Field Visibility'), 'description' => 'In what context(s) is this field visible.', 'maxlength' => 32, 'size' => CRM_Utils_Type::MEDIUM, @@ -313,81 +312,81 @@ static function &fields() { 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::ufVisibility', - ) - ) , - 'in_selector' => array( + ] + ], + 'in_selector' => [ 'name' => 'in_selector', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Profile Field Is a Filter') , + 'title' => ts('Profile Field Is a Filter'), 'description' => 'Is this field included as a column in the selector table?', 'table_name' => 'civicrm_uf_field', 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 0, - ) , - 'is_searchable' => array( + ], + 'is_searchable' => [ 'name' => 'is_searchable', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Profile Field Is Searchable') , + 'title' => ts('Profile Field Is Searchable'), 'description' => 'Is this field included search form of profile?', 'table_name' => 'civicrm_uf_field', 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 0, - ) , - 'location_type_id' => array( + ], + 'location_type_id' => [ 'name' => 'location_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Profile Field Location Type') , + 'title' => ts('Profile Field Location Type'), 'description' => 'Location type of this mapping, if required', 'table_name' => 'civicrm_uf_field', 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_LocationType', - ) , - 'phone_type_id' => array( + ], + 'phone_type_id' => [ 'name' => 'phone_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Profile Field Phone Type') , + 'title' => ts('Profile Field Phone Type'), 'description' => 'Phone Type Id, if required', 'table_name' => 'civicrm_uf_field', 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 0, - ) , - 'website_type_id' => array( + ], + 'website_type_id' => [ 'name' => 'website_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Profile Field Website Type') , + 'title' => ts('Profile Field Website Type'), 'description' => 'Website Type Id, if required', 'table_name' => 'civicrm_uf_field', 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 0, - ) , - 'label' => array( + ], + 'label' => [ 'name' => 'label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Profile Field Label') , + 'title' => ts('Profile Field Label'), 'description' => 'To save label for fields.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_uf_field', 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 1, - ) , - 'field_type' => array( + ], + 'field_type' => [ 'name' => 'field_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Profile Field Type') , + 'title' => ts('Profile Field Type'), 'description' => 'This field saves field type (ie individual,household.. field etc).', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -395,60 +394,64 @@ static function &fields() { 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 0, - ) , - 'is_reserved' => array( + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Profile Field Is Reserved') , + 'title' => ts('Profile Field Is Reserved'), 'description' => 'Is this field reserved for use by some other CiviCRM functionality?', 'table_name' => 'civicrm_uf_field', 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 0, - ) , - 'is_multi_summary' => array( + ], + 'is_multi_summary' => [ 'name' => 'is_multi_summary', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Profile Field Supports Multiple') , + 'title' => ts('Profile Field Supports Multiple'), 'description' => 'Include in multi-record listing?', 'table_name' => 'civicrm_uf_field', 'entity' => 'UFField', 'bao' => 'CRM_Core_BAO_UFField', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -456,10 +459,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_field', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_field', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -467,24 +471,30 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_field', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_field', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'IX_website_type_id' => array( + $indices = [ + 'IX_website_type_id' => [ 'name' => 'IX_website_type_id', - 'field' => array( + 'field' => [ 0 => 'website_type_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_uf_field::0::website_type_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/UFGroup.php b/CRM/Core/DAO/UFGroup.php index e957729b3ad4..44300b6f4ff2 100644 --- a/CRM/Core/DAO/UFGroup.php +++ b/CRM/Core/DAO/UFGroup.php @@ -1,29 +1,5 @@ __table = 'civicrm_uf_group'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'limit_listings_group_id', 'civicrm_group', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'add_to_group_id', 'civicrm_group', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'limit_listings_group_id', 'civicrm_group', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'add_to_group_id', 'civicrm_group', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Profile ID') , + 'title' => ts('Profile ID'), 'description' => 'Unique table ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_uf_group', 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Profile Is Active') , + 'title' => ts('Profile Is Active'), 'description' => 'Is this form currently active? If false, hide all related fields for all sharing contexts.', 'default' => '1', 'table_name' => 'civicrm_uf_group', 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, - ) , - 'group_type' => array( + ], + 'group_type' => [ 'name' => 'group_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Profile Group Type') , + 'title' => ts('Profile Group Type'), 'description' => 'This column will store a comma separated list of the type(s) of profile fields.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_uf_group.group_type', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_uf_group', 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED, - ) , - 'title' => array( + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Title') , + 'title' => ts('Title'), 'description' => 'Form title.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_uf_group', 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 1, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Profile Description') , + 'title' => ts('Profile Description'), 'description' => 'Optional verbose description of the profile.', 'rows' => 2, 'cols' => 60, @@ -294,14 +298,14 @@ static function &fields() { 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'help_pre' => array( + ], + ], + 'help_pre' => [ 'name' => 'help_pre', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Help Pre') , + 'title' => ts('Help Pre'), 'description' => 'Description and/or help text to display before fields in form.', 'rows' => 4, 'cols' => 80, @@ -309,14 +313,14 @@ static function &fields() { 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'help_post' => array( + ], + ], + 'help_post' => [ 'name' => 'help_post', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Profile Post Text') , + 'title' => ts('Profile Post Text'), 'description' => 'Description and/or help text to display after fields in form.', 'rows' => 4, 'cols' => 80, @@ -324,25 +328,25 @@ static function &fields() { 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'limit_listings_group_id' => array( + ], + ], + 'limit_listings_group_id' => [ 'name' => 'limit_listings_group_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Profile Search Limit Group') , + 'title' => ts('Profile Search Limit Group'), 'description' => 'Group id, foreign key from civicrm_group', 'table_name' => 'civicrm_uf_group', 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Group', - ) , - 'post_URL' => array( + ], + 'post_URL' => [ 'name' => 'post_URL', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Post Url') , + 'title' => ts('Post Url'), 'description' => 'Redirect to URL.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -350,72 +354,72 @@ static function &fields() { 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, - ) , - 'add_to_group_id' => array( + ], + 'add_to_group_id' => [ 'name' => 'add_to_group_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Add Contact To Group') , + 'title' => ts('Add Contact To Group'), 'description' => 'foreign key to civicrm_group_id', 'table_name' => 'civicrm_uf_group', 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Group', - ) , - 'add_captcha' => array( + ], + 'add_captcha' => [ 'name' => 'add_captcha', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Show Captcha On Profile') , + 'title' => ts('Show Captcha On Profile'), 'description' => 'Should a CAPTCHA widget be included this Profile form.', 'table_name' => 'civicrm_uf_group', 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, - ) , - 'is_map' => array( + ], + 'is_map' => [ 'name' => 'is_map', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Map Profile') , + 'title' => ts('Map Profile'), 'description' => 'Do we want to map results from this profile.', 'table_name' => 'civicrm_uf_group', 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, - ) , - 'is_edit_link' => array( + ], + 'is_edit_link' => [ 'name' => 'is_edit_link', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Show Edit Link?') , + 'title' => ts('Show Edit Link?'), 'description' => 'Should edit link display in profile selector', 'table_name' => 'civicrm_uf_group', 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, - ) , - 'is_uf_link' => array( + ], + 'is_uf_link' => [ 'name' => 'is_uf_link', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Show Link to CMS User') , + 'title' => ts('Show Link to CMS User'), 'description' => 'Should we display a link to the website profile in profile selector', 'table_name' => 'civicrm_uf_group', 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, - ) , - 'is_update_dupe' => array( + ], + 'is_update_dupe' => [ 'name' => 'is_update_dupe', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Update on Duplicate') , + 'title' => ts('Update on Duplicate'), 'description' => 'Should we update the contact record if we find a duplicate', 'table_name' => 'civicrm_uf_group', 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, - ) , - 'cancel_URL' => array( + ], + 'cancel_URL' => [ 'name' => 'cancel_URL', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Profile Cancel URL') , + 'title' => ts('Profile Cancel URL'), 'description' => 'Redirect to URL when Cancle button clik .', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -423,40 +427,40 @@ static function &fields() { 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, - ) , - 'is_cms_user' => array( + ], + 'is_cms_user' => [ 'name' => 'is_cms_user', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Create CMS User?') , + 'title' => ts('Create CMS User?'), 'description' => 'Should we create a cms user for this profile ', 'table_name' => 'civicrm_uf_group', 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, - ) , - 'notify' => array( + ], + 'notify' => [ 'name' => 'notify', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Notify on Profile Submit') , + 'title' => ts('Notify on Profile Submit'), 'table_name' => 'civicrm_uf_group', 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, - ) , - 'is_reserved' => array( + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Profile Is Reserved') , + 'title' => ts('Profile Is Reserved'), 'description' => 'Is this group reserved for use by some other CiviCRM functionality?', 'table_name' => 'civicrm_uf_group', 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Profile Name') , + 'title' => ts('Profile Name'), 'description' => 'Name of the UF group for directly addressing it in the codebase', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -464,42 +468,42 @@ static function &fields() { 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, - ) , - 'created_id' => array( + ], + 'created_id' => [ 'name' => 'created_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Profile Created By') , + 'title' => ts('Profile Created By'), 'description' => 'FK to civicrm_contact, who created this UF group', 'table_name' => 'civicrm_uf_group', 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'created_date' => array( + ], + 'created_date' => [ 'name' => 'created_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('UF Group Created Date') , + 'title' => ts('UF Group Created Date'), 'description' => 'Date and time this UF group was created.', 'table_name' => 'civicrm_uf_group', 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, - ) , - 'is_proximity_search' => array( + ], + 'is_proximity_search' => [ 'name' => 'is_proximity_search', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Include Proximity Search?') , + 'title' => ts('Include Proximity Search?'), 'description' => 'Should we include proximity search feature in this profile search form?', 'table_name' => 'civicrm_uf_group', 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 0, - ) , - 'cancel_button_text' => array( + ], + 'cancel_button_text' => [ 'name' => 'cancel_button_text', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Cancel Button Text') , + 'title' => ts('Cancel Button Text'), 'description' => 'Custom Text to display on the Cancel button when used in create or edit mode', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -508,11 +512,11 @@ static function &fields() { 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 1, - ) , - 'submit_button_text' => array( + ], + 'submit_button_text' => [ 'name' => 'submit_button_text', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Submit Button Text') , + 'title' => ts('Submit Button Text'), 'description' => 'Custom Text to display on the submit button on profile edit/create screens', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -521,40 +525,44 @@ static function &fields() { 'entity' => 'UFGroup', 'bao' => 'CRM_Core_BAO_UFGroup', 'localizable' => 1, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -562,10 +570,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_group', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_group', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -573,25 +582,31 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_group', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_group', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_name' => array( + $indices = [ + 'UI_name' => [ 'name' => 'UI_name', - 'field' => array( + 'field' => [ 0 => 'name', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_uf_group::1::name', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/UFJoin.php b/CRM/Core/DAO/UFJoin.php index d28ebd759531..59c2a7d1b6c4 100644 --- a/CRM/Core/DAO/UFJoin.php +++ b/CRM/Core/DAO/UFJoin.php @@ -1,29 +1,5 @@ __table = 'civicrm_uf_join'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'uf_group_id', 'civicrm_uf_group', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'uf_group_id', 'civicrm_uf_group', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('UF Join ID') , + 'title' => ts('UF Join ID'), 'description' => 'Unique table ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_uf_join', 'entity' => 'UFJoin', 'bao' => 'CRM_Core_BAO_UFJoin', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Profile Use is active') , + 'title' => ts('Profile Use is active'), 'description' => 'Is this join currently active?', 'default' => '1', 'table_name' => 'civicrm_uf_join', 'entity' => 'UFJoin', 'bao' => 'CRM_Core_BAO_UFJoin', 'localizable' => 0, - ) , - 'module' => array( + ], + 'module' => [ 'name' => 'module', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Profile Module') , + 'title' => ts('Profile Module'), 'description' => 'Module which owns this uf_join instance, e.g. User Registration, CiviDonate, etc.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_uf_join', 'entity' => 'UFJoin', 'bao' => 'CRM_Core_BAO_UFJoin', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Profile Entity Table') , + 'title' => ts('Profile Entity Table'), 'description' => 'Name of table where item being referenced is stored. Modules which only need a single collection of uf_join instances may choose not to populate entity_table and entity_id.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -174,96 +162,100 @@ static function &fields() { 'entity' => 'UFJoin', 'bao' => 'CRM_Core_BAO_UFJoin', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Core_BAO_UFJoin::entityTables', - ) - ) , - 'entity_id' => array( + ] + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Profile Entity ID') , + 'title' => ts('Profile Entity ID'), 'description' => 'Foreign key to the referenced item.', 'table_name' => 'civicrm_uf_join', 'entity' => 'UFJoin', 'bao' => 'CRM_Core_BAO_UFJoin', 'localizable' => 0, - ) , - 'weight' => array( + ], + 'weight' => [ 'name' => 'weight', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Order') , + 'title' => ts('Order'), 'description' => 'Controls display order when multiple user framework groups are setup for concurrent display.', - 'required' => true, + 'required' => TRUE, 'default' => '1', 'table_name' => 'civicrm_uf_join', 'entity' => 'UFJoin', 'bao' => 'CRM_Core_BAO_UFJoin', 'localizable' => 0, - ) , - 'uf_group_id' => array( + ], + 'uf_group_id' => [ 'name' => 'uf_group_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Profile ID') , + 'title' => ts('Profile ID'), 'description' => 'Which form does this field belong to.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_uf_join', 'entity' => 'UFJoin', 'bao' => 'CRM_Core_BAO_UFJoin', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_UFGroup', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_uf_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'module_data' => array( + ] + ], + 'module_data' => [ 'name' => 'module_data', 'type' => CRM_Utils_Type::T_LONGTEXT, - 'title' => ts('Profile Use Data') , + 'title' => ts('Profile Use Data'), 'description' => 'Json serialized array of data used by the ufjoin.module', 'table_name' => 'civicrm_uf_join', 'entity' => 'UFJoin', 'bao' => 'CRM_Core_BAO_UFJoin', 'localizable' => 0, 'serialize' => self::SERIALIZE_JSON, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -271,10 +263,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_join', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_join', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -282,25 +275,31 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_join', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_join', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_entity' => array( + $indices = [ + 'index_entity' => [ 'name' => 'index_entity', - 'field' => array( + 'field' => [ 0 => 'entity_table', 1 => 'entity_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_uf_join::0::entity_table::entity_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/UFMatch.php b/CRM/Core/DAO/UFMatch.php index b81569bbdfbf..d3e8ddc839b7 100644 --- a/CRM/Core/DAO/UFMatch.php +++ b/CRM/Core/DAO/UFMatch.php @@ -1,29 +1,5 @@ __table = 'civicrm_uf_match'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('UF Match ID') , + 'title' => ts('UF Match ID'), 'description' => 'System generated ID.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_uf_match', 'entity' => 'UFMatch', 'bao' => 'CRM_Core_BAO_UFMatch', 'localizable' => 0, - ) , - 'domain_id' => array( + ], + 'domain_id' => [ 'name' => 'domain_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('UF Match Domain ID') , + 'title' => ts('UF Match Domain ID'), 'description' => 'Which Domain is this match entry for', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_uf_match', 'entity' => 'UFMatch', 'bao' => 'CRM_Core_BAO_UFMatch', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Domain', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'uf_id' => array( + ] + ], + 'uf_id' => [ 'name' => 'uf_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('CMS ID') , + 'title' => ts('CMS ID'), 'description' => 'UF ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_uf_match', 'entity' => 'UFMatch', 'bao' => 'CRM_Core_BAO_UFMatch', 'localizable' => 0, - ) , - 'uf_name' => array( + ], + 'uf_name' => [ 'name' => 'uf_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('CMS Unique Identifier') , + 'title' => ts('CMS Unique Identifier'), 'description' => 'UF Name', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -166,22 +152,22 @@ static function &fields() { 'entity' => 'UFMatch', 'bao' => 'CRM_Core_BAO_UFMatch', 'localizable' => 0, - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('CiviCRM Contact ID') , + 'title' => ts('CiviCRM Contact ID'), 'description' => 'FK to Contact ID', 'table_name' => 'civicrm_uf_match', 'entity' => 'UFMatch', 'bao' => 'CRM_Core_BAO_UFMatch', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'language' => array( + ], + 'language' => [ 'name' => 'language', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Preferred Language') , + 'title' => ts('Preferred Language'), 'description' => 'UI language preferred by the given user/contact', 'maxlength' => 5, 'size' => CRM_Utils_Type::SIX, @@ -189,40 +175,44 @@ static function &fields() { 'entity' => 'UFMatch', 'bao' => 'CRM_Core_BAO_UFMatch', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -230,10 +220,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_match', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_match', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -241,44 +232,50 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_match', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_match', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'I_civicrm_uf_match_uf_id' => array( + $indices = [ + 'I_civicrm_uf_match_uf_id' => [ 'name' => 'I_civicrm_uf_match_uf_id', - 'field' => array( + 'field' => [ 0 => 'uf_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_uf_match::0::uf_id', - ) , - 'UI_uf_name_domain_id' => array( + ], + 'UI_uf_name_domain_id' => [ 'name' => 'UI_uf_name_domain_id', - 'field' => array( + 'field' => [ 0 => 'uf_name', 1 => 'domain_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_uf_match::1::uf_name::domain_id', - ) , - 'UI_contact_domain_id' => array( + ], + 'UI_contact_domain_id' => [ 'name' => 'UI_contact_domain_id', - 'field' => array( + 'field' => [ 0 => 'contact_id', 1 => 'domain_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_uf_match::1::contact_id::domain_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Website.php b/CRM/Core/DAO/Website.php index 4a7ae32aa509..a6df26b94cf2 100644 --- a/CRM/Core/DAO/Website.php +++ b/CRM/Core/DAO/Website.php @@ -1,29 +1,5 @@ __table = 'civicrm_website'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Website ID') , + 'title' => ts('Website ID'), 'description' => 'Unique Website ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', 'localizable' => 0, - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact') , + 'title' => ts('Contact'), 'description' => 'FK to Contact ID', 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'url' => array( + ], + 'url' => [ 'name' => 'url', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Website') , + 'title' => ts('Website'), 'description' => 'Website', 'maxlength' => 128, 'size' => 30, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_website.url', 'headerPattern' => '/Website/i', 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'website_type_id' => array( + ], + ], + 'website_type_id' => [ 'name' => 'website_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Website Type') , + 'title' => ts('Website Type'), 'description' => 'Which Website type does this website belong to.', 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'website_type', 'optionEditPath' => 'civicrm/admin/options/website_type', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -202,10 +190,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'website', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'website', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -213,24 +202,30 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'website', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'website', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_website_type_id' => array( + $indices = [ + 'UI_website_type_id' => [ 'name' => 'UI_website_type_id', - 'field' => array( + 'field' => [ 0 => 'website_type_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_website::0::website_type_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/WordReplacement.php b/CRM/Core/DAO/WordReplacement.php index 6db5e7df798b..d3a2910bb4a8 100644 --- a/CRM/Core/DAO/WordReplacement.php +++ b/CRM/Core/DAO/WordReplacement.php @@ -1,29 +1,5 @@ __table = 'civicrm_word_replacement'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Word Replacement ID') , + 'title' => ts('Word Replacement ID'), 'description' => 'Word replacement ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_word_replacement', 'entity' => 'WordReplacement', 'bao' => 'CRM_Core_BAO_WordReplacement', 'localizable' => 0, - ) , - 'find_word' => array( + ], + 'find_word' => [ 'name' => 'find_word', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Replaced Word') , + 'title' => ts('Replaced Word'), 'description' => 'Word which need to be replaced', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -136,11 +121,11 @@ static function &fields() { 'entity' => 'WordReplacement', 'bao' => 'CRM_Core_BAO_WordReplacement', 'localizable' => 0, - ) , - 'replace_word' => array( + ], + 'replace_word' => [ 'name' => 'replace_word', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Replacement Word') , + 'title' => ts('Replacement Word'), 'description' => 'Word which will replace the word in find', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -148,22 +133,22 @@ static function &fields() { 'entity' => 'WordReplacement', 'bao' => 'CRM_Core_BAO_WordReplacement', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Word Replacement is Active') , + 'title' => ts('Word Replacement is Active'), 'description' => 'Is this entry active?', 'default' => '1', 'table_name' => 'civicrm_word_replacement', 'entity' => 'WordReplacement', 'bao' => 'CRM_Core_BAO_WordReplacement', 'localizable' => 0, - ) , - 'match_type' => array( + ], + 'match_type' => [ 'name' => 'match_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Word Replacement Match Type') , + 'title' => ts('Word Replacement Match Type'), 'maxlength' => 16, 'size' => CRM_Utils_Type::TWELVE, 'default' => 'wildcardMatch', @@ -171,62 +156,66 @@ static function &fields() { 'entity' => 'WordReplacement', 'bao' => 'CRM_Core_BAO_WordReplacement', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getWordReplacementMatchType', - ) - ) , - 'domain_id' => array( + ] + ], + 'domain_id' => [ 'name' => 'domain_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Word Replacement Domain ID') , + 'title' => ts('Word Replacement Domain ID'), 'description' => 'FK to Domain ID. This is for Domain specific word replacement', 'table_name' => 'civicrm_word_replacement', 'entity' => 'WordReplacement', 'bao' => 'CRM_Core_BAO_WordReplacement', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Domain', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -234,10 +223,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'word_replacement', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'word_replacement', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -245,26 +235,32 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'word_replacement', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'word_replacement', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_domain_find' => array( + $indices = [ + 'UI_domain_find' => [ 'name' => 'UI_domain_find', - 'field' => array( + 'field' => [ 0 => 'domain_id', 1 => 'find_word', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_word_replacement::1::domain_id::find_word', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Core/DAO/Worldregion.php b/CRM/Core/DAO/Worldregion.php index 81c3f641d64f..bd1ab119140c 100644 --- a/CRM/Core/DAO/Worldregion.php +++ b/CRM/Core/DAO/Worldregion.php @@ -1,29 +1,5 @@ __table = 'civicrm_worldregion'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('World Region ID') , + 'title' => ts('World Region ID'), 'description' => 'Country Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_worldregion', 'entity' => 'Worldregion', 'bao' => 'CRM_Core_DAO_Worldregion', 'localizable' => 0, - ) , - 'world_region' => array( + ], + 'world_region' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('World Region') , + 'title' => ts('World Region'), 'description' => 'Region name to be associated with countries', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_worldregion.name', 'headerPattern' => '', 'dataPattern' => '', @@ -103,40 +84,44 @@ static function &fields() { 'entity' => 'Worldregion', 'bao' => 'CRM_Core_DAO_Worldregion', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -144,10 +129,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'worldregion', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'worldregion', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -155,15 +141,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'worldregion', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'worldregion', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Cxn/DAO/Cxn.php b/CRM/Cxn/DAO/Cxn.php index 36a519468ee1..679858f8a20d 100644 --- a/CRM/Cxn/DAO/Cxn.php +++ b/CRM/Cxn/DAO/Cxn.php @@ -1,29 +1,5 @@ __table = 'civicrm_cxn'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Connection ID') , + 'title' => ts('Connection ID'), 'description' => 'Connection ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_cxn', 'entity' => 'Cxn', 'bao' => 'CRM_Cxn_BAO_Cxn', 'localizable' => 0, - ) , - 'app_guid' => array( + ], + 'app_guid' => [ 'name' => 'app_guid', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Application GUID') , + 'title' => ts('Application GUID'), 'description' => 'Application GUID', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -153,21 +143,21 @@ static function &fields() { 'entity' => 'Cxn', 'bao' => 'CRM_Cxn_BAO_Cxn', 'localizable' => 0, - ) , - 'app_meta' => array( + ], + 'app_meta' => [ 'name' => 'app_meta', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Application Metadata (JSON)') , + 'title' => ts('Application Metadata (JSON)'), 'description' => 'Application Metadata (JSON)', 'table_name' => 'civicrm_cxn', 'entity' => 'Cxn', 'bao' => 'CRM_Cxn_BAO_Cxn', 'localizable' => 0, - ) , - 'cxn_guid' => array( + ], + 'cxn_guid' => [ 'name' => 'cxn_guid', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Connection GUID') , + 'title' => ts('Connection GUID'), 'description' => 'Connection GUID', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -175,118 +165,122 @@ static function &fields() { 'entity' => 'Cxn', 'bao' => 'CRM_Cxn_BAO_Cxn', 'localizable' => 0, - ) , - 'secret' => array( + ], + 'secret' => [ 'name' => 'secret', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Secret') , + 'title' => ts('Secret'), 'description' => 'Shared secret', 'table_name' => 'civicrm_cxn', 'entity' => 'Cxn', 'bao' => 'CRM_Cxn_BAO_Cxn', 'localizable' => 0, - ) , - 'perm' => array( + ], + 'perm' => [ 'name' => 'perm', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Perm') , + 'title' => ts('Perm'), 'description' => 'Permissions approved for the service (JSON)', 'table_name' => 'civicrm_cxn', 'entity' => 'Cxn', 'bao' => 'CRM_Cxn_BAO_Cxn', 'localizable' => 0, - ) , - 'options' => array( + ], + 'options' => [ 'name' => 'options', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Options') , + 'title' => ts('Options'), 'description' => 'Options for the service (JSON)', 'table_name' => 'civicrm_cxn', 'entity' => 'Cxn', 'bao' => 'CRM_Cxn_BAO_Cxn', 'localizable' => 0, 'serialize' => self::SERIALIZE_JSON, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Active') , + 'title' => ts('Is Active'), 'description' => 'Is connection currently enabled?', 'default' => '1', 'table_name' => 'civicrm_cxn', 'entity' => 'Cxn', 'bao' => 'CRM_Cxn_BAO_Cxn', 'localizable' => 0, - ) , - 'created_date' => array( + ], + 'created_date' => [ 'name' => 'created_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Created Date') , + 'title' => ts('Created Date'), 'description' => 'When was the connection was created.', - 'required' => false, + 'required' => FALSE, 'default' => 'NULL', 'table_name' => 'civicrm_cxn', 'entity' => 'Cxn', 'bao' => 'CRM_Cxn_BAO_Cxn', 'localizable' => 0, - ) , - 'modified_date' => array( + ], + 'modified_date' => [ 'name' => 'modified_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Modified Date') , + 'title' => ts('Modified Date'), 'description' => 'When the connection was created or modified.', - 'required' => false, + 'required' => FALSE, 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', 'table_name' => 'civicrm_cxn', 'entity' => 'Cxn', 'bao' => 'CRM_Cxn_BAO_Cxn', 'localizable' => 0, - ) , - 'fetched_date' => array( + ], + 'fetched_date' => [ 'name' => 'fetched_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Fetched Date') , + 'title' => ts('Fetched Date'), 'description' => 'The last time the application metadata was fetched.', - 'required' => false, + 'required' => FALSE, 'default' => 'NULL', 'table_name' => 'civicrm_cxn', 'entity' => 'Cxn', 'bao' => 'CRM_Cxn_BAO_Cxn', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -294,10 +288,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'cxn', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'cxn', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -305,34 +300,40 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'cxn', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'cxn', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_appid' => array( + $indices = [ + 'UI_appid' => [ 'name' => 'UI_appid', - 'field' => array( + 'field' => [ 0 => 'app_guid', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_cxn::1::app_guid', - ) , - 'UI_keypair_cxnid' => array( + ], + 'UI_keypair_cxnid' => [ 'name' => 'UI_keypair_cxnid', - 'field' => array( + 'field' => [ 0 => 'cxn_guid', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_cxn::1::cxn_guid', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Dedupe/DAO/Exception.php b/CRM/Dedupe/DAO/Exception.php index 3b6b7e52b14b..ecf939fba341 100644 --- a/CRM/Dedupe/DAO/Exception.php +++ b/CRM/Dedupe/DAO/Exception.php @@ -1,29 +1,5 @@ __table = 'civicrm_dedupe_exception'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id1', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id2', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id1', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id2', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Dedupe Exception ID') , + 'title' => ts('Dedupe Exception ID'), 'description' => 'Unique dedupe exception id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_dedupe_exception', 'entity' => 'Exception', 'bao' => 'CRM_Dedupe_DAO_Exception', 'localizable' => 0, - ) , - 'contact_id1' => array( + ], + 'contact_id1' => [ 'name' => 'contact_id1', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('First Dupe Contact ID') , + 'title' => ts('First Dupe Contact ID'), 'description' => 'FK to Contact ID', 'table_name' => 'civicrm_dedupe_exception', 'entity' => 'Exception', 'bao' => 'CRM_Dedupe_DAO_Exception', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'contact_id2' => array( + ], + 'contact_id2' => [ 'name' => 'contact_id2', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Second Dupe Contact ID') , + 'title' => ts('Second Dupe Contact ID'), 'description' => 'FK to Contact ID', 'table_name' => 'civicrm_dedupe_exception', 'entity' => 'Exception', 'bao' => 'CRM_Dedupe_DAO_Exception', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -171,10 +158,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_exception', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_exception', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -182,26 +170,32 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_exception', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_exception', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_contact_id1_contact_id2' => array( + $indices = [ + 'UI_contact_id1_contact_id2' => [ 'name' => 'UI_contact_id1_contact_id2', - 'field' => array( + 'field' => [ 0 => 'contact_id1', 1 => 'contact_id2', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_dedupe_exception::1::contact_id1::contact_id2', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Dedupe/DAO/Rule.php b/CRM/Dedupe/DAO/Rule.php index 924e230f5215..49d3356f4fe0 100644 --- a/CRM/Dedupe/DAO/Rule.php +++ b/CRM/Dedupe/DAO/Rule.php @@ -1,29 +1,5 @@ __table = 'civicrm_dedupe_rule'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'dedupe_rule_group_id', 'civicrm_dedupe_rule_group', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'dedupe_rule_group_id', 'civicrm_dedupe_rule_group', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Dedupe Rule ID') , + 'title' => ts('Dedupe Rule ID'), 'description' => 'Unique dedupe rule id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_dedupe_rule', 'entity' => 'Rule', 'bao' => 'CRM_Dedupe_BAO_Rule', 'localizable' => 0, - ) , - 'dedupe_rule_group_id' => array( + ], + 'dedupe_rule_group_id' => [ 'name' => 'dedupe_rule_group_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Dedupe Rule Group') , + 'title' => ts('Dedupe Rule Group'), 'description' => 'The id of the rule group this rule belongs to', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_dedupe_rule', 'entity' => 'Rule', 'bao' => 'CRM_Dedupe_BAO_Rule', 'localizable' => 0, 'FKClassName' => 'CRM_Dedupe_DAO_RuleGroup', - ) , - 'rule_table' => array( + ], + 'rule_table' => [ 'name' => 'rule_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Rule Table') , + 'title' => ts('Rule Table'), 'description' => 'The name of the table this rule is about', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_dedupe_rule', 'entity' => 'Rule', 'bao' => 'CRM_Dedupe_BAO_Rule', 'localizable' => 0, - ) , - 'rule_field' => array( + ], + 'rule_field' => [ 'name' => 'rule_field', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Rule Field') , + 'title' => ts('Rule Field'), 'description' => 'The name of the field of the table referenced in rule_table', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_dedupe_rule', 'entity' => 'Rule', 'bao' => 'CRM_Dedupe_BAO_Rule', 'localizable' => 0, - ) , - 'rule_length' => array( + ], + 'rule_length' => [ 'name' => 'rule_length', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Rule Length') , + 'title' => ts('Rule Length'), 'description' => 'The length of the matching substring', 'table_name' => 'civicrm_dedupe_rule', 'entity' => 'Rule', 'bao' => 'CRM_Dedupe_BAO_Rule', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'rule_weight' => array( + ], + ], + 'rule_weight' => [ 'name' => 'rule_weight', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Order') , + 'title' => ts('Order'), 'description' => 'The weight of the rule', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_dedupe_rule', 'entity' => 'Rule', 'bao' => 'CRM_Dedupe_BAO_Rule', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - ); + ], + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -231,10 +221,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -242,15 +233,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Dedupe/DAO/RuleGroup.php b/CRM/Dedupe/DAO/RuleGroup.php index b662b02795e2..924b83400ee7 100644 --- a/CRM/Dedupe/DAO/RuleGroup.php +++ b/CRM/Dedupe/DAO/RuleGroup.php @@ -1,29 +1,5 @@ __table = 'civicrm_dedupe_rule_group'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Rule Group ID') , + 'title' => ts('Rule Group ID'), 'description' => 'Unique dedupe rule group id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_dedupe_rule_group', 'entity' => 'RuleGroup', 'bao' => 'CRM_Dedupe_BAO_RuleGroup', 'localizable' => 0, - ) , - 'contact_type' => array( + ], + 'contact_type' => [ 'name' => 'contact_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Contact Type') , + 'title' => ts('Contact Type'), 'description' => 'The type of contacts this group applies to', 'maxlength' => 12, 'size' => CRM_Utils_Type::TWELVE, @@ -129,53 +115,53 @@ static function &fields() { 'entity' => 'RuleGroup', 'bao' => 'CRM_Dedupe_BAO_RuleGroup', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_contact_type', 'keyColumn' => 'name', 'labelColumn' => 'label', 'condition' => 'parent_id IS NULL', - ) - ) , - 'threshold' => array( + ] + ], + 'threshold' => [ 'name' => 'threshold', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Threshold') , + 'title' => ts('Threshold'), 'description' => 'The weight threshold the sum of the rule weights has to cross to consider two contacts the same', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_dedupe_rule_group', 'entity' => 'RuleGroup', 'bao' => 'CRM_Dedupe_BAO_RuleGroup', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'used' => array( + ], + ], + 'used' => [ 'name' => 'used', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Length') , + 'title' => ts('Length'), 'description' => 'Whether the rule should be used for cases where usage is Unsupervised, Supervised OR General(programatically)', - 'required' => true, + 'required' => TRUE, 'maxlength' => 12, 'size' => CRM_Utils_Type::TWELVE, 'table_name' => 'civicrm_dedupe_rule_group', 'entity' => 'RuleGroup', 'bao' => 'CRM_Dedupe_BAO_RuleGroup', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Radio', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getDedupeRuleTypes', - ) - ) , - 'name' => array( + ] + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Name') , + 'title' => ts('Name'), 'description' => 'Name of the rule group', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -183,11 +169,11 @@ static function &fields() { 'entity' => 'RuleGroup', 'bao' => 'CRM_Dedupe_BAO_RuleGroup', 'localizable' => 0, - ) , - 'title' => array( + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Title') , + 'title' => ts('Title'), 'description' => 'Label of the rule group', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -195,56 +181,60 @@ static function &fields() { 'entity' => 'RuleGroup', 'bao' => 'CRM_Dedupe_BAO_RuleGroup', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'is_reserved' => array( + ], + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Reserved?') , + 'title' => ts('Reserved?'), 'description' => 'Is this a reserved rule - a rule group that has been optimized and cannot be changed by the admin', 'table_name' => 'civicrm_dedupe_rule_group', 'entity' => 'RuleGroup', 'bao' => 'CRM_Dedupe_BAO_RuleGroup', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - ); + ], + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -252,10 +242,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule_group', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule_group', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -263,15 +254,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule_group', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule_group', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Event/Cart/DAO/Cart.php b/CRM/Event/Cart/DAO/Cart.php index 568bb3f0e1c0..9fc151b89541 100644 --- a/CRM/Event/Cart/DAO/Cart.php +++ b/CRM/Event/Cart/DAO/Cart.php @@ -1,29 +1,5 @@ __table = 'civicrm_event_carts'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'user_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'user_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'cart_id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'cart_id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Cart ID') , + 'title' => ts('Cart ID'), 'description' => 'Cart Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_event_carts', 'entity' => 'Cart', 'bao' => 'CRM_Event_Cart_BAO_Cart', 'localizable' => 0, - ) , - 'user_id' => array( + ], + 'user_id' => [ 'name' => 'user_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Created By') , + 'title' => ts('Created By'), 'description' => 'FK to civicrm_contact who created this cart', 'table_name' => 'civicrm_event_carts', 'entity' => 'Cart', 'bao' => 'CRM_Event_Cart_BAO_Cart', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'completed' => array( + ], + 'completed' => [ 'name' => 'completed', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Complete?') , + 'title' => ts('Complete?'), 'table_name' => 'civicrm_event_carts', 'entity' => 'Cart', 'bao' => 'CRM_Event_Cart_BAO_Cart', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -167,10 +153,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'event_carts', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'event_carts', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -178,15 +165,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'event_carts', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'event_carts', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Event/Cart/DAO/EventInCart.php b/CRM/Event/Cart/DAO/EventInCart.php index 3178c52bdee4..a10b01c195b0 100644 --- a/CRM/Event/Cart/DAO/EventInCart.php +++ b/CRM/Event/Cart/DAO/EventInCart.php @@ -1,29 +1,5 @@ __table = 'civicrm_events_in_carts'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_id', 'civicrm_event', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_cart_id', 'civicrm_event_carts', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_id', 'civicrm_event', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_cart_id', 'civicrm_event_carts', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'event_in_cart_id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'event_in_cart_id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Event In Cart') , + 'title' => ts('Event In Cart'), 'description' => 'Event In Cart Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_events_in_carts', 'entity' => 'EventInCart', 'bao' => 'CRM_Event_Cart_BAO_EventInCart', 'localizable' => 0, - ) , - 'event_id' => array( + ], + 'event_id' => [ 'name' => 'event_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Event') , + 'title' => ts('Event'), 'description' => 'FK to Event ID', 'table_name' => 'civicrm_events_in_carts', 'entity' => 'EventInCart', 'bao' => 'CRM_Event_Cart_BAO_EventInCart', 'localizable' => 0, 'FKClassName' => 'CRM_Event_DAO_Event', - ) , - 'event_cart_id' => array( + ], + 'event_cart_id' => [ 'name' => 'event_cart_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Event In Cart') , + 'title' => ts('Event In Cart'), 'description' => 'FK to Event Cart ID', 'table_name' => 'civicrm_events_in_carts', 'entity' => 'EventInCart', 'bao' => 'CRM_Event_Cart_BAO_EventInCart', 'localizable' => 0, 'FKClassName' => 'CRM_Event_Cart_DAO_Cart', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -171,10 +158,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'events_in_carts', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'events_in_carts', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -182,15 +170,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'events_in_carts', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'events_in_carts', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Event/DAO/Event.php b/CRM/Event/DAO/Event.php index 54734c3b05d1..e132610e1e21 100644 --- a/CRM/Event/DAO/Event.php +++ b/CRM/Event/DAO/Event.php @@ -1,29 +1,5 @@ __table = 'civicrm_event'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'loc_block_id', 'civicrm_loc_block', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'dedupe_rule_group_id', 'civicrm_dedupe_rule_group', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'loc_block_id', 'civicrm_loc_block', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'dedupe_rule_group_id', 'civicrm_dedupe_rule_group', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Event ID') , + 'title' => ts('Event ID'), 'description' => 'Event', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - ) , - 'event_title' => array( + ], + 'event_title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Event Title') , + 'title' => ts('Event Title'), 'description' => 'Event Title (e.g. Fall Fundraiser Dinner)', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_event.title', 'headerPattern' => '/(event.)?title$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'summary' => array( + ], + ], + 'summary' => [ 'name' => 'summary', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Event Summary') , + 'title' => ts('Event Summary'), 'description' => 'Brief summary of event. Text and html allowed. Displayed on Event Registration form and can be used on other CMS pages which need an event summary.', 'rows' => 4, 'cols' => 60, @@ -537,14 +585,14 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'event_description' => array( + ], + ], + 'event_description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Event Description') , + 'title' => ts('Event Description'), 'description' => 'Full description of event. Text and html allowed. Displayed on built-in Event Information screens.', 'rows' => 8, 'cols' => 60, @@ -552,111 +600,111 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'event_type_id' => array( + ], + ], + 'event_type_id' => [ 'name' => 'event_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Event Type') , + 'title' => ts('Event Type'), 'description' => 'Event Type ID.Implicit FK to civicrm_option_value where option_group = event_type.', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'event_type', 'optionEditPath' => 'civicrm/admin/options/event_type', - ) - ) , - 'participant_listing_id' => array( + ] + ], + 'participant_listing_id' => [ 'name' => 'participant_listing_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Participant Listing') , + 'title' => ts('Participant Listing'), 'description' => 'Should we expose the participant list? Implicit FK to civicrm_option_value where option_group = participant_listing.', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'participant_listing', 'optionEditPath' => 'civicrm/admin/options/participant_listing', - ) - ) , - 'is_public' => array( + ] + ], + 'is_public' => [ 'name' => 'is_public', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Event Public') , + 'title' => ts('Is Event Public'), 'description' => 'Public events will be included in the iCal feeds. Access to private event information may be limited using ACLs.', 'default' => '1', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'event_start_date' => array( + ], + ], + 'event_start_date' => [ 'name' => 'start_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Event Start Date') , + 'title' => ts('Event Start Date'), 'description' => 'Date and time that event starts.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_event.start_date', 'headerPattern' => '/^start|(s(tart\s)?date)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'event_end_date' => array( + ], + ], + 'event_end_date' => [ 'name' => 'end_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Event End Date') , + 'title' => ts('Event End Date'), 'description' => 'Date and time that event ends. May be NULL if no defined end date/time', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_event.end_date', 'headerPattern' => '/^end|(e(nd\s)?date)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'is_online_registration' => array( + ], + ], + 'is_online_registration' => [ 'name' => 'is_online_registration', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Online Registration') , + 'title' => ts('Is Online Registration'), 'description' => 'If true, include registration link on Event Info page.', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'registration_link_text' => array( + ], + ], + 'registration_link_text' => [ 'name' => 'registration_link_text', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Event Registration Link Text') , + 'title' => ts('Event Registration Link Text'), 'description' => 'Text for link to Event Registration form which is displayed on Event Information screen when is_online_registration is true.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -664,54 +712,54 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'registration_start_date' => array( + ], + ], + 'registration_start_date' => [ 'name' => 'registration_start_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Registration Start Date') , + 'title' => ts('Registration Start Date'), 'description' => 'Date and time that online registration starts.', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'registration_end_date' => array( + ], + ], + 'registration_end_date' => [ 'name' => 'registration_end_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Registration End Date') , + 'title' => ts('Registration End Date'), 'description' => 'Date and time that online registration ends.', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'max_participants' => array( + ], + ], + 'max_participants' => [ 'name' => 'max_participants', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Max Participants') , + 'title' => ts('Max Participants'), 'description' => 'Maximum number of registered participants to allow. After max is reached, a custom Event Full message is displayed. If NULL, allow unlimited number of participants.', 'default' => 'NULL', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'event_full_text' => array( + ], + ], + 'event_full_text' => [ 'name' => 'event_full_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Event Information') , + 'title' => ts('Event Information'), 'description' => 'Message to display on Event Information page and INSTEAD OF Event Registration form if maximum participants are signed up. Can include email address/info about getting on a waiting list, etc. Text and html allowed.', 'rows' => 4, 'cols' => 60, @@ -719,46 +767,46 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'is_monetary' => array( + ], + ], + 'is_monetary' => [ 'name' => 'is_monetary', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is this a PAID event?') , + 'title' => ts('Is this a PAID event?'), 'description' => 'If true, one or more fee amounts must be set and a Payment Processor must be configured for Online Event Registration.', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'financial_type_id' => array( + ], + ], + 'financial_type_id' => [ 'name' => 'financial_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Type') , + 'title' => ts('Financial Type'), 'description' => 'Financial type assigned to paid event registrations for this event. Required if is_monetary is true.', 'default' => 'NULL', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'payment_processor' => array( + ] + ], + 'payment_processor' => [ 'name' => 'payment_processor', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Payment Processor') , + 'title' => ts('Payment Processor'), 'description' => 'Payment Processors configured for this Event (if is_monetary is true)', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -766,112 +814,112 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_payment_processor', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'is_map' => array( + ] + ], + 'is_map' => [ 'name' => 'is_map', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Map Enabled') , + 'title' => ts('Map Enabled'), 'description' => 'Include a map block on the Event Information page when geocode info is available and a mapping provider has been specified?', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'is_active' => array( + ], + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Active') , + 'title' => ts('Is Active'), 'description' => 'Is this Event enabled or disabled/cancelled?', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'fee_label' => array( + ], + ], + 'fee_label' => [ 'name' => 'fee_label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Fee Label') , + 'title' => ts('Fee Label'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_event.fee_label', 'headerPattern' => '/^fee|(f(ee\s)?label)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'is_show_location' => array( + ], + ], + 'is_show_location' => [ 'name' => 'is_show_location', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('show location') , + 'title' => ts('show location'), 'description' => 'If true, show event location.', 'default' => '1', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'loc_block_id' => array( + ], + ], + 'loc_block_id' => [ 'name' => 'loc_block_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Location Block ID') , + 'title' => ts('Location Block ID'), 'description' => 'FK to Location Block ID', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_LocBlock', - ) , - 'default_role_id' => array( + ], + 'default_role_id' => [ 'name' => 'default_role_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Default Role') , + 'title' => ts('Default Role'), 'description' => 'Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_event.default_role_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'default' => '1', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'participant_role', 'optionEditPath' => 'civicrm/admin/options/participant_role', - ) - ) , - 'intro_text' => array( + ] + ], + 'intro_text' => [ 'name' => 'intro_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Introductory Message') , + 'title' => ts('Introductory Message'), 'description' => 'Introductory message for Event Registration page. Text and html allowed. Displayed at the top of Event Registration form.', 'rows' => 6, 'cols' => 50, @@ -879,14 +927,14 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'footer_text' => array( + ], + ], + 'footer_text' => [ 'name' => 'footer_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Footer Message') , + 'title' => ts('Footer Message'), 'description' => 'Footer message for Event Registration page. Text and html allowed. Displayed at the bottom of Event Registration form.', 'rows' => 6, 'cols' => 50, @@ -894,14 +942,14 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'confirm_title' => array( + ], + ], + 'confirm_title' => [ 'name' => 'confirm_title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Confirmation Title') , + 'title' => ts('Confirmation Title'), 'description' => 'Title for Confirmation page.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -910,14 +958,14 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'confirm_text' => array( + ], + ], + 'confirm_text' => [ 'name' => 'confirm_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Confirm Text') , + 'title' => ts('Confirm Text'), 'description' => 'Introductory message for Event Registration page. Text and html allowed. Displayed at the top of Event Registration form.', 'rows' => 6, 'cols' => 50, @@ -925,14 +973,14 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'confirm_footer_text' => array( + ], + ], + 'confirm_footer_text' => [ 'name' => 'confirm_footer_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Footer Text') , + 'title' => ts('Footer Text'), 'description' => 'Footer message for Event Registration page. Text and html allowed. Displayed at the bottom of Event Registration form.', 'rows' => 6, 'cols' => 50, @@ -940,27 +988,27 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'is_email_confirm' => array( + ], + ], + 'is_email_confirm' => [ 'name' => 'is_email_confirm', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is confirm email') , + 'title' => ts('Is confirm email'), 'description' => 'If true, confirmation is automatically emailed to contact on successful registration.', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'confirm_email_text' => array( + ], + ], + 'confirm_email_text' => [ 'name' => 'confirm_email_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Confirmation Email Text') , + 'title' => ts('Confirmation Email Text'), 'description' => 'text to include above standard event info on confirmation email. emails are text-only, so do not allow html for now', 'rows' => 4, 'cols' => 50, @@ -968,14 +1016,14 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'confirm_from_name' => array( + ], + ], + 'confirm_from_name' => [ 'name' => 'confirm_from_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Confirm From Name') , + 'title' => ts('Confirm From Name'), 'description' => 'FROM email name used for confirmation emails.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -983,14 +1031,14 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'confirm_from_email' => array( + ], + ], + 'confirm_from_email' => [ 'name' => 'confirm_from_email', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Confirm From Email') , + 'title' => ts('Confirm From Email'), 'description' => 'FROM email address used for confirmation emails.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -998,14 +1046,14 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'cc_confirm' => array( + ], + ], + 'cc_confirm' => [ 'name' => 'cc_confirm', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Cc Confirm') , + 'title' => ts('Cc Confirm'), 'description' => 'comma-separated list of email addresses to cc each time a confirmation is sent', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -1013,14 +1061,14 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'bcc_confirm' => array( + ], + ], + 'bcc_confirm' => [ 'name' => 'bcc_confirm', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Bcc Confirm') , + 'title' => ts('Bcc Confirm'), 'description' => 'comma-separated list of email addresses to bcc each time a confirmation is sent', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -1028,34 +1076,34 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'default_fee_id' => array( + ], + ], + 'default_fee_id' => [ 'name' => 'default_fee_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Default Fee ID') , + 'title' => ts('Default Fee ID'), 'description' => 'FK to civicrm_option_value.', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - ) , - 'default_discount_fee_id' => array( + ], + 'default_discount_fee_id' => [ 'name' => 'default_discount_fee_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Default Discount Fee ID') , + 'title' => ts('Default Discount Fee ID'), 'description' => 'FK to civicrm_option_value.', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - ) , - 'thankyou_title' => array( + ], + 'thankyou_title' => [ 'name' => 'thankyou_title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('ThankYou Title') , + 'title' => ts('ThankYou Title'), 'description' => 'Title for ThankYou page.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -1064,14 +1112,14 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'thankyou_text' => array( + ], + ], + 'thankyou_text' => [ 'name' => 'thankyou_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('ThankYou Text') , + 'title' => ts('ThankYou Text'), 'description' => 'ThankYou Text.', 'rows' => 6, 'cols' => 50, @@ -1079,14 +1127,14 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'thankyou_footer_text' => array( + ], + ], + 'thankyou_footer_text' => [ 'name' => 'thankyou_footer_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Footer Text') , + 'title' => ts('Footer Text'), 'description' => 'Footer message.', 'rows' => 6, 'cols' => 50, @@ -1094,66 +1142,66 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'is_pay_later' => array( + ], + ], + 'is_pay_later' => [ 'name' => 'is_pay_later', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Pay Later Allowed') , + 'title' => ts('Pay Later Allowed'), 'description' => 'if true - allows the user to send payment directly to the org later', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'pay_later_text' => array( + ], + ], + 'pay_later_text' => [ 'name' => 'pay_later_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Pay Later Text') , + 'title' => ts('Pay Later Text'), 'description' => 'The text displayed to the user in the main form', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'pay_later_receipt' => array( + ], + ], + 'pay_later_receipt' => [ 'name' => 'pay_later_receipt', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Pay Later Receipt Text') , + 'title' => ts('Pay Later Receipt Text'), 'description' => 'The receipt sent to the user instead of the normal receipt text', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'is_partial_payment' => array( + ], + ], + 'is_partial_payment' => [ 'name' => 'is_partial_payment', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Partial Payments Enabled') , + 'title' => ts('Partial Payments Enabled'), 'description' => 'is partial payment enabled for this event', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'initial_amount_label' => array( + ], + ], + 'initial_amount_label' => [ 'name' => 'initial_amount_label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Initial Amount Label') , + 'title' => ts('Initial Amount Label'), 'description' => 'Initial amount label for partial payment', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -1161,145 +1209,145 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'initial_amount_help_text' => array( + ], + ], + 'initial_amount_help_text' => [ 'name' => 'initial_amount_help_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Initial Amount Help Text') , + 'title' => ts('Initial Amount Help Text'), 'description' => 'Initial amount help text for partial payment', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'min_initial_amount' => array( + ], + ], + 'min_initial_amount' => [ 'name' => 'min_initial_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Minimum Initial Amount') , + 'title' => ts('Minimum Initial Amount'), 'description' => 'Minimum initial amount for partial payment', - 'precision' => array( + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'is_multiple_registrations' => array( + ], + ], + 'is_multiple_registrations' => [ 'name' => 'is_multiple_registrations', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Allow Multiple Registrations') , + 'title' => ts('Allow Multiple Registrations'), 'description' => 'if true - allows the user to register multiple participants for event', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'max_additional_participants' => array( + ], + ], + 'max_additional_participants' => [ 'name' => 'max_additional_participants', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Maximum number of additional participants per registration') , + 'title' => ts('Maximum number of additional participants per registration'), 'description' => 'Maximum number of additional participants that can be registered on a single booking', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - ) , - 'allow_same_participant_emails' => array( + ], + 'allow_same_participant_emails' => [ 'name' => 'allow_same_participant_emails', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Does Event allow multiple registrations from same email address?') , + 'title' => ts('Does Event allow multiple registrations from same email address?'), 'description' => 'if true - allows the user to register multiple registrations from same email address.', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'has_waitlist' => array( + ], + ], + 'has_waitlist' => [ 'name' => 'has_waitlist', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Waitlist Enabled') , + 'title' => ts('Waitlist Enabled'), 'description' => 'Whether the event has waitlist support.', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'requires_approval' => array( + ], + ], + 'requires_approval' => [ 'name' => 'requires_approval', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Requires Approval') , + 'title' => ts('Requires Approval'), 'description' => 'Whether participants require approval before they can finish registering.', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'expiration_time' => array( + ], + ], + 'expiration_time' => [ 'name' => 'expiration_time', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Expiration Time') , + 'title' => ts('Expiration Time'), 'description' => 'Expire pending but unconfirmed registrations after this many hours.', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'allow_selfcancelxfer' => array( + ], + ], + 'allow_selfcancelxfer' => [ 'name' => 'allow_selfcancelxfer', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Allow Self-service Cancellation or Transfer') , + 'title' => ts('Allow Self-service Cancellation or Transfer'), 'description' => 'Allow self service cancellation or transfer for event?', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'selfcancelxfer_time' => array( + ], + ], + 'selfcancelxfer_time' => [ 'name' => 'selfcancelxfer_time', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Self-service Cancellation or Transfer Time') , + 'title' => ts('Self-service Cancellation or Transfer Time'), 'description' => 'Number of hours prior to event start date to allow self-service cancellation or transfer.', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'waitlist_text' => array( + ], + ], + 'waitlist_text' => [ 'name' => 'waitlist_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Waitlist Text') , + 'title' => ts('Waitlist Text'), 'description' => 'Text to display when the event is full, but participants can signup for a waitlist.', 'rows' => 4, 'cols' => 60, @@ -1307,14 +1355,14 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'approval_req_text' => array( + ], + ], + 'approval_req_text' => [ 'name' => 'approval_req_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Approval Req Text') , + 'title' => ts('Approval Req Text'), 'description' => 'Text to display when the approval is required to complete registration for an event.', 'rows' => 4, 'cols' => 60, @@ -1322,170 +1370,170 @@ static function &fields() { 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'is_template' => array( + ], + ], + 'is_template' => [ 'name' => 'is_template', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is an Event Template') , + 'title' => ts('Is an Event Template'), 'description' => 'whether the event has template', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'template_title' => array( + ], + ], + 'template_title' => [ 'name' => 'template_title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Event Template Title') , + 'title' => ts('Event Template Title'), 'description' => 'Event Template Title', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_event.template_title', 'headerPattern' => '/(template.)?title$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'created_id' => array( + ], + ], + 'created_id' => [ 'name' => 'created_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Created By Contact ID') , + 'title' => ts('Created By Contact ID'), 'description' => 'FK to civicrm_contact, who created this event', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'created_date' => array( + ], + 'created_date' => [ 'name' => 'created_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Event Created Date') , + 'title' => ts('Event Created Date'), 'description' => 'Date and time that event was created.', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - ) , - 'currency' => array( + ], + 'currency' => [ 'name' => 'currency', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Currency') , + 'title' => ts('Currency'), 'description' => '3 character string, value from config setting or input via user.', 'maxlength' => 3, 'size' => CRM_Utils_Type::FOUR, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_event.currency', 'headerPattern' => '/cur(rency)?/i', 'dataPattern' => '/^[A-Z]{3}$/i', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_currency', 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ) - ) , - 'campaign_id' => array( + ] + ], + 'campaign_id' => [ 'name' => 'campaign_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Campaign') , + 'title' => ts('Campaign'), 'description' => 'The campaign for which this event has been created.', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, 'FKClassName' => 'CRM_Campaign_DAO_Campaign', - 'html' => array( + 'html' => [ 'type' => 'EntityRef', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'is_share' => array( + ] + ], + 'is_share' => [ 'name' => 'is_share', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is shared through social media') , + 'title' => ts('Is shared through social media'), 'description' => 'Can people share the event through social media?', 'default' => '1', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'is_confirm_enabled' => array( + ], + ], + 'is_confirm_enabled' => [ 'name' => 'is_confirm_enabled', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is the booking confirmation screen enabled?') , + 'title' => ts('Is the booking confirmation screen enabled?'), 'description' => 'If false, the event booking confirmation screen gets skipped', 'default' => '1', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'parent_event_id' => array( + ], + ], + 'parent_event_id' => [ 'name' => 'parent_event_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Parent Event ID') , + 'title' => ts('Parent Event ID'), 'description' => 'Implicit FK to civicrm_event: parent event', 'default' => 'NULL', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'EntityRef', - ) , - ) , - 'slot_label_id' => array( + ], + ], + 'slot_label_id' => [ 'name' => 'slot_label_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Subevent Slot Label ID') , + 'title' => ts('Subevent Slot Label ID'), 'description' => 'Subevent slot label. Implicit FK to civicrm_option_value where option_group = conference_slot.', 'default' => 'NULL', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - ) , - 'dedupe_rule_group_id' => array( + ], + ], + 'dedupe_rule_group_id' => [ 'name' => 'dedupe_rule_group_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Dedupe Rule') , + 'title' => ts('Dedupe Rule'), 'description' => 'Rule to use when matching registrations for this event', 'default' => 'NULL', 'table_name' => 'civicrm_event', @@ -1493,62 +1541,66 @@ static function &fields() { 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, 'FKClassName' => 'CRM_Dedupe_DAO_RuleGroup', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_dedupe_rule_group', 'keyColumn' => 'id', 'labelColumn' => 'title', 'nameColumn' => 'name', - ) - ) , - 'is_billing_required' => array( + ] + ], + 'is_billing_required' => [ 'name' => 'is_billing_required', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is billing block required') , + 'title' => ts('Is billing block required'), 'description' => 'if true than billing block is required this event', 'table_name' => 'civicrm_event', 'entity' => 'Event', 'bao' => 'CRM_Event_BAO_Event', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - ); + ], + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -1556,10 +1608,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'event', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'event', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -1567,40 +1620,46 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'event', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'event', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_event_type_id' => array( + $indices = [ + 'index_event_type_id' => [ 'name' => 'index_event_type_id', - 'field' => array( + 'field' => [ 0 => 'event_type_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_event::0::event_type_id', - ) , - 'index_participant_listing_id' => array( + ], + 'index_participant_listing_id' => [ 'name' => 'index_participant_listing_id', - 'field' => array( + 'field' => [ 0 => 'participant_listing_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_event::0::participant_listing_id', - ) , - 'index_parent_event_id' => array( + ], + 'index_parent_event_id' => [ 'name' => 'index_parent_event_id', - 'field' => array( + 'field' => [ 0 => 'parent_event_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_event::0::parent_event_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Event/DAO/Participant.php b/CRM/Event/DAO/Participant.php index 1bbcdaa8424a..f67959c5b458 100644 --- a/CRM/Event/DAO/Participant.php +++ b/CRM/Event/DAO/Participant.php @@ -1,29 +1,5 @@ __table = 'civicrm_participant'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_id', 'civicrm_event', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'status_id', 'civicrm_participant_status_type', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'registered_by_id', 'civicrm_participant', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'discount_id', 'civicrm_discount', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'cart_id', 'civicrm_event_carts', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'transferred_to_contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_id', 'civicrm_event', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'status_id', 'civicrm_participant_status_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'registered_by_id', 'civicrm_participant', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'discount_id', 'civicrm_discount', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'cart_id', 'civicrm_event_carts', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'transferred_to_contact_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'participant_id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'participant_id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Participant ID') , + 'title' => ts('Participant ID'), 'description' => 'Participant Id', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_participant.id', 'headerPattern' => '/(^(participant(.)?)?id$)/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_participant', 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, - ) , - 'participant_contact_id' => array( + ], + 'participant_contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'FK to Contact ID', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_participant.contact_id', 'headerPattern' => '/contact(.?id)?/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_participant', 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'event_id' => array( + ], + 'event_id' => [ 'name' => 'event_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Event') , + 'title' => ts('Event'), 'description' => 'FK to Event ID', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_participant.event_id', 'headerPattern' => '/event id$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_participant', 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, 'FKClassName' => 'CRM_Event_DAO_Event', - ) , - 'participant_status_id' => array( + ], + 'participant_status_id' => [ 'name' => 'status_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Participant Status') , + 'title' => ts('Participant Status'), 'description' => 'Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_participant.status_id', 'headerPattern' => '/(participant.)?(status)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'default' => '1', 'table_name' => 'civicrm_participant', 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, 'FKClassName' => 'CRM_Event_DAO_ParticipantStatusType', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_participant_status_type', 'keyColumn' => 'id', 'labelColumn' => 'label', - ) - ) , - 'participant_role_id' => array( + ] + ], + 'participant_role_id' => [ 'name' => 'role_id', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Participant Role') , + 'title' => ts('Participant Role'), 'description' => 'Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_participant.role_id', 'headerPattern' => '/(participant.)?(role)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'default' => 'NULL', 'table_name' => 'civicrm_participant', 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'participant_role', 'optionEditPath' => 'civicrm/admin/options/participant_role', - ) - ) , - 'participant_register_date' => array( + ] + ], + 'participant_register_date' => [ 'name' => 'register_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Register date') , + 'title' => ts('Register date'), 'description' => 'When did contact register for event?', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_participant.register_date', 'headerPattern' => '/^(r(egister\s)?date)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_participant', 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'formatType' => 'activityDateTime', - ) , - ) , - 'participant_source' => array( + ], + ], + 'participant_source' => [ 'name' => 'source', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Participant Source') , + 'title' => ts('Participant Source'), 'description' => 'Source of this event registration.', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_participant.source', 'headerPattern' => '/(participant.)?(source)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_participant', 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, - ) , - 'participant_fee_level' => array( + ], + 'participant_fee_level' => [ 'name' => 'fee_level', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Fee level') , + 'title' => ts('Fee level'), 'description' => 'Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that we store the label value and not the key ', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_participant.fee_level', 'headerPattern' => '/^(f(ee\s)?level)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_participant', 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND, - ) , - 'participant_is_test' => array( + ], + 'participant_is_test' => [ 'name' => 'is_test', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Test') , - 'import' => true, + 'title' => ts('Test'), + 'import' => TRUE, 'where' => 'civicrm_participant.is_test', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_participant', 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, - ) , - 'participant_is_pay_later' => array( + ], + 'participant_is_pay_later' => [ 'name' => 'is_pay_later', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Pay Later') , - 'import' => true, + 'title' => ts('Is Pay Later'), + 'import' => TRUE, 'where' => 'civicrm_participant.is_pay_later', 'headerPattern' => '/(is.)?(pay(.)?later)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_participant', 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, - ) , - 'participant_fee_amount' => array( + ], + 'participant_fee_amount' => [ 'name' => 'fee_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Fee Amount') , + 'title' => ts('Fee Amount'), 'description' => 'actual processor fee if known - may be 0.', - 'precision' => array( + 'precision' => [ 20, 2 - ) , - 'import' => true, + ], + 'import' => TRUE, 'where' => 'civicrm_participant.fee_amount', 'headerPattern' => '/fee(.?am(ou)?nt)?/i', 'dataPattern' => '/^\d+(\.\d{2})?$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_participant', 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, - ) , - 'participant_registered_by_id' => array( + ], + 'participant_registered_by_id' => [ 'name' => 'registered_by_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Registered By ID') , + 'title' => ts('Registered By ID'), 'description' => 'FK to Participant ID', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_participant.registered_by_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'default' => 'NULL', 'table_name' => 'civicrm_participant', 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, 'FKClassName' => 'CRM_Event_DAO_Participant', - ) , - 'participant_discount_id' => array( + ], + 'participant_discount_id' => [ 'name' => 'discount_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Discount ID') , + 'title' => ts('Discount ID'), 'description' => 'FK to Discount ID', 'default' => 'NULL', 'table_name' => 'civicrm_participant', @@ -430,136 +427,140 @@ static function &fields() { 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Discount', - ) , - 'participant_fee_currency' => array( + ], + 'participant_fee_currency' => [ 'name' => 'fee_currency', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Fee Currency') , + 'title' => ts('Fee Currency'), 'description' => '3 character string, value derived from config setting.', 'maxlength' => 3, 'size' => CRM_Utils_Type::FOUR, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_participant.fee_currency', 'headerPattern' => '/(fee)?.?cur(rency)?/i', 'dataPattern' => '/^[A-Z]{3}$/i', - 'export' => true, + 'export' => TRUE, 'default' => 'NULL', 'table_name' => 'civicrm_participant', 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_currency', 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ) - ) , - 'participant_campaign_id' => array( + ] + ], + 'participant_campaign_id' => [ 'name' => 'campaign_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Campaign') , + 'title' => ts('Campaign'), 'description' => 'The campaign for which this participant has been registered.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_participant.campaign_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_participant', 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, 'FKClassName' => 'CRM_Campaign_DAO_Campaign', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'discount_amount' => array( + ] + ], + 'discount_amount' => [ 'name' => 'discount_amount', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Discount Amount') , + 'title' => ts('Discount Amount'), 'description' => 'Discount Amount', 'table_name' => 'civicrm_participant', 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, - ) , - 'cart_id' => array( + ], + 'cart_id' => [ 'name' => 'cart_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Event Cart ID') , + 'title' => ts('Event Cart ID'), 'description' => 'FK to civicrm_event_carts', 'table_name' => 'civicrm_participant', 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, 'FKClassName' => 'CRM_Event_Cart_DAO_Cart', - ) , - 'must_wait' => array( + ], + 'must_wait' => [ 'name' => 'must_wait', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Must Wait on List') , + 'title' => ts('Must Wait on List'), 'description' => 'On Waiting List', 'table_name' => 'civicrm_participant', 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, - ) , - 'transferred_to_contact_id' => array( + ], + 'transferred_to_contact_id' => [ 'name' => 'transferred_to_contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Transferred to Contact ID') , + 'title' => ts('Transferred to Contact ID'), 'description' => 'FK to Contact ID', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_participant.transferred_to_contact_id', 'headerPattern' => '/transfer(.?id)?/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'default' => 'NULL', 'table_name' => 'civicrm_participant', 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -567,10 +568,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'participant', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'participant', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -578,32 +580,38 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'participant', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'participant', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_status_id' => array( + $indices = [ + 'index_status_id' => [ 'name' => 'index_status_id', - 'field' => array( + 'field' => [ 0 => 'status_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_participant::0::status_id', - ) , - 'index_role_id' => array( + ], + 'index_role_id' => [ 'name' => 'index_role_id', - 'field' => array( + 'field' => [ 0 => 'role_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_participant::0::role_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Event/DAO/ParticipantPayment.php b/CRM/Event/DAO/ParticipantPayment.php index ca92fc99c0f9..477459d7c175 100644 --- a/CRM/Event/DAO/ParticipantPayment.php +++ b/CRM/Event/DAO/ParticipantPayment.php @@ -1,29 +1,5 @@ __table = 'civicrm_participant_payment'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'participant_id', 'civicrm_participant', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_id', 'civicrm_contribution', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'participant_id', 'civicrm_participant', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_id', 'civicrm_contribution', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Payment ID') , + 'title' => ts('Payment ID'), 'description' => 'Participant Payment Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_participant_payment', 'entity' => 'ParticipantPayment', 'bao' => 'CRM_Event_BAO_ParticipantPayment', 'localizable' => 0, - ) , - 'participant_id' => array( + ], + 'participant_id' => [ 'name' => 'participant_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Participant ID') , + 'title' => ts('Participant ID'), 'description' => 'Participant Id (FK)', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_participant_payment', 'entity' => 'ParticipantPayment', 'bao' => 'CRM_Event_BAO_ParticipantPayment', 'localizable' => 0, 'FKClassName' => 'CRM_Event_DAO_Participant', - ) , - 'contribution_id' => array( + ], + 'contribution_id' => [ 'name' => 'contribution_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contribution') , + 'title' => ts('Contribution'), 'description' => 'FK to contribution table.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_participant_payment', 'entity' => 'ParticipantPayment', 'bao' => 'CRM_Event_BAO_ParticipantPayment', 'localizable' => 0, 'FKClassName' => 'CRM_Contribute_DAO_Contribution', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -173,10 +160,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'participant_payment', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'participant_payment', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -184,26 +172,32 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'participant_payment', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'participant_payment', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_contribution_participant' => array( + $indices = [ + 'UI_contribution_participant' => [ 'name' => 'UI_contribution_participant', - 'field' => array( + 'field' => [ 0 => 'contribution_id', 1 => 'participant_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_participant_payment::1::contribution_id::participant_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Event/DAO/ParticipantStatusType.php b/CRM/Event/DAO/ParticipantStatusType.php index a902d4432f76..a0bff1b197e1 100644 --- a/CRM/Event/DAO/ParticipantStatusType.php +++ b/CRM/Event/DAO/ParticipantStatusType.php @@ -1,29 +1,5 @@ __table = 'civicrm_participant_status_type'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Participant Status Type ID') , + 'title' => ts('Participant Status Type ID'), 'description' => 'unique participant status type id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_participant_status_type', 'entity' => 'ParticipantStatusType', 'bao' => 'CRM_Event_BAO_ParticipantStatusType', 'localizable' => 0, - ) , - 'participant_status' => array( + ], + 'participant_status' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Participant Status') , + 'title' => ts('Participant Status'), 'description' => 'non-localized name of the status type', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_participant_status_type.name', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_participant_status_type', 'entity' => 'ParticipantStatusType', 'bao' => 'CRM_Event_BAO_ParticipantStatusType', 'localizable' => 0, - ) , - 'label' => array( + ], + 'label' => [ 'name' => 'label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Participant Status Label') , + 'title' => ts('Participant Status Label'), 'description' => 'localized label for display of this status type', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -158,11 +146,11 @@ static function &fields() { 'entity' => 'ParticipantStatusType', 'bao' => 'CRM_Event_BAO_ParticipantStatusType', 'localizable' => 1, - ) , - 'class' => array( + ], + 'class' => [ 'name' => 'class', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Participant Status Class') , + 'title' => ts('Participant Status Class'), 'description' => 'the general group of status type this one belongs to', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -170,105 +158,109 @@ static function &fields() { 'entity' => 'ParticipantStatusType', 'bao' => 'CRM_Event_BAO_ParticipantStatusType', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Event_PseudoConstant::participantStatusClassOptions', - ) - ) , - 'is_reserved' => array( + ] + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Participant Status Is Reserved?>') , + 'title' => ts('Participant Status Is Reserved?>'), 'description' => 'whether this is a status type required by the system', 'table_name' => 'civicrm_participant_status_type', 'entity' => 'ParticipantStatusType', 'bao' => 'CRM_Event_BAO_ParticipantStatusType', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Participant Status is Active') , + 'title' => ts('Participant Status is Active'), 'description' => 'whether this status type is active', 'default' => '1', 'table_name' => 'civicrm_participant_status_type', 'entity' => 'ParticipantStatusType', 'bao' => 'CRM_Event_BAO_ParticipantStatusType', 'localizable' => 0, - ) , - 'is_counted' => array( + ], + 'is_counted' => [ 'name' => 'is_counted', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Participant Status Counts?') , + 'title' => ts('Participant Status Counts?'), 'description' => 'whether this status type is counted against event size limit', 'table_name' => 'civicrm_participant_status_type', 'entity' => 'ParticipantStatusType', 'bao' => 'CRM_Event_BAO_ParticipantStatusType', 'localizable' => 0, - ) , - 'weight' => array( + ], + 'weight' => [ 'name' => 'weight', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Order') , + 'title' => ts('Order'), 'description' => 'controls sort order', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_participant_status_type', 'entity' => 'ParticipantStatusType', 'bao' => 'CRM_Event_BAO_ParticipantStatusType', 'localizable' => 0, - ) , - 'visibility_id' => array( + ], + 'visibility_id' => [ 'name' => 'visibility_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Participant Status Visibility') , + 'title' => ts('Participant Status Visibility'), 'description' => 'whether the status type is visible to the public, an implicit foreign key to option_value.value related to the `visibility` option_group', 'table_name' => 'civicrm_participant_status_type', 'entity' => 'ParticipantStatusType', 'bao' => 'CRM_Event_BAO_ParticipantStatusType', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'visibility', 'optionEditPath' => 'civicrm/admin/options/visibility', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -276,10 +268,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'participant_status_type', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'participant_status_type', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -287,15 +280,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'participant_status_type', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'participant_status_type', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Financial/DAO/Currency.php b/CRM/Financial/DAO/Currency.php index 52cf12bedcf7..a119e4988260 100644 --- a/CRM/Financial/DAO/Currency.php +++ b/CRM/Financial/DAO/Currency.php @@ -1,29 +1,5 @@ __table = 'civicrm_currency'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Currency ID') , + 'title' => ts('Currency ID'), 'description' => 'Currency Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_currency', 'entity' => 'Currency', 'bao' => 'CRM_Financial_DAO_Currency', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Currency') , + 'title' => ts('Currency'), 'description' => 'Currency Name', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_currency.name', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_currency', 'entity' => 'Currency', 'bao' => 'CRM_Financial_DAO_Currency', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'symbol' => array( + ], + ], + 'symbol' => [ 'name' => 'symbol', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Currency Symbol') , + 'title' => ts('Currency Symbol'), 'description' => 'Currency Symbol', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -137,31 +121,31 @@ static function &fields() { 'entity' => 'Currency', 'bao' => 'CRM_Financial_DAO_Currency', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'numeric_code' => array( + ], + ], + 'numeric_code' => [ 'name' => 'numeric_code', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Currency Numeric Code') , + 'title' => ts('Currency Numeric Code'), 'description' => 'Numeric currency code', 'maxlength' => 3, 'size' => CRM_Utils_Type::FOUR, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_currency.numeric_code', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_currency', 'entity' => 'Currency', 'bao' => 'CRM_Financial_DAO_Currency', 'localizable' => 0, - ) , - 'full_name' => array( + ], + 'full_name' => [ 'name' => 'full_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Full Currency Name') , + 'title' => ts('Full Currency Name'), 'description' => 'Full currency name', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -169,43 +153,47 @@ static function &fields() { 'entity' => 'Currency', 'bao' => 'CRM_Financial_DAO_Currency', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - ); + ], + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -213,10 +201,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'currency', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'currency', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -224,15 +213,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'currency', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'currency', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Financial/DAO/EntityFinancialAccount.php b/CRM/Financial/DAO/EntityFinancialAccount.php index 338a68afd38e..6264a9238861 100644 --- a/CRM/Financial/DAO/EntityFinancialAccount.php +++ b/CRM/Financial/DAO/EntityFinancialAccount.php @@ -1,29 +1,5 @@ __table = 'civicrm_entity_financial_account'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_account_id', 'civicrm_financial_account', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_account_id', 'civicrm_financial_account', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity Financial Account ID') , + 'title' => ts('Entity Financial Account ID'), 'description' => 'ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_entity_financial_account', 'entity' => 'EntityFinancialAccount', 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Table') , + 'title' => ts('Entity Table'), 'description' => 'Links to an entity_table like civicrm_financial_type', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_entity_financial_account.entity_table', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_entity_financial_account', 'entity' => 'EntityFinancialAccount', 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity ID') , + 'title' => ts('Entity ID'), 'description' => 'Links to an id in the entity_table, such as vid in civicrm_financial_type', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_entity_financial_account', 'entity' => 'EntityFinancialAccount', 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount', 'localizable' => 0, - ) , - 'account_relationship' => array( + ], + 'account_relationship' => [ 'name' => 'account_relationship', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Account Relationship') , + 'title' => ts('Account Relationship'), 'description' => 'FK to a new civicrm_option_value (account_relationship)', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_entity_financial_account', 'entity' => 'EntityFinancialAccount', 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'account_relationship', 'optionEditPath' => 'civicrm/admin/options/account_relationship', - ) - ) , - 'financial_account_id' => array( + ] + ], + 'financial_account_id' => [ 'name' => 'financial_account_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Account') , + 'title' => ts('Financial Account'), 'description' => 'FK to the financial_account_id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_entity_financial_account', 'entity' => 'EntityFinancialAccount', 'bao' => 'CRM_Financial_DAO_EntityFinancialAccount', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_financial_account', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -228,10 +217,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_financial_account', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_financial_account', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -239,27 +229,33 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_financial_account', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_financial_account', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_entity_id_entity_table_account_relationship' => array( + $indices = [ + 'index_entity_id_entity_table_account_relationship' => [ 'name' => 'index_entity_id_entity_table_account_relationship', - 'field' => array( + 'field' => [ 0 => 'entity_id', 1 => 'entity_table', 2 => 'account_relationship', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_entity_financial_account::1::entity_id::entity_table::account_relationship', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Financial/DAO/EntityFinancialTrxn.php b/CRM/Financial/DAO/EntityFinancialTrxn.php index dc94113815e8..5bf7545ab578 100644 --- a/CRM/Financial/DAO/EntityFinancialTrxn.php +++ b/CRM/Financial/DAO/EntityFinancialTrxn.php @@ -1,29 +1,5 @@ __table = 'civicrm_entity_financial_trxn'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_trxn_id', 'civicrm_financial_trxn', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_trxn_id', 'civicrm_financial_trxn', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity Financial Transaction ID') , + 'title' => ts('Entity Financial Transaction ID'), 'description' => 'ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_entity_financial_trxn', 'entity' => 'EntityFinancialTrxn', 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Table') , + 'title' => ts('Entity Table'), 'description' => 'May contain civicrm_financial_item, civicrm_contribution, civicrm_financial_trxn, civicrm_grant, etc', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_entity_financial_trxn.entity_table', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_entity_financial_trxn', 'entity' => 'EntityFinancialTrxn', 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity ID') , - 'required' => true, + 'title' => ts('Entity ID'), + 'required' => TRUE, 'table_name' => 'civicrm_entity_financial_trxn', 'entity' => 'EntityFinancialTrxn', 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', 'localizable' => 0, - ) , - 'financial_trxn_id' => array( + ], + 'financial_trxn_id' => [ 'name' => 'financial_trxn_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Transaction Id') , + 'title' => ts('Financial Transaction Id'), 'table_name' => 'civicrm_entity_financial_trxn', 'entity' => 'EntityFinancialTrxn', 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_FinancialTrxn', - ) , - 'amount' => array( + ], + 'amount' => [ 'name' => 'amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Amount') , + 'title' => ts('Amount'), 'description' => 'allocated amount of transaction to this entity', - 'required' => true, - 'precision' => array( + 'required' => TRUE, + 'precision' => [ 20, 2 - ) , - 'import' => true, + ], + 'import' => TRUE, 'where' => 'civicrm_entity_financial_trxn.amount', 'headerPattern' => '/amount/i', 'dataPattern' => '/^\d+(\.\d{2})?$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_entity_financial_trxn', 'entity' => 'EntityFinancialTrxn', 'bao' => 'CRM_Financial_DAO_EntityFinancialTrxn', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -217,10 +204,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_financial_trxn', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_financial_trxn', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -228,32 +216,38 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_financial_trxn', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_financial_trxn', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_entity_financial_trxn_entity_table' => array( + $indices = [ + 'UI_entity_financial_trxn_entity_table' => [ 'name' => 'UI_entity_financial_trxn_entity_table', - 'field' => array( + 'field' => [ 0 => 'entity_table', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_entity_financial_trxn::0::entity_table', - ) , - 'UI_entity_financial_trxn_entity_id' => array( + ], + 'UI_entity_financial_trxn_entity_id' => [ 'name' => 'UI_entity_financial_trxn_entity_id', - 'field' => array( + 'field' => [ 0 => 'entity_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_entity_financial_trxn::0::entity_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Financial/DAO/FinancialAccount.php b/CRM/Financial/DAO/FinancialAccount.php index ec43d41a2f01..cb3ec660748a 100644 --- a/CRM/Financial/DAO/FinancialAccount.php +++ b/CRM/Financial/DAO/FinancialAccount.php @@ -1,29 +1,5 @@ __table = 'civicrm_financial_account'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_financial_account', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_financial_account', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Account ID') , + 'title' => ts('Financial Account ID'), 'description' => 'ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_financial_account', 'entity' => 'FinancialAccount', 'bao' => 'CRM_Financial_BAO_FinancialAccount', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Financial Account Name') , + 'title' => ts('Financial Account Name'), 'description' => 'Financial Account Name.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_financial_account', 'entity' => 'FinancialAccount', 'bao' => 'CRM_Financial_BAO_FinancialAccount', 'localizable' => 0, - ) , - 'financial_account_contact_id' => array( + ], + 'financial_account_contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'FK to Contact ID that is responsible for the funds in this account', 'table_name' => 'civicrm_financial_account', 'entity' => 'FinancialAccount', 'bao' => 'CRM_Financial_BAO_FinancialAccount', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'financial_account_type_id' => array( + ], + 'financial_account_type_id' => [ 'name' => 'financial_account_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Account Type') , + 'title' => ts('Financial Account Type'), 'description' => 'pseudo FK into civicrm_option_value.', - 'required' => true, + 'required' => TRUE, 'default' => '3', 'table_name' => 'civicrm_financial_account', 'entity' => 'FinancialAccount', 'bao' => 'CRM_Financial_BAO_FinancialAccount', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'financial_account_type', 'optionEditPath' => 'civicrm/admin/options/financial_account_type', - ) - ) , - 'accounting_code' => array( + ] + ], + 'accounting_code' => [ 'name' => 'accounting_code', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Accounting Code') , + 'title' => ts('Accounting Code'), 'description' => 'Optional value for mapping monies owed and received to accounting system codes.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_financial_account.accounting_code', 'headerPattern' => '', 'dataPattern' => '', @@ -239,15 +234,15 @@ static function &fields() { 'entity' => 'FinancialAccount', 'bao' => 'CRM_Financial_BAO_FinancialAccount', 'localizable' => 0, - ) , - 'account_type_code' => array( + ], + 'account_type_code' => [ 'name' => 'account_type_code', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Account Type Code') , + 'title' => ts('Account Type Code'), 'description' => 'Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_financial_account.account_type_code', 'headerPattern' => '', 'dataPattern' => '', @@ -255,11 +250,11 @@ static function &fields() { 'entity' => 'FinancialAccount', 'bao' => 'CRM_Financial_BAO_FinancialAccount', 'localizable' => 0, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Financial Account Description') , + 'title' => ts('Financial Account Description'), 'description' => 'Financial Type Description.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -267,126 +262,130 @@ static function &fields() { 'entity' => 'FinancialAccount', 'bao' => 'CRM_Financial_BAO_FinancialAccount', 'localizable' => 0, - ) , - 'parent_id' => array( + ], + 'parent_id' => [ 'name' => 'parent_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Account Parent') , + 'title' => ts('Financial Account Parent'), 'description' => 'Parent ID in account hierarchy', 'table_name' => 'civicrm_financial_account', 'entity' => 'FinancialAccount', 'bao' => 'CRM_Financial_BAO_FinancialAccount', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount', - ) , - 'is_header_account' => array( + ], + 'is_header_account' => [ 'name' => 'is_header_account', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Header Financial Account?') , + 'title' => ts('Header Financial Account?'), 'description' => 'Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?', 'table_name' => 'civicrm_financial_account', 'entity' => 'FinancialAccount', 'bao' => 'CRM_Financial_BAO_FinancialAccount', 'localizable' => 0, - ) , - 'is_deductible' => array( + ], + 'is_deductible' => [ 'name' => 'is_deductible', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Deductible Financial Account?') , + 'title' => ts('Deductible Financial Account?'), 'description' => 'Is this account tax-deductible?', 'default' => '1', 'table_name' => 'civicrm_financial_account', 'entity' => 'FinancialAccount', 'bao' => 'CRM_Financial_BAO_FinancialAccount', 'localizable' => 0, - ) , - 'is_tax' => array( + ], + 'is_tax' => [ 'name' => 'is_tax', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Tax Financial Account?') , + 'title' => ts('Tax Financial Account?'), 'description' => 'Is this account for taxes?', 'table_name' => 'civicrm_financial_account', 'entity' => 'FinancialAccount', 'bao' => 'CRM_Financial_BAO_FinancialAccount', 'localizable' => 0, - ) , - 'tax_rate' => array( + ], + 'tax_rate' => [ 'name' => 'tax_rate', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Financial Account Tax Rate') , + 'title' => ts('Financial Account Tax Rate'), 'description' => 'The percentage of the total_amount that is due for this tax.', - 'precision' => array( + 'precision' => [ 10, 8 - ) , + ], 'table_name' => 'civicrm_financial_account', 'entity' => 'FinancialAccount', 'bao' => 'CRM_Financial_BAO_FinancialAccount', 'localizable' => 0, - ) , - 'is_reserved' => array( + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Reserved Financial Account?') , + 'title' => ts('Reserved Financial Account?'), 'description' => 'Is this a predefined system object?', 'table_name' => 'civicrm_financial_account', 'entity' => 'FinancialAccount', 'bao' => 'CRM_Financial_BAO_FinancialAccount', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Financial Account is Active') , + 'title' => ts('Financial Account is Active'), 'description' => 'Is this property active?', 'table_name' => 'civicrm_financial_account', 'entity' => 'FinancialAccount', 'bao' => 'CRM_Financial_BAO_FinancialAccount', 'localizable' => 0, - ) , - 'is_default' => array( + ], + 'is_default' => [ 'name' => 'is_default', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Default Financial Account') , + 'title' => ts('Default Financial Account'), 'description' => 'Is this account the default one (or default tax one) for its financial_account_type?', 'table_name' => 'civicrm_financial_account', 'entity' => 'FinancialAccount', 'bao' => 'CRM_Financial_BAO_FinancialAccount', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -394,10 +393,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'financial_account', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'financial_account', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -405,25 +405,31 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'financial_account', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'financial_account', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_name' => array( + $indices = [ + 'UI_name' => [ 'name' => 'UI_name', - 'field' => array( + 'field' => [ 0 => 'name', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_financial_account::1::name', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Financial/DAO/FinancialItem.php b/CRM/Financial/DAO/FinancialItem.php index 82d71822af91..154ff57456c9 100644 --- a/CRM/Financial/DAO/FinancialItem.php +++ b/CRM/Financial/DAO/FinancialItem.php @@ -1,29 +1,5 @@ __table = 'civicrm_financial_item'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_account_id', 'civicrm_financial_account', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_account_id', 'civicrm_financial_account', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Item ID') , - 'required' => true, + 'title' => ts('Financial Item ID'), + 'required' => TRUE, 'table_name' => 'civicrm_financial_item', 'entity' => 'FinancialItem', 'bao' => 'CRM_Financial_BAO_FinancialItem', 'localizable' => 0, - ) , - 'created_date' => array( + ], + 'created_date' => [ 'name' => 'created_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Financial Item Created Date') , + 'title' => ts('Financial Item Created Date'), 'description' => 'Date and time the item was created', - 'required' => true, + 'required' => TRUE, 'default' => 'CURRENT_TIMESTAMP', 'table_name' => 'civicrm_financial_item', 'entity' => 'FinancialItem', 'bao' => 'CRM_Financial_BAO_FinancialItem', 'localizable' => 0, - ) , - 'transaction_date' => array( + ], + 'transaction_date' => [ 'name' => 'transaction_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Financial Item Transaction Date') , + 'title' => ts('Financial Item Transaction Date'), 'description' => 'Date and time of the source transaction', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_financial_item', 'entity' => 'FinancialItem', 'bao' => 'CRM_Financial_BAO_FinancialItem', 'localizable' => 0, - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Item Contact ID') , + 'title' => ts('Financial Item Contact ID'), 'description' => 'FK to Contact ID of contact the item is from', - 'required' => true, - 'export' => true, + 'required' => TRUE, + 'export' => TRUE, 'where' => 'civicrm_financial_item.contact_id', 'headerPattern' => '', 'dataPattern' => '', @@ -194,11 +184,11 @@ static function &fields() { 'bao' => 'CRM_Financial_BAO_FinancialItem', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Financial Item Description') , + 'title' => ts('Financial Item Description'), 'description' => 'Human readable description of this item, to ease display without lookup of source item.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -206,30 +196,30 @@ static function &fields() { 'entity' => 'FinancialItem', 'bao' => 'CRM_Financial_BAO_FinancialItem', 'localizable' => 0, - ) , - 'amount' => array( + ], + 'amount' => [ 'name' => 'amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Amount') , + 'title' => ts('Amount'), 'description' => 'Total amount of this item', - 'required' => true, - 'precision' => array( + 'required' => TRUE, + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_financial_item', 'entity' => 'FinancialItem', 'bao' => 'CRM_Financial_BAO_FinancialItem', 'localizable' => 0, - ) , - 'currency' => array( + ], + 'currency' => [ 'name' => 'currency', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Financial Item Currency') , + 'title' => ts('Financial Item Currency'), 'description' => 'Currency for the amount', 'maxlength' => 3, 'size' => CRM_Utils_Type::FOUR, - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_financial_item.currency', 'headerPattern' => '', 'dataPattern' => '', @@ -237,41 +227,41 @@ static function &fields() { 'entity' => 'FinancialItem', 'bao' => 'CRM_Financial_BAO_FinancialItem', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_currency', 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ) - ) , - 'financial_account_id' => array( + ] + ], + 'financial_account_id' => [ 'name' => 'financial_account_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Account ID') , + 'title' => ts('Financial Account ID'), 'description' => 'FK to civicrm_financial_account', 'table_name' => 'civicrm_financial_item', 'entity' => 'FinancialItem', 'bao' => 'CRM_Financial_BAO_FinancialItem', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_financial_account', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'status_id' => array( + ] + ], + 'status_id' => [ 'name' => 'status_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Item Status ID') , + 'title' => ts('Financial Item Status ID'), 'description' => 'Payment status: test, paid, part_paid, unpaid (if empty assume unpaid)', - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_financial_item.status_id', 'headerPattern' => '', 'dataPattern' => '', @@ -279,18 +269,18 @@ static function &fields() { 'entity' => 'FinancialItem', 'bao' => 'CRM_Financial_BAO_FinancialItem', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'financial_item_status', 'optionEditPath' => 'civicrm/admin/options/financial_item_status', - ) - ) , - 'entity_table' => array( + ] + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Table') , + 'title' => ts('Entity Table'), 'description' => 'The table providing the source of this item such as civicrm_line_item', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -298,50 +288,54 @@ static function &fields() { 'entity' => 'FinancialItem', 'bao' => 'CRM_Financial_BAO_FinancialItem', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity ID') , + 'title' => ts('Entity ID'), 'description' => 'The specific source item that is responsible for the creation of this financial_item', 'table_name' => 'civicrm_financial_item', 'entity' => 'FinancialItem', 'bao' => 'CRM_Financial_BAO_FinancialItem', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -349,10 +343,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'financial_item', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'financial_item', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -360,41 +355,47 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'financial_item', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'financial_item', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'IX_created_date' => array( + $indices = [ + 'IX_created_date' => [ 'name' => 'IX_created_date', - 'field' => array( + 'field' => [ 0 => 'created_date', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_financial_item::0::created_date', - ) , - 'IX_transaction_date' => array( + ], + 'IX_transaction_date' => [ 'name' => 'IX_transaction_date', - 'field' => array( + 'field' => [ 0 => 'transaction_date', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_financial_item::0::transaction_date', - ) , - 'index_entity_id_entity_table' => array( + ], + 'index_entity_id_entity_table' => [ 'name' => 'index_entity_id_entity_table', - 'field' => array( + 'field' => [ 0 => 'entity_id', 1 => 'entity_table', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_financial_item::0::entity_id::entity_table', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Financial/DAO/FinancialTrxn.php b/CRM/Financial/DAO/FinancialTrxn.php index 4aac190592b5..78e557943d4d 100644 --- a/CRM/Financial/DAO/FinancialTrxn.php +++ b/CRM/Financial/DAO/FinancialTrxn.php @@ -1,29 +1,5 @@ __table = 'civicrm_financial_trxn'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'from_financial_account_id', 'civicrm_financial_account', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'to_financial_account_id', 'civicrm_financial_account', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'payment_processor_id', 'civicrm_payment_processor', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'from_financial_account_id', 'civicrm_financial_account', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'to_financial_account_id', 'civicrm_financial_account', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'payment_processor_id', 'civicrm_payment_processor', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Transaction ID') , - 'required' => true, + 'title' => ts('Financial Transaction ID'), + 'required' => TRUE, 'table_name' => 'civicrm_financial_trxn', 'entity' => 'FinancialTrxn', 'bao' => 'CRM_Financial_DAO_FinancialTrxn', 'localizable' => 0, - ) , - 'from_financial_account_id' => array( + ], + 'from_financial_account_id' => [ 'name' => 'from_financial_account_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Transaction From Account') , + 'title' => ts('Financial Transaction From Account'), 'description' => 'FK to financial_account table.', 'table_name' => 'civicrm_financial_trxn', 'entity' => 'FinancialTrxn', 'bao' => 'CRM_Financial_DAO_FinancialTrxn', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_financial_account', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'to_financial_account_id' => array( + ] + ], + 'to_financial_account_id' => [ 'name' => 'to_financial_account_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Transaction To Account') , + 'title' => ts('Financial Transaction To Account'), 'description' => 'FK to financial_financial_account table.', 'table_name' => 'civicrm_financial_trxn', 'entity' => 'FinancialTrxn', 'bao' => 'CRM_Financial_DAO_FinancialTrxn', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_financial_account', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'trxn_date' => array( + ] + ], + 'trxn_date' => [ 'name' => 'trxn_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Financial Transaction Date') , + 'title' => ts('Financial Transaction Date'), 'description' => 'date transaction occurred', 'default' => 'NULL', 'table_name' => 'civicrm_financial_trxn', 'entity' => 'FinancialTrxn', 'bao' => 'CRM_Financial_DAO_FinancialTrxn', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'formatType' => 'activityDateTime', - ) , - ) , - 'total_amount' => array( + ], + ], + 'total_amount' => [ 'name' => 'total_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Financial Total Amount') , + 'title' => ts('Financial Total Amount'), 'description' => 'amount of transaction', - 'required' => true, - 'precision' => array( + 'required' => TRUE, + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_financial_trxn', 'entity' => 'FinancialTrxn', 'bao' => 'CRM_Financial_DAO_FinancialTrxn', 'localizable' => 0, - ) , - 'fee_amount' => array( + ], + 'fee_amount' => [ 'name' => 'fee_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Financial Fee Amount') , + 'title' => ts('Financial Fee Amount'), 'description' => 'actual processor fee if known - may be 0.', - 'precision' => array( + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_financial_trxn', 'entity' => 'FinancialTrxn', 'bao' => 'CRM_Financial_DAO_FinancialTrxn', 'localizable' => 0, - ) , - 'net_amount' => array( + ], + 'net_amount' => [ 'name' => 'net_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Financial Net Amount') , + 'title' => ts('Financial Net Amount'), 'description' => 'actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.', - 'precision' => array( + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_financial_trxn', 'entity' => 'FinancialTrxn', 'bao' => 'CRM_Financial_DAO_FinancialTrxn', 'localizable' => 0, - ) , - 'currency' => array( + ], + 'currency' => [ 'name' => 'currency', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Financial Currency') , + 'title' => ts('Financial Currency'), 'description' => '3 character string, value from config setting or input via user.', 'maxlength' => 3, 'size' => CRM_Utils_Type::FOUR, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_financial_trxn.currency', 'headerPattern' => '/cur(rency)?/i', 'dataPattern' => '/^[A-Z]{3}$/', - 'export' => true, + 'export' => TRUE, 'default' => 'NULL', 'table_name' => 'civicrm_financial_trxn', 'entity' => 'FinancialTrxn', 'bao' => 'CRM_Financial_DAO_FinancialTrxn', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_currency', 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ) - ) , - 'is_payment' => array( + ] + ], + 'is_payment' => [ 'name' => 'is_payment', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Payment?') , + 'title' => ts('Is Payment?'), 'description' => 'Is this entry either a payment or a reversal of a payment?', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_financial_trxn.is_payment', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_financial_trxn', 'entity' => 'FinancialTrxn', 'bao' => 'CRM_Financial_DAO_FinancialTrxn', 'localizable' => 0, - ) , - 'trxn_id' => array( + ], + 'trxn_id' => [ 'name' => 'trxn_id', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Transaction ID') , + 'title' => ts('Transaction ID'), 'description' => 'Transaction id supplied by external processor. This may not be unique.', 'maxlength' => 255, 'size' => 10, @@ -341,14 +337,14 @@ static function &fields() { 'entity' => 'FinancialTrxn', 'bao' => 'CRM_Financial_DAO_FinancialTrxn', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'trxn_result_code' => array( + ], + ], + 'trxn_result_code' => [ 'name' => 'trxn_result_code', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Transaction Result Code') , + 'title' => ts('Transaction Result Code'), 'description' => 'processor result code', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -356,75 +352,75 @@ static function &fields() { 'entity' => 'FinancialTrxn', 'bao' => 'CRM_Financial_DAO_FinancialTrxn', 'localizable' => 0, - ) , - 'status_id' => array( + ], + 'status_id' => [ 'name' => 'status_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Transaction Status Id') , + 'title' => ts('Financial Transaction Status Id'), 'description' => 'pseudo FK to civicrm_option_value of contribution_status_id option_group', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_financial_trxn.status_id', 'headerPattern' => '/status/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_financial_trxn', 'entity' => 'FinancialTrxn', 'bao' => 'CRM_Financial_DAO_FinancialTrxn', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'contribution_status', 'optionEditPath' => 'civicrm/admin/options/contribution_status', - ) - ) , - 'payment_processor_id' => array( + ] + ], + 'payment_processor_id' => [ 'name' => 'payment_processor_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Payment Processor') , + 'title' => ts('Payment Processor'), 'description' => 'Payment Processor for this financial transaction', 'table_name' => 'civicrm_financial_trxn', 'entity' => 'FinancialTrxn', 'bao' => 'CRM_Financial_DAO_FinancialTrxn', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor', - ) , - 'financial_trxn_payment_instrument_id' => array( + ], + 'financial_trxn_payment_instrument_id' => [ 'name' => 'payment_instrument_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Payment Method') , + 'title' => ts('Payment Method'), 'description' => 'FK to payment_instrument option group values', 'table_name' => 'civicrm_financial_trxn', 'entity' => 'FinancialTrxn', 'bao' => 'CRM_Financial_DAO_FinancialTrxn', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'payment_instrument', 'optionEditPath' => 'civicrm/admin/options/payment_instrument', - ) - ) , - 'financial_trxn_card_type_id' => array( + ] + ], + 'financial_trxn_card_type_id' => [ 'name' => 'card_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Card Type ID') , + 'title' => ts('Card Type ID'), 'description' => 'FK to accept_creditcard option group values', 'table_name' => 'civicrm_financial_trxn', 'entity' => 'FinancialTrxn', 'bao' => 'CRM_Financial_DAO_FinancialTrxn', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'accept_creditcard', 'optionEditPath' => 'civicrm/admin/options/accept_creditcard', - ) - ) , - 'financial_trxn_check_number' => array( + ] + ], + 'financial_trxn_check_number' => [ 'name' => 'check_number', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Check Number') , + 'title' => ts('Check Number'), 'description' => 'Check number', 'maxlength' => 255, 'size' => 6, @@ -432,14 +428,14 @@ static function &fields() { 'entity' => 'FinancialTrxn', 'bao' => 'CRM_Financial_DAO_FinancialTrxn', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'financial_trxn_pan_truncation' => array( + ], + ], + 'financial_trxn_pan_truncation' => [ 'name' => 'pan_truncation', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Pan Truncation') , + 'title' => ts('Pan Truncation'), 'description' => 'Last 4 digits of credit card', 'maxlength' => 4, 'size' => 4, @@ -447,43 +443,47 @@ static function &fields() { 'entity' => 'FinancialTrxn', 'bao' => 'CRM_Financial_DAO_FinancialTrxn', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - ); + ], + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -491,10 +491,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'financial_trxn', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'financial_trxn', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -502,40 +503,46 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'financial_trxn', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'financial_trxn', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_ftrxn_trxn_id' => array( + $indices = [ + 'UI_ftrxn_trxn_id' => [ 'name' => 'UI_ftrxn_trxn_id', - 'field' => array( + 'field' => [ 0 => 'trxn_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_financial_trxn::0::trxn_id', - ) , - 'UI_ftrxn_payment_instrument_id' => array( + ], + 'UI_ftrxn_payment_instrument_id' => [ 'name' => 'UI_ftrxn_payment_instrument_id', - 'field' => array( + 'field' => [ 0 => 'payment_instrument_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_financial_trxn::0::payment_instrument_id', - ) , - 'UI_ftrxn_check_number' => array( + ], + 'UI_ftrxn_check_number' => [ 'name' => 'UI_ftrxn_check_number', - 'field' => array( + 'field' => [ 0 => 'check_number', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_financial_trxn::0::check_number', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Financial/DAO/FinancialType.php b/CRM/Financial/DAO/FinancialType.php index 3be6e3a6cfc9..fc8d2924e24f 100644 --- a/CRM/Financial/DAO/FinancialType.php +++ b/CRM/Financial/DAO/FinancialType.php @@ -1,29 +1,5 @@ __table = 'civicrm_financial_type'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Type ID') , + 'title' => ts('Financial Type ID'), 'description' => 'ID of original financial_type so you can search this table by the financial_type.id and then select the relevant version based on the timestamp', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_financial_type', 'entity' => 'FinancialType', 'bao' => 'CRM_Financial_BAO_FinancialType', 'localizable' => 0, - ) , - 'financial_type' => array( + ], + 'financial_type' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Financial Type') , + 'title' => ts('Financial Type'), 'description' => 'Financial Type Name.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_financial_type.name', 'headerPattern' => '/(finan(cial)?)?type/i', 'dataPattern' => '/donation|member|campaign/i', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_financial_type', 'entity' => 'FinancialType', 'bao' => 'CRM_Financial_BAO_FinancialType', 'localizable' => 0, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Description') , + 'title' => ts('Description'), 'description' => 'Financial Type Description.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -141,71 +126,75 @@ static function &fields() { 'entity' => 'FinancialType', 'bao' => 'CRM_Financial_BAO_FinancialType', 'localizable' => 0, - ) , - 'is_deductible' => array( + ], + 'is_deductible' => [ 'name' => 'is_deductible', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Tax Deductible?') , + 'title' => ts('Is Tax Deductible?'), 'description' => 'Is this financial type tax-deductible? If true, contributions of this type may be fully OR partially deductible - non-deductible amount is stored in the Contribution record.', 'default' => '1', 'table_name' => 'civicrm_financial_type', 'entity' => 'FinancialType', 'bao' => 'CRM_Financial_BAO_FinancialType', 'localizable' => 0, - ) , - 'is_reserved' => array( + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Financial Type is Reserved?') , + 'title' => ts('Financial Type is Reserved?'), 'description' => 'Is this a predefined system object?', 'table_name' => 'civicrm_financial_type', 'entity' => 'FinancialType', 'bao' => 'CRM_Financial_BAO_FinancialType', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Financial Type Is Active?') , + 'title' => ts('Financial Type Is Active?'), 'description' => 'Is this property active?', 'table_name' => 'civicrm_financial_type', 'entity' => 'FinancialType', 'bao' => 'CRM_Financial_BAO_FinancialType', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -213,10 +202,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'financial_type', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'financial_type', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -224,25 +214,31 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'financial_type', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'financial_type', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_id' => array( + $indices = [ + 'UI_id' => [ 'name' => 'UI_id', - 'field' => array( + 'field' => [ 0 => 'id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_financial_type::1::id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Financial/DAO/PaymentProcessor.php b/CRM/Financial/DAO/PaymentProcessor.php index f5546564409c..a0568b18c882 100644 --- a/CRM/Financial/DAO/PaymentProcessor.php +++ b/CRM/Financial/DAO/PaymentProcessor.php @@ -1,29 +1,5 @@ __table = 'civicrm_payment_processor'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'payment_processor_type_id', 'civicrm_payment_processor_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'payment_processor_type_id', 'civicrm_payment_processor_type', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Payment Processor ID') , + 'title' => ts('Payment Processor ID'), 'description' => 'Payment Processor ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - ) , - 'domain_id' => array( + ], + 'domain_id' => [ 'name' => 'domain_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Payment Processor Domain') , + 'title' => ts('Payment Processor Domain'), 'description' => 'Which Domain is this match entry for', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Domain', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'name' => array( + ] + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Payment Processor') , + 'title' => ts('Payment Processor'), 'description' => 'Payment Processor Name.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -241,14 +233,14 @@ static function &fields() { 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'description' => array( + ], + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Processor Description') , + 'title' => ts('Processor Description'), 'description' => 'Payment Processor Description.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -256,226 +248,226 @@ static function &fields() { 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - ) , - 'payment_processor_type_id' => array( + ], + 'payment_processor_type_id' => [ 'name' => 'payment_processor_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Payment Processor Type ID') , + 'title' => ts('Payment Processor Type ID'), 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessorType', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_payment_processor_type', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'is_active' => array( + ] + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Processor is Active?') , + 'title' => ts('Processor is Active?'), 'description' => 'Is this processor active?', 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - ) , - 'is_default' => array( + ], + 'is_default' => [ 'name' => 'is_default', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Processor Is Default?') , + 'title' => ts('Processor Is Default?'), 'description' => 'Is this processor the default?', 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - ) , - 'is_test' => array( + ], + 'is_test' => [ 'name' => 'is_test', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Test Processor?') , + 'title' => ts('Is Test Processor?'), 'description' => 'Is this processor for a test site?', 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - ) , - 'user_name' => array( + ], + 'user_name' => [ 'name' => 'user_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('User Name') , + 'title' => ts('User Name'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'password' => array( + ], + ], + 'password' => [ 'name' => 'password', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Password') , + 'title' => ts('Password'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Password', - ) , - ) , - 'signature' => array( + ], + ], + 'signature' => [ 'name' => 'signature', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Signature') , + 'title' => ts('Signature'), 'rows' => 4, 'cols' => 40, 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'url_site' => array( + ], + ], + 'url_site' => [ 'name' => 'url_site', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Site URL') , + 'title' => ts('Site URL'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'url_api' => array( + ], + ], + 'url_api' => [ 'name' => 'url_api', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('API URL') , + 'title' => ts('API URL'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'url_recur' => array( + ], + ], + 'url_recur' => [ 'name' => 'url_recur', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Recurring Payments URL') , + 'title' => ts('Recurring Payments URL'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'url_button' => array( + ], + ], + 'url_button' => [ 'name' => 'url_button', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Button URL') , + 'title' => ts('Button URL'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'subject' => array( + ], + ], + 'subject' => [ 'name' => 'subject', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Subject') , + 'title' => ts('Subject'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'class_name' => array( + ], + ], + 'class_name' => [ 'name' => 'class_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Suffix for PHP class name implementation') , + 'title' => ts('Suffix for PHP class name implementation'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - ) , - 'billing_mode' => array( + ], + 'billing_mode' => [ 'name' => 'billing_mode', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Processor Billing Mode') , + 'title' => ts('Processor Billing Mode'), 'description' => 'Billing Mode (deprecated)', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - ) , - 'is_recur' => array( + ], + 'is_recur' => [ 'name' => 'is_recur', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Processor Supports Recurring?') , + 'title' => ts('Processor Supports Recurring?'), 'description' => 'Can process recurring contributions', 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - ) , - 'payment_type' => array( + ], + 'payment_type' => [ 'name' => 'payment_type', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Payment Type') , + 'title' => ts('Payment Type'), 'description' => 'Payment Type: Credit or Debit (deprecated)', 'default' => '1', 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - ) , - 'payment_instrument_id' => array( + ], + 'payment_instrument_id' => [ 'name' => 'payment_instrument_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Payment Method') , + 'title' => ts('Payment Method'), 'description' => 'Payment Instrument ID', 'default' => '1', 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'payment_instrument', 'optionEditPath' => 'civicrm/admin/options/payment_instrument', - ) - ) , - 'accepted_credit_cards' => array( + ] + ], + 'accepted_credit_cards' => [ 'name' => 'accepted_credit_cards', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Accepted Credit Cards') , + 'title' => ts('Accepted Credit Cards'), 'description' => 'array of accepted credit card types', 'default' => 'NULL', 'table_name' => 'civicrm_payment_processor', @@ -483,40 +475,44 @@ static function &fields() { 'bao' => 'CRM_Financial_BAO_PaymentProcessor', 'localizable' => 0, 'serialize' => self::SERIALIZE_JSON, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -524,10 +520,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'payment_processor', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'payment_processor', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -535,27 +532,33 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'payment_processor', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'payment_processor', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_name_test_domain_id' => array( + $indices = [ + 'UI_name_test_domain_id' => [ 'name' => 'UI_name_test_domain_id', - 'field' => array( + 'field' => [ 0 => 'name', 1 => 'is_test', 2 => 'domain_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_payment_processor::1::name::is_test::domain_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Financial/DAO/PaymentProcessorType.php b/CRM/Financial/DAO/PaymentProcessorType.php index f98f34e9d41d..316051d01e66 100644 --- a/CRM/Financial/DAO/PaymentProcessorType.php +++ b/CRM/Financial/DAO/PaymentProcessorType.php @@ -1,29 +1,5 @@ __table = 'civicrm_payment_processor_type'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Payment Processor Type ID') , + 'title' => ts('Payment Processor Type ID'), 'description' => 'Payment Processor Type ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Payment Processor variable name to be used in code') , + 'title' => ts('Payment Processor variable name to be used in code'), 'description' => 'Payment Processor Name.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -212,11 +201,11 @@ static function &fields() { 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'title' => array( + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Payment Processor Title') , + 'title' => ts('Payment Processor Title'), 'description' => 'Payment Processor Name.', 'maxlength' => 127, 'size' => CRM_Utils_Type::HUGE, @@ -224,11 +213,11 @@ static function &fields() { 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Processor Type Description') , + 'title' => ts('Processor Type Description'), 'description' => 'Payment Processor Description.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -236,256 +225,260 @@ static function &fields() { 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Processor Type Is Active?') , + 'title' => ts('Processor Type Is Active?'), 'description' => 'Is this processor active?', 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'is_default' => array( + ], + 'is_default' => [ 'name' => 'is_default', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Processor Type is Default?') , + 'title' => ts('Processor Type is Default?'), 'description' => 'Is this processor the default?', 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'user_name_label' => array( + ], + 'user_name_label' => [ 'name' => 'user_name_label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Label for User Name if used') , + 'title' => ts('Label for User Name if used'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'password_label' => array( + ], + 'password_label' => [ 'name' => 'password_label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Label for password') , + 'title' => ts('Label for password'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'signature_label' => array( + ], + 'signature_label' => [ 'name' => 'signature_label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Label for Signature') , + 'title' => ts('Label for Signature'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'subject_label' => array( + ], + 'subject_label' => [ 'name' => 'subject_label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Label for Subject') , + 'title' => ts('Label for Subject'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'class_name' => array( + ], + 'class_name' => [ 'name' => 'class_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Suffix for PHP class name implementation') , + 'title' => ts('Suffix for PHP class name implementation'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'url_site_default' => array( + ], + 'url_site_default' => [ 'name' => 'url_site_default', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Default Live Site URL') , + 'title' => ts('Default Live Site URL'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'url_api_default' => array( + ], + 'url_api_default' => [ 'name' => 'url_api_default', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Default API Site URL') , + 'title' => ts('Default API Site URL'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'url_recur_default' => array( + ], + 'url_recur_default' => [ 'name' => 'url_recur_default', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Default Live Recurring Payments URL') , + 'title' => ts('Default Live Recurring Payments URL'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'url_button_default' => array( + ], + 'url_button_default' => [ 'name' => 'url_button_default', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Default Live Button URL') , + 'title' => ts('Default Live Button URL'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'url_site_test_default' => array( + ], + 'url_site_test_default' => [ 'name' => 'url_site_test_default', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Default Test Site URL') , + 'title' => ts('Default Test Site URL'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'url_api_test_default' => array( + ], + 'url_api_test_default' => [ 'name' => 'url_api_test_default', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Default Test API URL') , + 'title' => ts('Default Test API URL'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'url_recur_test_default' => array( + ], + 'url_recur_test_default' => [ 'name' => 'url_recur_test_default', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Default Test Recurring Payment URL') , + 'title' => ts('Default Test Recurring Payment URL'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'url_button_test_default' => array( + ], + 'url_button_test_default' => [ 'name' => 'url_button_test_default', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Default Test Button URL') , + 'title' => ts('Default Test Button URL'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'billing_mode' => array( + ], + 'billing_mode' => [ 'name' => 'billing_mode', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Billing Mode') , + 'title' => ts('Billing Mode'), 'description' => 'Billing Mode (deprecated)', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::billingMode', - ) - ) , - 'is_recur' => array( + ] + ], + 'is_recur' => [ 'name' => 'is_recur', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Processor Type Supports Recurring?') , + 'title' => ts('Processor Type Supports Recurring?'), 'description' => 'Can process recurring contributions', 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'payment_type' => array( + ], + 'payment_type' => [ 'name' => 'payment_type', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Processor Type Payment Type') , + 'title' => ts('Processor Type Payment Type'), 'description' => 'Payment Type: Credit or Debit (deprecated)', 'default' => '1', 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - ) , - 'payment_instrument_id' => array( + ], + 'payment_instrument_id' => [ 'name' => 'payment_instrument_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Payment Method') , + 'title' => ts('Payment Method'), 'description' => 'Payment Instrument ID', 'default' => '1', 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'payment_instrument', 'optionEditPath' => 'civicrm/admin/options/payment_instrument', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -493,10 +486,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'payment_processor_type', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'payment_processor_type', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -504,25 +498,31 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'payment_processor_type', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'payment_processor_type', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_name' => array( + $indices = [ + 'UI_name' => [ 'name' => 'UI_name', - 'field' => array( + 'field' => [ 0 => 'name', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_payment_processor_type::1::name', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Financial/DAO/PaymentToken.php b/CRM/Financial/DAO/PaymentToken.php index d5fe14b10fcd..c8fb590e070c 100644 --- a/CRM/Financial/DAO/PaymentToken.php +++ b/CRM/Financial/DAO/PaymentToken.php @@ -1,29 +1,5 @@ __table = 'civicrm_payment_token'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'payment_processor_id', 'civicrm_payment_processor', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'payment_processor_id', 'civicrm_payment_processor', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'payment_token_id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'payment_token_id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Payment Token ID') , + 'title' => ts('Payment Token ID'), 'description' => 'Payment Token ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_payment_token', 'entity' => 'PaymentToken', 'bao' => 'CRM_Financial_DAO_PaymentToken', 'localizable' => 0, - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'FK to Contact ID for the owner of the token', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_payment_token', 'entity' => 'PaymentToken', 'bao' => 'CRM_Financial_DAO_PaymentToken', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'payment_processor_id' => array( + ], + 'payment_processor_id' => [ 'name' => 'payment_processor_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Payment Processor ID') , - 'required' => true, + 'title' => ts('Payment Processor ID'), + 'required' => TRUE, 'table_name' => 'civicrm_payment_token', 'entity' => 'PaymentToken', 'bao' => 'CRM_Financial_DAO_PaymentToken', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor', - ) , - 'token' => array( + ], + 'token' => [ 'name' => 'token', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Token') , + 'title' => ts('Token'), 'description' => 'Externally provided token string', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_payment_token', 'entity' => 'PaymentToken', 'bao' => 'CRM_Financial_DAO_PaymentToken', 'localizable' => 0, - ) , - 'created_date' => array( + ], + 'created_date' => [ 'name' => 'created_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Created Date') , + 'title' => ts('Created Date'), 'description' => 'Date created', 'default' => 'CURRENT_TIMESTAMP', 'table_name' => 'civicrm_payment_token', 'entity' => 'PaymentToken', 'bao' => 'CRM_Financial_DAO_PaymentToken', 'localizable' => 0, - ) , - 'created_id' => array( + ], + 'created_id' => [ 'name' => 'created_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Created ID') , + 'title' => ts('Created ID'), 'description' => 'Contact ID of token creator', 'table_name' => 'civicrm_payment_token', 'entity' => 'PaymentToken', 'bao' => 'CRM_Financial_DAO_PaymentToken', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'expiry_date' => array( + ], + 'expiry_date' => [ 'name' => 'expiry_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Expiry Date') , + 'title' => ts('Expiry Date'), 'description' => 'Date this token expires', 'table_name' => 'civicrm_payment_token', 'entity' => 'PaymentToken', 'bao' => 'CRM_Financial_DAO_PaymentToken', 'localizable' => 0, - ) , - 'email' => array( + ], + 'email' => [ 'name' => 'email', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Email') , + 'title' => ts('Email'), 'description' => 'Email at the time of token creation. Useful for fraud forensics', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -248,11 +240,11 @@ static function &fields() { 'entity' => 'PaymentToken', 'bao' => 'CRM_Financial_DAO_PaymentToken', 'localizable' => 0, - ) , - 'billing_first_name' => array( + ], + 'billing_first_name' => [ 'name' => 'billing_first_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Billing First Name') , + 'title' => ts('Billing First Name'), 'description' => 'Billing first name at the time of token creation. Useful for fraud forensics', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -260,11 +252,11 @@ static function &fields() { 'entity' => 'PaymentToken', 'bao' => 'CRM_Financial_DAO_PaymentToken', 'localizable' => 0, - ) , - 'billing_middle_name' => array( + ], + 'billing_middle_name' => [ 'name' => 'billing_middle_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Billing Middle Name') , + 'title' => ts('Billing Middle Name'), 'description' => 'Billing middle name at the time of token creation. Useful for fraud forensics', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -272,11 +264,11 @@ static function &fields() { 'entity' => 'PaymentToken', 'bao' => 'CRM_Financial_DAO_PaymentToken', 'localizable' => 0, - ) , - 'billing_last_name' => array( + ], + 'billing_last_name' => [ 'name' => 'billing_last_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Billing Last Name') , + 'title' => ts('Billing Last Name'), 'description' => 'Billing last name at the time of token creation. Useful for fraud forensics', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -284,11 +276,11 @@ static function &fields() { 'entity' => 'PaymentToken', 'bao' => 'CRM_Financial_DAO_PaymentToken', 'localizable' => 0, - ) , - 'masked_account_number' => array( + ], + 'masked_account_number' => [ 'name' => 'masked_account_number', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Masked Account Number') , + 'title' => ts('Masked Account Number'), 'description' => 'Holds the part of the card number or account details that may be retained or displayed', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -296,11 +288,11 @@ static function &fields() { 'entity' => 'PaymentToken', 'bao' => 'CRM_Financial_DAO_PaymentToken', 'localizable' => 0, - ) , - 'ip_address' => array( + ], + 'ip_address' => [ 'name' => 'ip_address', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('IP Address') , + 'title' => ts('IP Address'), 'description' => 'IP used when creating the token. Useful for fraud forensics', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -308,40 +300,44 @@ static function &fields() { 'entity' => 'PaymentToken', 'bao' => 'CRM_Financial_DAO_PaymentToken', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -349,10 +345,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'payment_token', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'payment_token', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -360,15 +357,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'payment_token', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'payment_token', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Friend/DAO/Friend.php b/CRM/Friend/DAO/Friend.php index 186a78673fec..c98623ee74a8 100644 --- a/CRM/Friend/DAO/Friend.php +++ b/CRM/Friend/DAO/Friend.php @@ -1,29 +1,5 @@ __table = 'civicrm_tell_friend'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Friend ID') , + 'title' => ts('Friend ID'), 'description' => 'Friend ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_tell_friend', 'entity' => 'Friend', 'bao' => 'CRM_Friend_BAO_Friend', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Table') , + 'title' => ts('Entity Table'), 'description' => 'Name of table where item being referenced is stored.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_tell_friend', 'entity' => 'Friend', 'bao' => 'CRM_Friend_BAO_Friend', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity ID') , + 'title' => ts('Entity ID'), 'description' => 'Foreign key to the referenced item.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_tell_friend', 'entity' => 'Friend', 'bao' => 'CRM_Friend_BAO_Friend', 'localizable' => 0, - ) , - 'title' => array( + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Title') , + 'title' => ts('Title'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_tell_friend', 'entity' => 'Friend', 'bao' => 'CRM_Friend_BAO_Friend', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'intro' => array( + ], + ], + 'intro' => [ 'name' => 'intro', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Intro') , + 'title' => ts('Intro'), 'description' => 'Introductory message to contributor or participant displayed on the Tell a Friend form.', 'table_name' => 'civicrm_tell_friend', 'entity' => 'Friend', 'bao' => 'CRM_Friend_BAO_Friend', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'suggested_message' => array( + ], + ], + 'suggested_message' => [ 'name' => 'suggested_message', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Suggested Message') , + 'title' => ts('Suggested Message'), 'description' => 'Suggested message to friends, provided as default on the Tell A Friend form.', 'table_name' => 'civicrm_tell_friend', 'entity' => 'Friend', 'bao' => 'CRM_Friend_BAO_Friend', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'general_link' => array( + ], + ], + 'general_link' => [ 'name' => 'general_link', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('General Link') , + 'title' => ts('General Link'), 'description' => 'URL for general info about the organization - included in the email sent to friends.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_tell_friend.general_link', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_tell_friend', 'entity' => 'Friend', 'bao' => 'CRM_Friend_BAO_Friend', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'thankyou_title' => array( + ], + ], + 'thankyou_title' => [ 'name' => 'thankyou_title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Thank You Title') , + 'title' => ts('Thank You Title'), 'description' => 'Text for Tell a Friend thank you page header and HTML title.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -243,68 +231,72 @@ static function &fields() { 'entity' => 'Friend', 'bao' => 'CRM_Friend_BAO_Friend', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'thankyou_text' => array( + ], + ], + 'thankyou_text' => [ 'name' => 'thankyou_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Thank You Text') , + 'title' => ts('Thank You Text'), 'description' => 'Thank you message displayed on success page.', 'table_name' => 'civicrm_tell_friend', 'entity' => 'Friend', 'bao' => 'CRM_Friend_BAO_Friend', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'is_active' => array( + ], + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Enabled?') , + 'title' => ts('Enabled?'), 'table_name' => 'civicrm_tell_friend', 'entity' => 'Friend', 'bao' => 'CRM_Friend_BAO_Friend', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - ); + ], + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -312,10 +304,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'tell_friend', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'tell_friend', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -323,15 +316,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'tell_friend', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'tell_friend', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Grant/DAO/Grant.php b/CRM/Grant/DAO/Grant.php index f5a4372a529e..979a767c3add 100644 --- a/CRM/Grant/DAO/Grant.php +++ b/CRM/Grant/DAO/Grant.php @@ -1,29 +1,5 @@ __table = 'civicrm_grant'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'grant_id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'grant_id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Grant ID') , + 'title' => ts('Grant ID'), 'description' => 'Unique Grant id', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_grant.id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_grant', 'entity' => 'Grant', 'bao' => 'CRM_Grant_BAO_Grant', 'localizable' => 0, - ) , - 'grant_contact_id' => array( + ], + 'grant_contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'Contact ID of contact record given grant belongs to.', - 'required' => true, - 'export' => true, + 'required' => TRUE, + 'export' => TRUE, 'where' => 'civicrm_grant.contact_id', 'headerPattern' => '', 'dataPattern' => '', @@ -201,16 +196,16 @@ static function &fields() { 'bao' => 'CRM_Grant_BAO_Grant', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'EntityRef', - ) , - ) , - 'application_received_date' => array( + ], + ], + 'application_received_date' => [ 'name' => 'application_received_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Application received date') , + 'title' => ts('Application received date'), 'description' => 'Date on which grant application was received by donor.', - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_grant.application_received_date', 'headerPattern' => '', 'dataPattern' => '', @@ -218,81 +213,81 @@ static function &fields() { 'entity' => 'Grant', 'bao' => 'CRM_Grant_BAO_Grant', 'localizable' => 0, - ) , - 'decision_date' => array( + ], + 'decision_date' => [ 'name' => 'decision_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Decision date') , + 'title' => ts('Decision date'), 'description' => 'Date on which grant decision was made.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_grant.decision_date', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_grant', 'entity' => 'Grant', 'bao' => 'CRM_Grant_BAO_Grant', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'grant_money_transfer_date' => array( + ], + ], + 'grant_money_transfer_date' => [ 'name' => 'money_transfer_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Grant Money transfer date') , + 'title' => ts('Grant Money transfer date'), 'description' => 'Date on which grant money transfer was made.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_grant.money_transfer_date', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_grant', 'entity' => 'Grant', 'bao' => 'CRM_Grant_BAO_Grant', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'grant_due_date' => array( + ], + ], + 'grant_due_date' => [ 'name' => 'grant_due_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Grant Due Date') , + 'title' => ts('Grant Due Date'), 'description' => 'Date on which grant report is due.', 'table_name' => 'civicrm_grant', 'entity' => 'Grant', 'bao' => 'CRM_Grant_BAO_Grant', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'grant_report_received' => array( + ], + ], + 'grant_report_received' => [ 'name' => 'grant_report_received', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Grant report received') , + 'title' => ts('Grant report received'), 'description' => 'Yes/No field stating whether grant report was received by donor.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_grant.grant_report_received', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_grant', 'entity' => 'Grant', 'bao' => 'CRM_Grant_BAO_Grant', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'grant_type_id' => array( + ], + ], + 'grant_type_id' => [ 'name' => 'grant_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Grant Type') , + 'title' => ts('Grant Type'), 'description' => 'Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.', - 'required' => true, - 'export' => true, + 'required' => TRUE, + 'export' => TRUE, 'where' => 'civicrm_grant.grant_type_id', 'headerPattern' => '', 'dataPattern' => '', @@ -300,145 +295,145 @@ static function &fields() { 'entity' => 'Grant', 'bao' => 'CRM_Grant_BAO_Grant', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'grant_type', 'optionEditPath' => 'civicrm/admin/options/grant_type', - ) - ) , - 'amount_total' => array( + ] + ], + 'amount_total' => [ 'name' => 'amount_total', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Total Amount') , + 'title' => ts('Total Amount'), 'description' => 'Requested grant amount, in default currency.', - 'required' => true, - 'precision' => array( + 'required' => TRUE, + 'precision' => [ 20, 2 - ) , - 'import' => true, + ], + 'import' => TRUE, 'where' => 'civicrm_grant.amount_total', 'headerPattern' => '', 'dataPattern' => '/^\d+(\.\d{2})?$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_grant', 'entity' => 'Grant', 'bao' => 'CRM_Grant_BAO_Grant', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'amount_requested' => array( + ], + ], + 'amount_requested' => [ 'name' => 'amount_requested', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Amount Requested') , + 'title' => ts('Amount Requested'), 'description' => 'Requested grant amount, in original currency (optional).', - 'precision' => array( + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_grant', 'entity' => 'Grant', 'bao' => 'CRM_Grant_BAO_Grant', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'amount_granted' => array( + ], + ], + 'amount_granted' => [ 'name' => 'amount_granted', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Amount granted') , + 'title' => ts('Amount granted'), 'description' => 'Granted amount, in default currency.', - 'precision' => array( + 'precision' => [ 20, 2 - ) , - 'import' => true, + ], + 'import' => TRUE, 'where' => 'civicrm_grant.amount_granted', 'headerPattern' => '', 'dataPattern' => '/^\d+(\.\d{2})?$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_grant', 'entity' => 'Grant', 'bao' => 'CRM_Grant_BAO_Grant', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'currency' => array( + ], + ], + 'currency' => [ 'name' => 'currency', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Grant Currency') , + 'title' => ts('Grant Currency'), 'description' => '3 character string, value from config setting or input via user.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 3, 'size' => CRM_Utils_Type::FOUR, 'table_name' => 'civicrm_grant', 'entity' => 'Grant', 'bao' => 'CRM_Grant_BAO_Grant', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_currency', 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ) - ) , - 'rationale' => array( + ] + ], + 'rationale' => [ 'name' => 'rationale', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Grant Rationale') , + 'title' => ts('Grant Rationale'), 'description' => 'Grant rationale.', 'rows' => 4, 'cols' => 60, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_grant.rationale', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_grant', 'entity' => 'Grant', 'bao' => 'CRM_Grant_BAO_Grant', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'grant_status_id' => array( + ], + ], + 'grant_status_id' => [ 'name' => 'status_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Grant Status') , + 'title' => ts('Grant Status'), 'description' => 'Id of Grant status.', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_grant.status_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => false, + 'export' => FALSE, 'table_name' => 'civicrm_grant', 'entity' => 'Grant', 'bao' => 'CRM_Grant_BAO_Grant', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'grant_status', 'optionEditPath' => 'civicrm/admin/options/grant_status', - ) - ) , - 'financial_type_id' => array( + ] + ], + 'financial_type_id' => [ 'name' => 'financial_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Type') , + 'title' => ts('Financial Type'), 'description' => 'FK to Financial Type.', 'default' => 'NULL', 'table_name' => 'civicrm_grant', @@ -446,45 +441,49 @@ static function &fields() { 'bao' => 'CRM_Grant_BAO_Grant', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_FinancialType', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -492,10 +491,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'grant', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'grant', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -503,32 +503,38 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'grant', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'grant', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_grant_type_id' => array( + $indices = [ + 'index_grant_type_id' => [ 'name' => 'index_grant_type_id', - 'field' => array( + 'field' => [ 0 => 'grant_type_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_grant::0::grant_type_id', - ) , - 'index_status_id' => array( + ], + 'index_status_id' => [ 'name' => 'index_status_id', - 'field' => array( + 'field' => [ 0 => 'status_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_grant::0::status_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/DAO/BouncePattern.php b/CRM/Mailing/DAO/BouncePattern.php index 4901666ccabc..597200636e34 100644 --- a/CRM/Mailing/DAO/BouncePattern.php +++ b/CRM/Mailing/DAO/BouncePattern.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_bounce_pattern'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'bounce_type_id', 'civicrm_mailing_bounce_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'bounce_type_id', 'civicrm_mailing_bounce_type', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Bounce Pattern ID') , - 'required' => true, + 'title' => ts('Bounce Pattern ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_bounce_pattern', 'entity' => 'BouncePattern', 'bao' => 'CRM_Mailing_BAO_BouncePattern', 'localizable' => 0, - ) , - 'bounce_type_id' => array( + ], + 'bounce_type_id' => [ 'name' => 'bounce_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Bounce Type') , + 'title' => ts('Bounce Type'), 'description' => 'Type of bounce', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_bounce_pattern', 'entity' => 'BouncePattern', 'bao' => 'CRM_Mailing_BAO_BouncePattern', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_DAO_BounceType', - ) , - 'pattern' => array( + ], + 'pattern' => [ 'name' => 'pattern', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Pattern') , + 'title' => ts('Pattern'), 'description' => 'A regexp to match a message to a bounce type', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -129,40 +111,44 @@ static function &fields() { 'entity' => 'BouncePattern', 'bao' => 'CRM_Mailing_BAO_BouncePattern', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -170,10 +156,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_bounce_pattern', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_bounce_pattern', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -181,15 +168,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_bounce_pattern', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_bounce_pattern', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/DAO/BounceType.php b/CRM/Mailing/DAO/BounceType.php index 0c358e49d226..458121ddb5e8 100644 --- a/CRM/Mailing/DAO/BounceType.php +++ b/CRM/Mailing/DAO/BounceType.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_bounce_type'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Bounce Type ID') , - 'required' => true, + 'title' => ts('Bounce Type ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_bounce_type', 'entity' => 'BounceType', 'bao' => 'CRM_Mailing_DAO_BounceType', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Bounce Type Name') , + 'title' => ts('Bounce Type Name'), 'description' => 'Type of bounce', - 'required' => true, + 'required' => TRUE, 'maxlength' => 24, 'size' => CRM_Utils_Type::MEDIUM, 'table_name' => 'civicrm_mailing_bounce_type', 'entity' => 'BounceType', 'bao' => 'CRM_Mailing_DAO_BounceType', 'localizable' => 0, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Bounce Type Description') , + 'title' => ts('Bounce Type Description'), 'description' => 'A description of this bounce type', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -122,51 +104,55 @@ static function &fields() { 'entity' => 'BounceType', 'bao' => 'CRM_Mailing_DAO_BounceType', 'localizable' => 0, - ) , - 'hold_threshold' => array( + ], + 'hold_threshold' => [ 'name' => 'hold_threshold', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Hold Threshold') , + 'title' => ts('Hold Threshold'), 'description' => 'Number of bounces of this type required before the email address is put on bounce hold', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_bounce_type', 'entity' => 'BounceType', 'bao' => 'CRM_Mailing_DAO_BounceType', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -174,10 +160,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_bounce_type', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_bounce_type', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -185,15 +172,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_bounce_type', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_bounce_type', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/DAO/Component.php b/CRM/Mailing/DAO/Component.php index 589a09268b18..636a754aea3e 100644 --- a/CRM/Mailing/DAO/Component.php +++ b/CRM/Mailing/DAO/Component.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_component'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Component ID') , - 'required' => true, + 'title' => ts('Mailing Component ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_component', 'entity' => 'Component', 'bao' => 'CRM_Mailing_BAO_Component', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Component Name') , + 'title' => ts('Component Name'), 'description' => 'The name of this component', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -132,11 +117,11 @@ static function &fields() { 'entity' => 'Component', 'bao' => 'CRM_Mailing_BAO_Component', 'localizable' => 0, - ) , - 'component_type' => array( + ], + 'component_type' => [ 'name' => 'component_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mailing Component Type') , + 'title' => ts('Mailing Component Type'), 'description' => 'Type of Component.', 'maxlength' => 12, 'size' => CRM_Utils_Type::TWELVE, @@ -144,28 +129,28 @@ static function &fields() { 'entity' => 'Component', 'bao' => 'CRM_Mailing_BAO_Component', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::mailingComponents', - ) - ) , - 'subject' => array( + ] + ], + 'subject' => [ 'name' => 'subject', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Subject') , + 'title' => ts('Subject'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_mailing_component', 'entity' => 'Component', 'bao' => 'CRM_Mailing_BAO_Component', 'localizable' => 0, - ) , - 'body_html' => array( + ], + 'body_html' => [ 'name' => 'body_html', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Mailing Component Body HTML') , + 'title' => ts('Mailing Component Body HTML'), 'description' => 'Body of the component in html format.', 'rows' => 8, 'cols' => 80, @@ -173,14 +158,14 @@ static function &fields() { 'entity' => 'Component', 'bao' => 'CRM_Mailing_BAO_Component', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'body_text' => array( + ], + ], + 'body_text' => [ 'name' => 'body_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Body Text') , + 'title' => ts('Body Text'), 'description' => 'Body of the component in text format.', 'rows' => 8, 'cols' => 80, @@ -188,63 +173,67 @@ static function &fields() { 'entity' => 'Component', 'bao' => 'CRM_Mailing_BAO_Component', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'is_default' => array( + ], + ], + 'is_default' => [ 'name' => 'is_default', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Mailing Component is Default?') , + 'title' => ts('Mailing Component is Default?'), 'description' => 'Is this the default component for this component_type?', 'table_name' => 'civicrm_mailing_component', 'entity' => 'Component', 'bao' => 'CRM_Mailing_BAO_Component', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Mailing Component Is Active?') , + 'title' => ts('Mailing Component Is Active?'), 'description' => 'Is this property active?', 'table_name' => 'civicrm_mailing_component', 'entity' => 'Component', 'bao' => 'CRM_Mailing_BAO_Component', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -252,10 +241,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_component', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_component', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -263,15 +253,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_component', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_component', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/DAO/Mailing.php b/CRM/Mailing/DAO/Mailing.php index 5a7f5d57b0dc..9f1f31356e9a 100644 --- a/CRM/Mailing/DAO/Mailing.php +++ b/CRM/Mailing/DAO/Mailing.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'header_id', 'civicrm_mailing_component', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'footer_id', 'civicrm_mailing_component', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'reply_id', 'civicrm_mailing_component', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'unsubscribe_id', 'civicrm_mailing_component', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'optout_id', 'civicrm_mailing_component', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'msg_template_id', 'civicrm_msg_template', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'scheduled_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'approver_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'sms_provider_id', 'civicrm_sms_provider', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'location_type_id', 'civicrm_location_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'header_id', 'civicrm_mailing_component', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'footer_id', 'civicrm_mailing_component', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'reply_id', 'civicrm_mailing_component', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'unsubscribe_id', 'civicrm_mailing_component', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'optout_id', 'civicrm_mailing_component', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'msg_template_id', 'civicrm_msg_template', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'scheduled_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'approver_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'sms_provider_id', 'civicrm_sms_provider', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'location_type_id', 'civicrm_location_type', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing ID') , - 'required' => true, + 'title' => ts('Mailing ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - ) , - 'domain_id' => array( + ], + 'domain_id' => [ 'name' => 'domain_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Domain') , + 'title' => ts('Mailing Domain'), 'description' => 'Which site is this mailing for', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Domain', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'header_id' => array( + ] + ], + 'header_id' => [ 'name' => 'header_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Header') , + 'title' => ts('Mailing Header'), 'description' => 'FK to the header component.', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_DAO_Component', - ) , - 'footer_id' => array( + ], + 'footer_id' => [ 'name' => 'footer_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Footer') , + 'title' => ts('Mailing Footer'), 'description' => 'FK to the footer component.', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_DAO_Component', - ) , - 'reply_id' => array( + ], + 'reply_id' => [ 'name' => 'reply_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Reply') , + 'title' => ts('Mailing Reply'), 'description' => 'FK to the auto-responder component.', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_DAO_Component', - ) , - 'unsubscribe_id' => array( + ], + 'unsubscribe_id' => [ 'name' => 'unsubscribe_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Unsubscribe') , + 'title' => ts('Mailing Unsubscribe'), 'description' => 'FK to the unsubscribe component.', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_DAO_Component', - ) , - 'resubscribe_id' => array( + ], + 'resubscribe_id' => [ 'name' => 'resubscribe_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Resubscribe') , + 'title' => ts('Mailing Resubscribe'), 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - ) , - 'optout_id' => array( + ], + 'optout_id' => [ 'name' => 'optout_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Opt Out') , + 'title' => ts('Mailing Opt Out'), 'description' => 'FK to the opt-out component.', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_DAO_Component', - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mailing Name') , + 'title' => ts('Mailing Name'), 'description' => 'Mailing Name.', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -447,14 +467,14 @@ static function &fields() { 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'mailing_type' => array( + ], + ], + 'mailing_type' => [ 'name' => 'mailing_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mailing Type') , + 'title' => ts('Mailing Type'), 'description' => 'differentiate between standalone mailings, A/B tests, and A/B final-winner', 'maxlength' => 32, 'size' => CRM_Utils_Type::MEDIUM, @@ -462,17 +482,17 @@ static function &fields() { 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Mailing_PseudoConstant::mailingTypes', - ) - ) , - 'from_name' => array( + ] + ], + 'from_name' => [ 'name' => 'from_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mailing From Name') , + 'title' => ts('Mailing From Name'), 'description' => 'From Header of mailing', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -480,14 +500,14 @@ static function &fields() { 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'from_email' => array( + ], + ], + 'from_email' => [ 'name' => 'from_email', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mailing From Email') , + 'title' => ts('Mailing From Email'), 'description' => 'From Email of mailing', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -495,14 +515,14 @@ static function &fields() { 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'replyto_email' => array( + ], + ], + 'replyto_email' => [ 'name' => 'replyto_email', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Replyto Email') , + 'title' => ts('Replyto Email'), 'description' => 'Reply-To Email of mailing', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -510,16 +530,16 @@ static function &fields() { 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'template_type' => array( + ], + ], + 'template_type' => [ 'name' => 'template_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Template Type') , + 'title' => ts('Template Type'), 'description' => 'The language/processing system used for email templates.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'default' => 'traditional', @@ -527,24 +547,24 @@ static function &fields() { 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Mailing_BAO_Mailing::getTemplateTypeNames', - ) - ) , - 'template_options' => array( + ] + ], + 'template_options' => [ 'name' => 'template_options', 'type' => CRM_Utils_Type::T_LONGTEXT, - 'title' => ts('Template Options (JSON)') , + 'title' => ts('Template Options (JSON)'), 'description' => 'Advanced options used by the email templating system. (JSON encoded)', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - ) , - 'subject' => array( + ], + 'subject' => [ 'name' => 'subject', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Subject') , + 'title' => ts('Subject'), 'description' => 'Subject of mailing', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -552,150 +572,150 @@ static function &fields() { 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'body_text' => array( + ], + ], + 'body_text' => [ 'name' => 'body_text', 'type' => CRM_Utils_Type::T_LONGTEXT, - 'title' => ts('Body Text') , + 'title' => ts('Body Text'), 'description' => 'Body of the mailing in text format.', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - ) , - 'body_html' => array( + ], + 'body_html' => [ 'name' => 'body_html', 'type' => CRM_Utils_Type::T_LONGTEXT, - 'title' => ts('Body Html') , + 'title' => ts('Body Html'), 'description' => 'Body of the mailing in html format.', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - ) , - 'url_tracking' => array( + ], + 'url_tracking' => [ 'name' => 'url_tracking', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Url Tracking') , + 'title' => ts('Url Tracking'), 'description' => 'Should we track URL click-throughs for this mailing?', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'forward_replies' => array( + ], + ], + 'forward_replies' => [ 'name' => 'forward_replies', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Forward Replies') , + 'title' => ts('Forward Replies'), 'description' => 'Should we forward replies back to the author?', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'auto_responder' => array( + ], + ], + 'auto_responder' => [ 'name' => 'auto_responder', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Auto Responder') , + 'title' => ts('Auto Responder'), 'description' => 'Should we enable the auto-responder?', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'open_tracking' => array( + ], + ], + 'open_tracking' => [ 'name' => 'open_tracking', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Track Mailing?') , + 'title' => ts('Track Mailing?'), 'description' => 'Should we track when recipients open/read this mailing?', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - ) , - 'is_completed' => array( + ], + 'is_completed' => [ 'name' => 'is_completed', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Mailing Completed') , + 'title' => ts('Mailing Completed'), 'description' => 'Has at least one job associated with this mailing finished?', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'msg_template_id' => array( + ], + ], + 'msg_template_id' => [ 'name' => 'msg_template_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Message Template') , + 'title' => ts('Mailing Message Template'), 'description' => 'FK to the message template.', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_MessageTemplate', - ) , - 'override_verp' => array( + ], + 'override_verp' => [ 'name' => 'override_verp', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Override Verp') , + 'title' => ts('Override Verp'), 'description' => 'Should we overrite VERP address in Reply-To', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'created_id' => array( + ], + ], + 'created_id' => [ 'name' => 'created_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Creator') , + 'title' => ts('Mailing Creator'), 'description' => 'FK to Contact ID who first created this mailing', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'created_date' => array( + ], + 'created_date' => [ 'name' => 'created_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Mailing Created Date') , + 'title' => ts('Mailing Created Date'), 'description' => 'Date and time this mailing was created.', - 'required' => false, + 'required' => FALSE, 'default' => 'NULL', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'formatType' => 'activityDateTime', - ) , - ) , - 'mailing_modified_date' => array( + ], + ], + 'mailing_modified_date' => [ 'name' => 'modified_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Modified Date') , + 'title' => ts('Modified Date'), 'description' => 'When the mailing (or closely related entity) was created or modified or deleted.', - 'required' => false, - 'export' => true, + 'required' => FALSE, + 'export' => TRUE, 'where' => 'civicrm_mailing.modified_date', 'headerPattern' => '', 'dataPattern' => '', @@ -704,108 +724,108 @@ static function &fields() { 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - ) , - 'scheduled_id' => array( + ], + 'scheduled_id' => [ 'name' => 'scheduled_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Scheduled By') , + 'title' => ts('Scheduled By'), 'description' => 'FK to Contact ID who scheduled this mailing', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'scheduled_date' => array( + ], + 'scheduled_date' => [ 'name' => 'scheduled_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Mailing Scheduled Date') , + 'title' => ts('Mailing Scheduled Date'), 'description' => 'Date and time this mailing was scheduled.', - 'required' => false, + 'required' => FALSE, 'default' => 'NULL', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'formatType' => 'activityDateTime', - ) , - ) , - 'approver_id' => array( + ], + ], + 'approver_id' => [ 'name' => 'approver_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Approved By') , + 'title' => ts('Approved By'), 'description' => 'FK to Contact ID who approved this mailing', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'approval_date' => array( + ], + 'approval_date' => [ 'name' => 'approval_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Mailing Approved Date') , + 'title' => ts('Mailing Approved Date'), 'description' => 'Date and time this mailing was approved.', - 'required' => false, + 'required' => FALSE, 'default' => 'NULL', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'formatType' => 'activityDateTime', - ) , - ) , - 'approval_status_id' => array( + ], + ], + 'approval_status_id' => [ 'name' => 'approval_status_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Approval Status') , + 'title' => ts('Approval Status'), 'description' => 'The status of this mailing. Values: none, approved, rejected', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'mail_approval_status', 'optionEditPath' => 'civicrm/admin/options/mail_approval_status', - ) - ) , - 'approval_note' => array( + ] + ], + 'approval_note' => [ 'name' => 'approval_note', 'type' => CRM_Utils_Type::T_LONGTEXT, - 'title' => ts('Approval Note') , + 'title' => ts('Approval Note'), 'description' => 'Note behind the decision.', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'is_archived' => array( + ], + ], + 'is_archived' => [ 'name' => 'is_archived', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Mailing Archived?') , + 'title' => ts('Is Mailing Archived?'), 'description' => 'Is this mailing archived?', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'visibility' => array( + ], + ], + 'visibility' => [ 'name' => 'visibility', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mailing Visibility') , + 'title' => ts('Mailing Visibility'), 'description' => 'In what context(s) is the mailing contents visible (online viewing)', 'maxlength' => 40, 'size' => CRM_Utils_Type::BIG, @@ -814,62 +834,62 @@ static function &fields() { 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::groupVisibility', - ) - ) , - 'campaign_id' => array( + ] + ], + 'campaign_id' => [ 'name' => 'campaign_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Campaign') , + 'title' => ts('Mailing Campaign'), 'description' => 'The campaign for which this mailing has been initiated.', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, 'FKClassName' => 'CRM_Campaign_DAO_Campaign', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'dedupe_email' => array( + ] + ], + 'dedupe_email' => [ 'name' => 'dedupe_email', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('No Duplicate emails?') , + 'title' => ts('No Duplicate emails?'), 'description' => 'Remove duplicate emails?', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'sms_provider_id' => array( + ], + ], + 'sms_provider_id' => [ 'name' => 'sms_provider_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing SMS Provider') , + 'title' => ts('Mailing SMS Provider'), 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, 'FKClassName' => 'CRM_SMS_DAO_Provider', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - ) , - 'hash' => array( + ], + ], + 'hash' => [ 'name' => 'hash', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mailing Hash') , + 'title' => ts('Mailing Hash'), 'description' => 'Key for validating requests related to this mailing.', 'maxlength' => 16, 'size' => CRM_Utils_Type::TWELVE, @@ -877,27 +897,27 @@ static function &fields() { 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - ) , - 'location_type_id' => array( + ], + 'location_type_id' => [ 'name' => 'location_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Location Type') , + 'title' => ts('Location Type'), 'description' => 'With email_selection_method, determines which email address to use', 'table_name' => 'civicrm_mailing', 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_LocationType', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_location_type', 'keyColumn' => 'id', 'labelColumn' => 'display_name', - ) - ) , - 'email_selection_method' => array( + ] + ], + 'email_selection_method' => [ 'name' => 'email_selection_method', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Email Selection Method') , + 'title' => ts('Email Selection Method'), 'description' => 'With location_type_id, determine how to choose the email address to use.', 'maxlength' => 20, 'size' => CRM_Utils_Type::MEDIUM, @@ -906,14 +926,14 @@ static function &fields() { 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::emailSelectMethods', - ) - ) , - 'language' => array( + ] + ], + 'language' => [ 'name' => 'language', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mailing Language') , + 'title' => ts('Mailing Language'), 'description' => 'Language of the content of the mailing. Useful for tokens.', 'maxlength' => 5, 'size' => CRM_Utils_Type::SIX, @@ -921,48 +941,52 @@ static function &fields() { 'entity' => 'Mailing', 'bao' => 'CRM_Mailing_BAO_Mailing', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'languages', 'keyColumn' => 'name', 'optionEditPath' => 'civicrm/admin/options/languages', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -970,10 +994,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -981,24 +1006,30 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_hash' => array( + $indices = [ + 'index_hash' => [ 'name' => 'index_hash', - 'field' => array( + 'field' => [ 0 => 'hash', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_mailing::0::hash', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/DAO/MailingAB.php b/CRM/Mailing/DAO/MailingAB.php index b3997d94fb20..64028865d21c 100644 --- a/CRM/Mailing/DAO/MailingAB.php +++ b/CRM/Mailing/DAO/MailingAB.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_abtest'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('MailingAB ID') , - 'required' => true, + 'title' => ts('MailingAB ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_abtest', 'entity' => 'MailingAB', 'bao' => 'CRM_Mailing_BAO_MailingAB', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Name') , + 'title' => ts('Name'), 'description' => 'Name of the A/B test', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -180,11 +170,11 @@ static function &fields() { 'entity' => 'MailingAB', 'bao' => 'CRM_Mailing_BAO_MailingAB', 'localizable' => 0, - ) , - 'status' => array( + ], + 'status' => [ 'name' => 'status', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Status') , + 'title' => ts('Status'), 'description' => 'Status', 'maxlength' => 32, 'size' => CRM_Utils_Type::MEDIUM, @@ -192,82 +182,82 @@ static function &fields() { 'entity' => 'MailingAB', 'bao' => 'CRM_Mailing_BAO_MailingAB', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Mailing_PseudoConstant::abStatus', - ) - ) , - 'mailing_id_a' => array( + ] + ], + 'mailing_id_a' => [ 'name' => 'mailing_id_a', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing ID (A)') , + 'title' => ts('Mailing ID (A)'), 'description' => 'The first experimental mailing ("A" condition)', 'table_name' => 'civicrm_mailing_abtest', 'entity' => 'MailingAB', 'bao' => 'CRM_Mailing_BAO_MailingAB', 'localizable' => 0, - ) , - 'mailing_id_b' => array( + ], + 'mailing_id_b' => [ 'name' => 'mailing_id_b', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing ID (B)') , + 'title' => ts('Mailing ID (B)'), 'description' => 'The second experimental mailing ("B" condition)', 'table_name' => 'civicrm_mailing_abtest', 'entity' => 'MailingAB', 'bao' => 'CRM_Mailing_BAO_MailingAB', 'localizable' => 0, - ) , - 'mailing_id_c' => array( + ], + 'mailing_id_c' => [ 'name' => 'mailing_id_c', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing ID (C)') , + 'title' => ts('Mailing ID (C)'), 'description' => 'The final, general mailing (derived from A or B)', 'table_name' => 'civicrm_mailing_abtest', 'entity' => 'MailingAB', 'bao' => 'CRM_Mailing_BAO_MailingAB', 'localizable' => 0, - ) , - 'domain_id' => array( + ], + 'domain_id' => [ 'name' => 'domain_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Domain ID') , + 'title' => ts('Domain ID'), 'description' => 'Which site is this mailing for', 'table_name' => 'civicrm_mailing_abtest', 'entity' => 'MailingAB', 'bao' => 'CRM_Mailing_BAO_MailingAB', 'localizable' => 0, - ) , - 'testing_criteria' => array( + ], + 'testing_criteria' => [ 'name' => 'testing_criteria', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Testing Criteria') , + 'title' => ts('Testing Criteria'), 'maxlength' => 32, 'size' => CRM_Utils_Type::MEDIUM, 'table_name' => 'civicrm_mailing_abtest', 'entity' => 'MailingAB', 'bao' => 'CRM_Mailing_BAO_MailingAB', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Mailing_PseudoConstant::abTestCriteria', - ) - ) , - 'winner_criteria' => array( + ] + ], + 'winner_criteria' => [ 'name' => 'winner_criteria', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Winner Criteria') , + 'title' => ts('Winner Criteria'), 'maxlength' => 32, 'size' => CRM_Utils_Type::MEDIUM, 'table_name' => 'civicrm_mailing_abtest', 'entity' => 'MailingAB', 'bao' => 'CRM_Mailing_BAO_MailingAB', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Mailing_PseudoConstant::abWinnerCriteria', - ) - ) , - 'specific_url' => array( + ] + ], + 'specific_url' => [ 'name' => 'specific_url', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('URL for Winner Criteria') , + 'title' => ts('URL for Winner Criteria'), 'description' => 'What specific url to track', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -275,85 +265,89 @@ static function &fields() { 'entity' => 'MailingAB', 'bao' => 'CRM_Mailing_BAO_MailingAB', 'localizable' => 0, - ) , - 'declare_winning_time' => array( + ], + 'declare_winning_time' => [ 'name' => 'declare_winning_time', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Declaration Time') , + 'title' => ts('Declaration Time'), 'description' => 'In how much time to declare winner', 'table_name' => 'civicrm_mailing_abtest', 'entity' => 'MailingAB', 'bao' => 'CRM_Mailing_BAO_MailingAB', 'localizable' => 0, - ) , - 'group_percentage' => array( + ], + 'group_percentage' => [ 'name' => 'group_percentage', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Group Percentage') , + 'title' => ts('Group Percentage'), 'table_name' => 'civicrm_mailing_abtest', 'entity' => 'MailingAB', 'bao' => 'CRM_Mailing_BAO_MailingAB', 'localizable' => 0, - ) , - 'created_id' => array( + ], + 'created_id' => [ 'name' => 'created_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('AB Test Created By') , + 'title' => ts('AB Test Created By'), 'description' => 'FK to Contact ID', 'table_name' => 'civicrm_mailing_abtest', 'entity' => 'MailingAB', 'bao' => 'CRM_Mailing_BAO_MailingAB', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'created_date' => array( + ], + 'created_date' => [ 'name' => 'created_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('AB Test Created Date') , + 'title' => ts('AB Test Created Date'), 'description' => 'When was this item created', - 'required' => false, + 'required' => FALSE, 'default' => 'CURRENT_TIMESTAMP', 'table_name' => 'civicrm_mailing_abtest', 'entity' => 'MailingAB', 'bao' => 'CRM_Mailing_BAO_MailingAB', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - ); + ], + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -361,10 +355,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_abtest', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_abtest', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -372,15 +367,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_abtest', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_abtest', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/DAO/MailingGroup.php b/CRM/Mailing/DAO/MailingGroup.php index acf0d827e27b..2468ba601ac9 100644 --- a/CRM/Mailing/DAO/MailingGroup.php +++ b/CRM/Mailing/DAO/MailingGroup.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_group'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'mailing_id', 'civicrm_mailing', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mailing_id', 'civicrm_mailing', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Group ID') , - 'required' => true, + 'title' => ts('Mailing Group ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_group', 'entity' => 'MailingGroup', 'bao' => 'CRM_Mailing_DAO_MailingGroup', 'localizable' => 0, - ) , - 'mailing_id' => array( + ], + 'mailing_id' => [ 'name' => 'mailing_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing') , + 'title' => ts('Mailing'), 'description' => 'The ID of a previous mailing to include/exclude recipients.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_group', 'entity' => 'MailingGroup', 'bao' => 'CRM_Mailing_DAO_MailingGroup', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_DAO_Mailing', - ) , - 'group_type' => array( + ], + 'group_type' => [ 'name' => 'group_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mailing Group Type') , + 'title' => ts('Mailing Group Type'), 'description' => 'Are the members of the group included or excluded?.', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -154,93 +140,97 @@ static function &fields() { 'entity' => 'MailingGroup', 'bao' => 'CRM_Mailing_DAO_MailingGroup', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getMailingGroupTypes', - ) - ) , - 'entity_table' => array( + ] + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mailing Group Entity Table') , + 'title' => ts('Mailing Group Entity Table'), 'description' => 'Name of table where item being referenced is stored.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_mailing_group', 'entity' => 'MailingGroup', 'bao' => 'CRM_Mailing_DAO_MailingGroup', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Mailing_BAO_Mailing::mailingGroupEntityTables', - ) - ) , - 'entity_id' => array( + ] + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Group Entity') , + 'title' => ts('Mailing Group Entity'), 'description' => 'Foreign key to the referenced item.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_group', 'entity' => 'MailingGroup', 'bao' => 'CRM_Mailing_DAO_MailingGroup', 'localizable' => 0, - ) , - 'search_id' => array( + ], + 'search_id' => [ 'name' => 'search_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Group Search') , + 'title' => ts('Mailing Group Search'), 'description' => 'The filtering search. custom search id or -1 for civicrm api search', 'table_name' => 'civicrm_mailing_group', 'entity' => 'MailingGroup', 'bao' => 'CRM_Mailing_DAO_MailingGroup', 'localizable' => 0, - ) , - 'search_args' => array( + ], + 'search_args' => [ 'name' => 'search_args', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Mailing Group Search Arguments') , + 'title' => ts('Mailing Group Search Arguments'), 'description' => 'The arguments to be sent to the search function', 'table_name' => 'civicrm_mailing_group', 'entity' => 'MailingGroup', 'bao' => 'CRM_Mailing_DAO_MailingGroup', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -248,10 +238,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_group', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_group', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -259,15 +250,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_group', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_group', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/DAO/MailingJob.php b/CRM/Mailing/DAO/MailingJob.php index ecdbe4705e77..4e2c3e3b8cca 100644 --- a/CRM/Mailing/DAO/MailingJob.php +++ b/CRM/Mailing/DAO/MailingJob.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_job'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'mailing_id', 'civicrm_mailing', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_mailing_job', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mailing_id', 'civicrm_mailing', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_mailing_job', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Job ID') , - 'required' => true, + 'title' => ts('Mailing Job ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_job', 'entity' => 'MailingJob', 'bao' => 'CRM_Mailing_BAO_MailingJob', 'localizable' => 0, - ) , - 'mailing_id' => array( + ], + 'mailing_id' => [ 'name' => 'mailing_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing') , + 'title' => ts('Mailing'), 'description' => 'The ID of the mailing this Job will send.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_job', 'entity' => 'MailingJob', 'bao' => 'CRM_Mailing_BAO_MailingJob', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_DAO_Mailing', - ) , - 'scheduled_date' => array( + ], + 'scheduled_date' => [ 'name' => 'scheduled_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Mailing Scheduled Date') , + 'title' => ts('Mailing Scheduled Date'), 'description' => 'date on which this job was scheduled.', - 'required' => false, + 'required' => FALSE, 'default' => 'NULL', 'table_name' => 'civicrm_mailing_job', 'entity' => 'MailingJob', 'bao' => 'CRM_Mailing_BAO_MailingJob', 'localizable' => 0, - ) , - 'start_date' => array( + ], + 'start_date' => [ 'name' => 'start_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Mailing Job Start Date') , + 'title' => ts('Mailing Job Start Date'), 'description' => 'date on which this job was started.', - 'required' => false, + 'required' => FALSE, 'default' => 'NULL', 'table_name' => 'civicrm_mailing_job', 'entity' => 'MailingJob', 'bao' => 'CRM_Mailing_BAO_MailingJob', 'localizable' => 0, - ) , - 'end_date' => array( + ], + 'end_date' => [ 'name' => 'end_date', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Mailing Job End Date') , + 'title' => ts('Mailing Job End Date'), 'description' => 'date on which this job ended.', - 'required' => false, + 'required' => FALSE, 'default' => 'NULL', 'table_name' => 'civicrm_mailing_job', 'entity' => 'MailingJob', 'bao' => 'CRM_Mailing_BAO_MailingJob', 'localizable' => 0, - ) , - 'status' => array( + ], + 'status' => [ 'name' => 'status', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mailing Job Status') , + 'title' => ts('Mailing Job Status'), 'description' => 'The state of this job', 'maxlength' => 12, 'size' => CRM_Utils_Type::TWELVE, @@ -214,27 +204,27 @@ static function &fields() { 'entity' => 'MailingJob', 'bao' => 'CRM_Mailing_BAO_MailingJob', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getMailingJobStatus', - ) - ) , - 'is_test' => array( + ] + ], + 'is_test' => [ 'name' => 'is_test', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Mailing Job Is Test?') , + 'title' => ts('Mailing Job Is Test?'), 'description' => 'Is this job for a test mail?', 'table_name' => 'civicrm_mailing_job', 'entity' => 'MailingJob', 'bao' => 'CRM_Mailing_BAO_MailingJob', 'localizable' => 0, - ) , - 'job_type' => array( + ], + 'job_type' => [ 'name' => 'job_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mailing Job Type') , + 'title' => ts('Mailing Job Type'), 'description' => 'Type of mailling job: null | child ', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -242,11 +232,11 @@ static function &fields() { 'entity' => 'MailingJob', 'bao' => 'CRM_Mailing_BAO_MailingJob', 'localizable' => 0, - ) , - 'parent_id' => array( + ], + 'parent_id' => [ 'name' => 'parent_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Job Parent') , + 'title' => ts('Mailing Job Parent'), 'description' => 'Parent job id', 'default' => 'NULL', 'table_name' => 'civicrm_mailing_job', @@ -254,60 +244,64 @@ static function &fields() { 'bao' => 'CRM_Mailing_BAO_MailingJob', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_DAO_MailingJob', - ) , - 'job_offset' => array( + ], + 'job_offset' => [ 'name' => 'job_offset', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Job Offset') , + 'title' => ts('Mailing Job Offset'), 'description' => 'Offset of the child job', 'table_name' => 'civicrm_mailing_job', 'entity' => 'MailingJob', 'bao' => 'CRM_Mailing_BAO_MailingJob', 'localizable' => 0, - ) , - 'job_limit' => array( + ], + 'job_limit' => [ 'name' => 'job_limit', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Job Limit') , + 'title' => ts('Mailing Job Limit'), 'description' => 'Queue size limit for each child job', 'table_name' => 'civicrm_mailing_job', 'entity' => 'MailingJob', 'bao' => 'CRM_Mailing_BAO_MailingJob', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -315,10 +309,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_job', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_job', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -326,15 +321,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_job', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_job', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/DAO/Recipients.php b/CRM/Mailing/DAO/Recipients.php index 327369db4abf..679ab342c182 100644 --- a/CRM/Mailing/DAO/Recipients.php +++ b/CRM/Mailing/DAO/Recipients.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_recipients'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'mailing_id', 'civicrm_mailing', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'email_id', 'civicrm_email', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'phone_id', 'civicrm_phone', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mailing_id', 'civicrm_mailing', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_id', 'civicrm_email', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_id', 'civicrm_phone', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Recipients ID') , - 'required' => true, + 'title' => ts('Mailing Recipients ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_recipients', 'entity' => 'Recipients', 'bao' => 'CRM_Mailing_BAO_Recipients', 'localizable' => 0, - ) , - 'mailing_id' => array( + ], + 'mailing_id' => [ 'name' => 'mailing_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing') , + 'title' => ts('Mailing'), 'description' => 'The ID of the mailing this Job will send.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_recipients', 'entity' => 'Recipients', 'bao' => 'CRM_Mailing_BAO_Recipients', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_DAO_Mailing', - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Recipient') , + 'title' => ts('Mailing Recipient'), 'description' => 'FK to Contact', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_recipients', 'entity' => 'Recipients', 'bao' => 'CRM_Mailing_BAO_Recipients', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'email_id' => array( + ], + 'email_id' => [ 'name' => 'email_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Recipient Email') , + 'title' => ts('Recipient Email'), 'description' => 'FK to Email', 'default' => 'NULL', 'table_name' => 'civicrm_mailing_recipients', @@ -156,11 +140,11 @@ static function &fields() { 'bao' => 'CRM_Mailing_BAO_Recipients', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Email', - ) , - 'phone_id' => array( + ], + 'phone_id' => [ 'name' => 'phone_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Recipient Phone') , + 'title' => ts('Recipient Phone'), 'description' => 'FK to Phone', 'default' => 'NULL', 'table_name' => 'civicrm_mailing_recipients', @@ -168,40 +152,44 @@ static function &fields() { 'bao' => 'CRM_Mailing_BAO_Recipients', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Phone', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -209,10 +197,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_recipients', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_recipients', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -220,15 +209,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_recipients', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_recipients', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/DAO/Spool.php b/CRM/Mailing/DAO/Spool.php index f463bb7f9062..d3ee6281c86f 100644 --- a/CRM/Mailing/DAO/Spool.php +++ b/CRM/Mailing/DAO/Spool.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_spool'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'job_id', 'civicrm_mailing_job', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'job_id', 'civicrm_mailing_job', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Spool ID') , - 'required' => true, + 'title' => ts('Spool ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_spool', 'entity' => 'Spool', 'bao' => 'CRM_Mailing_BAO_Spool', 'localizable' => 0, - ) , - 'job_id' => array( + ], + 'job_id' => [ 'name' => 'job_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Job') , + 'title' => ts('Mailing Job'), 'description' => 'The ID of the Job .', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_spool', 'entity' => 'Spool', 'bao' => 'CRM_Mailing_BAO_Spool', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_DAO_MailingJob', - ) , - 'recipient_email' => array( + ], + 'recipient_email' => [ 'name' => 'recipient_email', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Recipient Email') , + 'title' => ts('Recipient Email'), 'description' => 'The email of the receipients this mail is to be sent.', 'table_name' => 'civicrm_mailing_spool', 'entity' => 'Spool', 'bao' => 'CRM_Mailing_BAO_Spool', 'localizable' => 0, - ) , - 'headers' => array( + ], + 'headers' => [ 'name' => 'headers', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Headers') , + 'title' => ts('Headers'), 'description' => 'The header information of this mailing .', 'table_name' => 'civicrm_mailing_spool', 'entity' => 'Spool', 'bao' => 'CRM_Mailing_BAO_Spool', 'localizable' => 0, - ) , - 'body' => array( + ], + 'body' => [ 'name' => 'body', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Body') , + 'title' => ts('Body'), 'description' => 'The body of this mailing.', 'table_name' => 'civicrm_mailing_spool', 'entity' => 'Spool', 'bao' => 'CRM_Mailing_BAO_Spool', 'localizable' => 0, - ) , - 'added_at' => array( + ], + 'added_at' => [ 'name' => 'added_at', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Added') , + 'title' => ts('Added'), 'description' => 'date on which this job was added.', - 'required' => false, + 'required' => FALSE, 'default' => 'NULL', 'table_name' => 'civicrm_mailing_spool', 'entity' => 'Spool', 'bao' => 'CRM_Mailing_BAO_Spool', 'localizable' => 0, - ) , - 'removed_at' => array( + ], + 'removed_at' => [ 'name' => 'removed_at', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Removed') , + 'title' => ts('Removed'), 'description' => 'date on which this job was removed.', - 'required' => false, + 'required' => FALSE, 'default' => 'NULL', 'table_name' => 'civicrm_mailing_spool', 'entity' => 'Spool', 'bao' => 'CRM_Mailing_BAO_Spool', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -236,10 +226,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_spool', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_spool', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -247,15 +238,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_spool', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_spool', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/DAO/TrackableURL.php b/CRM/Mailing/DAO/TrackableURL.php index 687cb86376a7..16eeadff8b27 100644 --- a/CRM/Mailing/DAO/TrackableURL.php +++ b/CRM/Mailing/DAO/TrackableURL.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_trackable_url'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'mailing_id', 'civicrm_mailing', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mailing_id', 'civicrm_mailing', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Trackable URL ID') , - 'required' => true, + 'title' => ts('Trackable URL ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_trackable_url', 'entity' => 'TrackableURL', 'bao' => 'CRM_Mailing_BAO_TrackableURL', 'localizable' => 0, - ) , - 'url' => array( + ], + 'url' => [ 'name' => 'url', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Url') , + 'title' => ts('Url'), 'description' => 'The URL to be tracked.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_trackable_url', 'entity' => 'TrackableURL', 'bao' => 'CRM_Mailing_BAO_TrackableURL', 'localizable' => 0, - ) , - 'mailing_id' => array( + ], + 'mailing_id' => [ 'name' => 'mailing_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing') , + 'title' => ts('Mailing'), 'description' => 'FK to the mailing', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_trackable_url', 'entity' => 'TrackableURL', 'bao' => 'CRM_Mailing_BAO_TrackableURL', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_DAO_Mailing', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -169,10 +155,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_trackable_url', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_trackable_url', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -180,15 +167,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_trackable_url', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_trackable_url', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/Event/DAO/Bounce.php b/CRM/Mailing/Event/DAO/Bounce.php index 4da0c9b08398..23f11839d973 100644 --- a/CRM/Mailing/Event/DAO/Bounce.php +++ b/CRM/Mailing/Event/DAO/Bounce.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_event_bounce'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Bounce ID') , - 'required' => true, + 'title' => ts('Bounce ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_bounce', 'entity' => 'Bounce', 'bao' => 'CRM_Mailing_Event_BAO_Bounce', 'localizable' => 0, - ) , - 'event_queue_id' => array( + ], + 'event_queue_id' => [ 'name' => 'event_queue_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Event Queue') , + 'title' => ts('Event Queue'), 'description' => 'FK to EventQueue', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_bounce', 'entity' => 'Bounce', 'bao' => 'CRM_Mailing_Event_BAO_Bounce', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue', - ) , - 'bounce_type_id' => array( + ], + 'bounce_type_id' => [ 'name' => 'bounce_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Bounce Type') , + 'title' => ts('Bounce Type'), 'description' => 'What type of bounce was it?', 'table_name' => 'civicrm_mailing_event_bounce', 'entity' => 'Bounce', 'bao' => 'CRM_Mailing_Event_BAO_Bounce', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_mailing_bounce_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'bounce_reason' => array( + ] + ], + 'bounce_reason' => [ 'name' => 'bounce_reason', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Bounce Reason') , + 'title' => ts('Bounce Reason'), 'description' => 'The reason the email bounced.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -159,52 +143,56 @@ static function &fields() { 'entity' => 'Bounce', 'bao' => 'CRM_Mailing_Event_BAO_Bounce', 'localizable' => 0, - ) , - 'time_stamp' => array( + ], + 'time_stamp' => [ 'name' => 'time_stamp', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Timestamp') , + 'title' => ts('Timestamp'), 'description' => 'When this bounce event occurred.', - 'required' => true, + 'required' => TRUE, 'default' => 'CURRENT_TIMESTAMP', 'table_name' => 'civicrm_mailing_event_bounce', 'entity' => 'Bounce', 'bao' => 'CRM_Mailing_Event_BAO_Bounce', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -212,10 +200,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_bounce', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_bounce', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -223,15 +212,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_bounce', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_bounce', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/Event/DAO/Confirm.php b/CRM/Mailing/Event/DAO/Confirm.php index 4afbbe3f56c0..27bf84171776 100644 --- a/CRM/Mailing/Event/DAO/Confirm.php +++ b/CRM/Mailing/Event/DAO/Confirm.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_event_confirm'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_subscribe_id', 'civicrm_mailing_event_subscribe', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_subscribe_id', 'civicrm_mailing_event_subscribe', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Confirmation ID') , - 'required' => true, + 'title' => ts('Mailing Confirmation ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_confirm', 'entity' => 'Confirm', 'bao' => 'CRM_Mailing_Event_BAO_Confirm', 'localizable' => 0, - ) , - 'event_subscribe_id' => array( + ], + 'event_subscribe_id' => [ 'name' => 'event_subscribe_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Subscribe ID') , + 'title' => ts('Mailing Subscribe ID'), 'description' => 'FK to civicrm_mailing_event_subscribe', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_confirm', 'entity' => 'Confirm', 'bao' => 'CRM_Mailing_Event_BAO_Confirm', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_Event_DAO_Subscribe', - ) , - 'time_stamp' => array( + ], + 'time_stamp' => [ 'name' => 'time_stamp', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Confirm Timestamp') , + 'title' => ts('Confirm Timestamp'), 'description' => 'When this confirmation event occurred.', - 'required' => true, + 'required' => TRUE, 'default' => 'CURRENT_TIMESTAMP', 'table_name' => 'civicrm_mailing_event_confirm', 'entity' => 'Confirm', 'bao' => 'CRM_Mailing_Event_BAO_Confirm', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -170,10 +156,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_confirm', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_confirm', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -181,15 +168,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_confirm', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_confirm', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/Event/DAO/Delivered.php b/CRM/Mailing/Event/DAO/Delivered.php index 1489e5d87933..6c6f7674e2d6 100644 --- a/CRM/Mailing/Event/DAO/Delivered.php +++ b/CRM/Mailing/Event/DAO/Delivered.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_event_delivered'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Delivered ID') , - 'required' => true, + 'title' => ts('Delivered ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_delivered', 'entity' => 'Delivered', 'bao' => 'CRM_Mailing_Event_BAO_Delivered', 'localizable' => 0, - ) , - 'event_queue_id' => array( + ], + 'event_queue_id' => [ 'name' => 'event_queue_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Event Queue') , + 'title' => ts('Event Queue'), 'description' => 'FK to EventQueue', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_delivered', 'entity' => 'Delivered', 'bao' => 'CRM_Mailing_Event_BAO_Delivered', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue', - ) , - 'time_stamp' => array( + ], + 'time_stamp' => [ 'name' => 'time_stamp', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Timestamp') , + 'title' => ts('Timestamp'), 'description' => 'When this delivery event occurred.', - 'required' => true, + 'required' => TRUE, 'default' => 'CURRENT_TIMESTAMP', 'table_name' => 'civicrm_mailing_event_delivered', 'entity' => 'Delivered', 'bao' => 'CRM_Mailing_Event_BAO_Delivered', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -170,10 +156,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_delivered', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_delivered', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -181,15 +168,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_delivered', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_delivered', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/Event/DAO/Forward.php b/CRM/Mailing/Event/DAO/Forward.php index 94cfe08b7926..04b9153f8a7a 100644 --- a/CRM/Mailing/Event/DAO/Forward.php +++ b/CRM/Mailing/Event/DAO/Forward.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_event_forward'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'dest_queue_id', 'civicrm_mailing_event_queue', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'dest_queue_id', 'civicrm_mailing_event_queue', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Forward ID') , - 'required' => true, + 'title' => ts('Forward ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_forward', 'entity' => 'Forward', 'bao' => 'CRM_Mailing_Event_BAO_Forward', 'localizable' => 0, - ) , - 'event_queue_id' => array( + ], + 'event_queue_id' => [ 'name' => 'event_queue_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Event Queue') , + 'title' => ts('Mailing Event Queue'), 'description' => 'FK to EventQueue', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_forward', 'entity' => 'Forward', 'bao' => 'CRM_Mailing_Event_BAO_Forward', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue', - ) , - 'dest_queue_id' => array( + ], + 'dest_queue_id' => [ 'name' => 'dest_queue_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Destination Queue') , + 'title' => ts('Destination Queue'), 'description' => 'FK to EventQueue for destination', 'table_name' => 'civicrm_mailing_event_forward', 'entity' => 'Forward', 'bao' => 'CRM_Mailing_Event_BAO_Forward', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue', - ) , - 'time_stamp' => array( + ], + 'time_stamp' => [ 'name' => 'time_stamp', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Timestamp') , + 'title' => ts('Timestamp'), 'description' => 'When this forward event occurred.', - 'required' => true, + 'required' => TRUE, 'default' => 'CURRENT_TIMESTAMP', 'table_name' => 'civicrm_mailing_event_forward', 'entity' => 'Forward', 'bao' => 'CRM_Mailing_Event_BAO_Forward', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -188,10 +175,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_forward', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_forward', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -199,15 +187,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_forward', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_forward', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/Event/DAO/Opened.php b/CRM/Mailing/Event/DAO/Opened.php index a31e2d1e1739..84ba084a5d80 100644 --- a/CRM/Mailing/Event/DAO/Opened.php +++ b/CRM/Mailing/Event/DAO/Opened.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_event_opened'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Opened ID') , - 'required' => true, + 'title' => ts('Mailing Opened ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_opened', 'entity' => 'Opened', 'bao' => 'CRM_Mailing_Event_BAO_Opened', 'localizable' => 0, - ) , - 'event_queue_id' => array( + ], + 'event_queue_id' => [ 'name' => 'event_queue_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Event Queue') , + 'title' => ts('Event Queue'), 'description' => 'FK to EventQueue', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_opened', 'entity' => 'Opened', 'bao' => 'CRM_Mailing_Event_BAO_Opened', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue', - ) , - 'time_stamp' => array( + ], + 'time_stamp' => [ 'name' => 'time_stamp', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Timestamp') , + 'title' => ts('Timestamp'), 'description' => 'When this open event occurred.', - 'required' => true, + 'required' => TRUE, 'default' => 'CURRENT_TIMESTAMP', 'table_name' => 'civicrm_mailing_event_opened', 'entity' => 'Opened', 'bao' => 'CRM_Mailing_Event_BAO_Opened', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -170,10 +156,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_opened', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_opened', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -181,15 +168,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_opened', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_opened', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/Event/DAO/Queue.php b/CRM/Mailing/Event/DAO/Queue.php index af49601ac2bc..e4da32e66697 100644 --- a/CRM/Mailing/Event/DAO/Queue.php +++ b/CRM/Mailing/Event/DAO/Queue.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_event_queue'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'job_id', 'civicrm_mailing_job', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'email_id', 'civicrm_email', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'phone_id', 'civicrm_phone', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'job_id', 'civicrm_mailing_job', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_id', 'civicrm_email', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_id', 'civicrm_phone', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Event Queue ID') , - 'required' => true, + 'title' => ts('Mailing Event Queue ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_queue', 'entity' => 'Queue', 'bao' => 'CRM_Mailing_Event_BAO_Queue', 'localizable' => 0, - ) , - 'job_id' => array( + ], + 'job_id' => [ 'name' => 'job_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Job ID') , + 'title' => ts('Job ID'), 'description' => 'FK to Job', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_queue', 'entity' => 'Queue', 'bao' => 'CRM_Mailing_Event_BAO_Queue', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_DAO_MailingJob', - ) , - 'email_id' => array( + ], + 'email_id' => [ 'name' => 'email_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Email ID') , + 'title' => ts('Email ID'), 'description' => 'FK to Email', 'default' => 'NULL', 'table_name' => 'civicrm_mailing_event_queue', @@ -150,36 +135,36 @@ static function &fields() { 'bao' => 'CRM_Mailing_Event_BAO_Queue', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Email', - ) , - 'contact_id' => array( + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'FK to Contact', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_queue', 'entity' => 'Queue', 'bao' => 'CRM_Mailing_Event_BAO_Queue', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'hash' => array( + ], + 'hash' => [ 'name' => 'hash', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Security Hash') , + 'title' => ts('Security Hash'), 'description' => 'Security hash', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_mailing_event_queue', 'entity' => 'Queue', 'bao' => 'CRM_Mailing_Event_BAO_Queue', 'localizable' => 0, - ) , - 'phone_id' => array( + ], + 'phone_id' => [ 'name' => 'phone_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Phone ID') , + 'title' => ts('Phone ID'), 'description' => 'FK to Phone', 'default' => 'NULL', 'table_name' => 'civicrm_mailing_event_queue', @@ -187,40 +172,44 @@ static function &fields() { 'bao' => 'CRM_Mailing_Event_BAO_Queue', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Phone', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -228,10 +217,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_queue', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_queue', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -239,24 +229,30 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_queue', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_queue', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_hash' => array( + $indices = [ + 'index_hash' => [ 'name' => 'index_hash', - 'field' => array( + 'field' => [ 0 => 'hash', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_mailing_event_queue::0::hash', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/Event/DAO/Reply.php b/CRM/Mailing/Event/DAO/Reply.php index d5f3085cb45c..7b3286e265f7 100644 --- a/CRM/Mailing/Event/DAO/Reply.php +++ b/CRM/Mailing/Event/DAO/Reply.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_event_reply'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Reply ID') , - 'required' => true, + 'title' => ts('Reply ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_reply', 'entity' => 'Reply', 'bao' => 'CRM_Mailing_Event_BAO_Reply', 'localizable' => 0, - ) , - 'event_queue_id' => array( + ], + 'event_queue_id' => [ 'name' => 'event_queue_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Event Queue') , + 'title' => ts('Event Queue'), 'description' => 'FK to EventQueue', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_reply', 'entity' => 'Reply', 'bao' => 'CRM_Mailing_Event_BAO_Reply', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue', - ) , - 'time_stamp' => array( + ], + 'time_stamp' => [ 'name' => 'time_stamp', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Reply Timestamp') , + 'title' => ts('Reply Timestamp'), 'description' => 'When this reply event occurred.', - 'required' => true, + 'required' => TRUE, 'default' => 'CURRENT_TIMESTAMP', 'table_name' => 'civicrm_mailing_event_reply', 'entity' => 'Reply', 'bao' => 'CRM_Mailing_Event_BAO_Reply', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -170,10 +156,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_reply', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_reply', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -181,15 +168,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_reply', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_reply', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/Event/DAO/Subscribe.php b/CRM/Mailing/Event/DAO/Subscribe.php index 4bfe339a6314..1d019cfb4fea 100644 --- a/CRM/Mailing/Event/DAO/Subscribe.php +++ b/CRM/Mailing/Event/DAO/Subscribe.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_event_subscribe'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'group_id', 'civicrm_group', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'group_id', 'civicrm_group', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Subscribe ID') , - 'required' => true, + 'title' => ts('Mailing Subscribe ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_subscribe', 'entity' => 'Subscribe', 'bao' => 'CRM_Mailing_Event_BAO_Subscribe', 'localizable' => 0, - ) , - 'group_id' => array( + ], + 'group_id' => [ 'name' => 'group_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Subscribe Group') , + 'title' => ts('Mailing Subscribe Group'), 'description' => 'FK to Group', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_subscribe', 'entity' => 'Subscribe', 'bao' => 'CRM_Mailing_Event_BAO_Subscribe', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Group', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - 'contact_id' => array( + ] + ], + 'contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Subscribe Contact') , + 'title' => ts('Mailing Subscribe Contact'), 'description' => 'FK to Contact', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_subscribe', 'entity' => 'Subscribe', 'bao' => 'CRM_Mailing_Event_BAO_Subscribe', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'hash' => array( + ], + 'hash' => [ 'name' => 'hash', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Mailing Subscribe Hash') , + 'title' => ts('Mailing Subscribe Hash'), 'description' => 'Security hash', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_mailing_event_subscribe', 'entity' => 'Subscribe', 'bao' => 'CRM_Mailing_Event_BAO_Subscribe', 'localizable' => 0, - ) , - 'time_stamp' => array( + ], + 'time_stamp' => [ 'name' => 'time_stamp', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Mailing Subscribe Timestamp') , + 'title' => ts('Mailing Subscribe Timestamp'), 'description' => 'When this subscription event occurred.', - 'required' => true, + 'required' => TRUE, 'default' => 'CURRENT_TIMESTAMP', 'table_name' => 'civicrm_mailing_event_subscribe', 'entity' => 'Subscribe', 'bao' => 'CRM_Mailing_Event_BAO_Subscribe', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -216,10 +204,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_subscribe', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_subscribe', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -227,15 +216,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_subscribe', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_subscribe', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/Event/DAO/TrackableURLOpen.php b/CRM/Mailing/Event/DAO/TrackableURLOpen.php index 0074f3c3dcbb..b96efc392a46 100644 --- a/CRM/Mailing/Event/DAO/TrackableURLOpen.php +++ b/CRM/Mailing/Event/DAO/TrackableURLOpen.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_event_trackable_url_open'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'trackable_url_id', 'civicrm_mailing_trackable_url', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'trackable_url_id', 'civicrm_mailing_trackable_url', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Trackable URL Open ID') , - 'required' => true, + 'title' => ts('Trackable URL Open ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_trackable_url_open', 'entity' => 'TrackableURLOpen', 'bao' => 'CRM_Mailing_Event_BAO_TrackableURLOpen', 'localizable' => 0, - ) , - 'event_queue_id' => array( + ], + 'event_queue_id' => [ 'name' => 'event_queue_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Event Queue') , + 'title' => ts('Event Queue'), 'description' => 'FK to EventQueue', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_trackable_url_open', 'entity' => 'TrackableURLOpen', 'bao' => 'CRM_Mailing_Event_BAO_TrackableURLOpen', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue', - ) , - 'trackable_url_id' => array( + ], + 'trackable_url_id' => [ 'name' => 'trackable_url_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Trackable Url') , + 'title' => ts('Trackable Url'), 'description' => 'FK to TrackableURL', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_trackable_url_open', 'entity' => 'TrackableURLOpen', 'bao' => 'CRM_Mailing_Event_BAO_TrackableURLOpen', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_DAO_TrackableURL', - ) , - 'time_stamp' => array( + ], + 'time_stamp' => [ 'name' => 'time_stamp', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Timestamp') , + 'title' => ts('Timestamp'), 'description' => 'When this trackable URL open occurred.', - 'required' => true, + 'required' => TRUE, 'default' => 'CURRENT_TIMESTAMP', 'table_name' => 'civicrm_mailing_event_trackable_url_open', 'entity' => 'TrackableURLOpen', 'bao' => 'CRM_Mailing_Event_BAO_TrackableURLOpen', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -189,10 +176,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_trackable_url_open', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_trackable_url_open', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -200,15 +188,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_trackable_url_open', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_trackable_url_open', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Mailing/Event/DAO/Unsubscribe.php b/CRM/Mailing/Event/DAO/Unsubscribe.php index d18f977fab80..7e953d6f0ae1 100644 --- a/CRM/Mailing/Event/DAO/Unsubscribe.php +++ b/CRM/Mailing/Event/DAO/Unsubscribe.php @@ -1,29 +1,5 @@ __table = 'civicrm_mailing_event_unsubscribe'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Unsubscribe ID') , - 'required' => true, + 'title' => ts('Unsubscribe ID'), + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_unsubscribe', 'entity' => 'Unsubscribe', 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe', 'localizable' => 0, - ) , - 'event_queue_id' => array( + ], + 'event_queue_id' => [ 'name' => 'event_queue_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Mailing Event Queue') , + 'title' => ts('Mailing Event Queue'), 'description' => 'FK to EventQueue', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_unsubscribe', 'entity' => 'Unsubscribe', 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe', 'localizable' => 0, 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue', - ) , - 'org_unsubscribe' => array( + ], + 'org_unsubscribe' => [ 'name' => 'org_unsubscribe', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Unsubscribe is for Organization?') , + 'title' => ts('Unsubscribe is for Organization?'), 'description' => 'Unsubscribe at org- or group-level', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_mailing_event_unsubscribe', 'entity' => 'Unsubscribe', 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe', 'localizable' => 0, - ) , - 'time_stamp' => array( + ], + 'time_stamp' => [ 'name' => 'time_stamp', 'type' => CRM_Utils_Type::T_TIMESTAMP, - 'title' => ts('Unsubscribe Timestamp') , + 'title' => ts('Unsubscribe Timestamp'), 'description' => 'When this delivery event occurred.', - 'required' => true, + 'required' => TRUE, 'default' => 'CURRENT_TIMESTAMP', 'table_name' => 'civicrm_mailing_event_unsubscribe', 'entity' => 'Unsubscribe', 'bao' => 'CRM_Mailing_Event_BAO_Unsubscribe', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -187,10 +174,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_unsubscribe', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_unsubscribe', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -198,15 +186,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_unsubscribe', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_unsubscribe', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Member/DAO/Membership.php b/CRM/Member/DAO/Membership.php index 99ab3cbc7852..7a378b086a76 100644 --- a/CRM/Member/DAO/Membership.php +++ b/CRM/Member/DAO/Membership.php @@ -1,29 +1,5 @@ __table = 'civicrm_membership'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_type_id', 'civicrm_membership_type', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'status_id', 'civicrm_membership_status', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'owner_membership_id', 'civicrm_membership', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_recur_id', 'civicrm_contribution_recur', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'membership_type_id', 'civicrm_membership_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'status_id', 'civicrm_membership_status', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'owner_membership_id', 'civicrm_membership', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_recur_id', 'civicrm_contribution_recur', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'membership_id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'membership_id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership ID') , + 'title' => ts('Membership ID'), 'description' => 'Membership Id', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_membership.id', 'headerPattern' => '/^(m(embership\s)?id)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_membership', 'entity' => 'Membership', 'bao' => 'CRM_Member_BAO_Membership', 'localizable' => 0, - ) , - 'membership_contact_id' => array( + ], + 'membership_contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'FK to Contact ID', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_membership.contact_id', 'headerPattern' => '/contact(.?id)?/i', 'dataPattern' => '/^\d+$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_membership', 'entity' => 'Membership', 'bao' => 'CRM_Member_BAO_Membership', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'EntityRef', - ) , - ) , - 'membership_type_id' => array( + ], + ], + 'membership_type_id' => [ 'name' => 'membership_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Type Id') , + 'title' => ts('Membership Type Id'), 'description' => 'FK to Membership Type', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_membership.membership_type_id', 'headerPattern' => '/^(m(embership\s)?type)$/i', 'dataPattern' => '', - 'export' => false, + 'export' => FALSE, 'table_name' => 'civicrm_membership', 'entity' => 'Membership', 'bao' => 'CRM_Member_BAO_Membership', 'localizable' => 0, 'FKClassName' => 'CRM_Member_DAO_MembershipType', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_membership_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'join_date' => array( + ] + ], + 'join_date' => [ 'name' => 'join_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Member Since') , + 'title' => ts('Member Since'), 'description' => 'Beginning of initial membership period (member since...).', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_membership.join_date', 'headerPattern' => '/^join|(j(oin\s)?date)$/i', 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_membership', 'entity' => 'Membership', 'bao' => 'CRM_Member_BAO_Membership', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'formatType' => 'activityDate', - ) , - ) , - 'membership_start_date' => array( + ], + ], + 'membership_start_date' => [ 'name' => 'start_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Membership Start Date') , + 'title' => ts('Membership Start Date'), 'description' => 'Beginning of current uninterrupted membership period.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_membership.start_date', 'headerPattern' => '/(member(ship)?.)?start(s)?(.date$)?/i', 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_membership', 'entity' => 'Membership', 'bao' => 'CRM_Member_BAO_Membership', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'formatType' => 'activityDate', - ) , - ) , - 'membership_end_date' => array( + ], + ], + 'membership_end_date' => [ 'name' => 'end_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Membership Expiration Date') , + 'title' => ts('Membership Expiration Date'), 'description' => 'Current membership period expire date.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_membership.end_date', 'headerPattern' => '/(member(ship)?.)?end(s)?(.date$)?/i', 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_membership', 'entity' => 'Membership', 'bao' => 'CRM_Member_BAO_Membership', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', 'formatType' => 'activityDate', - ) , - ) , - 'membership_source' => array( + ], + ], + 'membership_source' => [ 'name' => 'source', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Source') , + 'title' => ts('Source'), 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_membership.source', 'headerPattern' => '/^(member(ship?))?source$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_membership', 'entity' => 'Membership', 'bao' => 'CRM_Member_BAO_Membership', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'status_id' => array( + ], + ], + 'status_id' => [ 'name' => 'status_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Status Id') , + 'title' => ts('Membership Status Id'), 'description' => 'FK to Membership Status', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_membership.status_id', 'headerPattern' => '/(member(ship|).)?(status)$/i', 'dataPattern' => '', - 'export' => false, + 'export' => FALSE, 'table_name' => 'civicrm_membership', 'entity' => 'Membership', 'bao' => 'CRM_Member_BAO_Membership', 'localizable' => 0, 'FKClassName' => 'CRM_Member_DAO_MembershipStatus', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_membership_status', 'keyColumn' => 'id', 'labelColumn' => 'label', - ) - ) , - 'is_override' => array( + ] + ], + 'is_override' => [ 'name' => 'is_override', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Status Override') , + 'title' => ts('Status Override'), 'description' => 'Admin users may set a manual status which overrides the calculated status. When this flag is true, automated status update scripts should NOT modify status for the record.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_membership.is_override', 'headerPattern' => '/override$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_membership', 'entity' => 'Membership', 'bao' => 'CRM_Member_BAO_Membership', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'owner_membership_id' => array( + ], + ], + 'owner_membership_id' => [ 'name' => 'owner_membership_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Primary Member ID') , + 'title' => ts('Primary Member ID'), 'description' => 'Optional FK to Parent Membership.', - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_membership.owner_membership_id', 'headerPattern' => '', 'dataPattern' => '', @@ -365,122 +357,126 @@ static function &fields() { 'bao' => 'CRM_Member_BAO_Membership', 'localizable' => 0, 'FKClassName' => 'CRM_Member_DAO_Membership', - ) , - 'max_related' => array( + ], + 'max_related' => [ 'name' => 'max_related', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Max Related') , + 'title' => ts('Max Related'), 'description' => 'Maximum number of related memberships (membership_type override).', 'table_name' => 'civicrm_membership', 'entity' => 'Membership', 'bao' => 'CRM_Member_BAO_Membership', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'member_is_test' => array( + ], + ], + 'member_is_test' => [ 'name' => 'is_test', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Test') , - 'import' => true, + 'title' => ts('Test'), + 'import' => TRUE, 'where' => 'civicrm_membership.is_test', 'headerPattern' => '/(is.)?test(.member(ship)?)?/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_membership', 'entity' => 'Membership', 'bao' => 'CRM_Member_BAO_Membership', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'member_is_pay_later' => array( + ], + ], + 'member_is_pay_later' => [ 'name' => 'is_pay_later', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Pay Later') , - 'import' => true, + 'title' => ts('Is Pay Later'), + 'import' => TRUE, 'where' => 'civicrm_membership.is_pay_later', 'headerPattern' => '/(is.)?(pay(.)?later)$/i', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_membership', 'entity' => 'Membership', 'bao' => 'CRM_Member_BAO_Membership', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'contribution_recur_id' => array( + ], + ], + 'contribution_recur_id' => [ 'name' => 'contribution_recur_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Recurring Contribution') , + 'title' => ts('Membership Recurring Contribution'), 'description' => 'Conditional foreign key to civicrm_contribution_recur id. Each membership in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events.', 'table_name' => 'civicrm_membership', 'entity' => 'Membership', 'bao' => 'CRM_Member_BAO_Membership', 'localizable' => 0, 'FKClassName' => 'CRM_Contribute_DAO_ContributionRecur', - ) , - 'member_campaign_id' => array( + ], + 'member_campaign_id' => [ 'name' => 'campaign_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Campaign') , + 'title' => ts('Campaign'), 'description' => 'The campaign for which this membership is attached.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_membership.campaign_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_membership', 'entity' => 'Membership', 'bao' => 'CRM_Member_BAO_Membership', 'localizable' => 0, 'FKClassName' => 'CRM_Campaign_DAO_Campaign', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -488,10 +484,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -499,24 +496,30 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_owner_membership_id' => array( + $indices = [ + 'index_owner_membership_id' => [ 'name' => 'index_owner_membership_id', - 'field' => array( + 'field' => [ 0 => 'owner_membership_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_membership::0::owner_membership_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Member/DAO/MembershipBlock.php b/CRM/Member/DAO/MembershipBlock.php index db4feda2930a..084c706f8129 100644 --- a/CRM/Member/DAO/MembershipBlock.php +++ b/CRM/Member/DAO/MembershipBlock.php @@ -1,29 +1,5 @@ __table = 'civicrm_membership_block'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'entity_id', 'civicrm_contribution_page', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_type_default', 'civicrm_membership_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'entity_id', 'civicrm_contribution_page', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'membership_type_default', 'civicrm_membership_type', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Block ID') , + 'title' => ts('Membership Block ID'), 'description' => 'Membership Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_membership_block', 'entity' => 'MembershipBlock', 'bao' => 'CRM_Member_BAO_MembershipBlock', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Membership Block Entity Table') , + 'title' => ts('Membership Block Entity Table'), 'description' => 'Name for Membership Status', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -180,23 +173,23 @@ static function &fields() { 'entity' => 'MembershipBlock', 'bao' => 'CRM_Member_BAO_MembershipBlock', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Block Entity ID') , + 'title' => ts('Membership Block Entity ID'), 'description' => 'FK to civicrm_contribution_page.id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_membership_block', 'entity' => 'MembershipBlock', 'bao' => 'CRM_Member_BAO_MembershipBlock', 'localizable' => 0, 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage', - ) , - 'membership_types' => array( + ], + 'membership_types' => [ 'name' => 'membership_types', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Membership Block Membership Types') , + 'title' => ts('Membership Block Membership Types'), 'description' => 'Membership types to be exposed by this block', 'maxlength' => 1024, 'size' => CRM_Utils_Type::HUGE, @@ -205,44 +198,44 @@ static function &fields() { 'bao' => 'CRM_Member_BAO_MembershipBlock', 'localizable' => 0, 'serialize' => self::SERIALIZE_PHP, - ) , - 'membership_type_default' => array( + ], + 'membership_type_default' => [ 'name' => 'membership_type_default', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Block Default Type') , + 'title' => ts('Membership Block Default Type'), 'description' => 'Optional foreign key to membership_type', 'table_name' => 'civicrm_membership_block', 'entity' => 'MembershipBlock', 'bao' => 'CRM_Member_BAO_MembershipBlock', 'localizable' => 0, 'FKClassName' => 'CRM_Member_DAO_MembershipType', - ) , - 'display_min_fee' => array( + ], + 'display_min_fee' => [ 'name' => 'display_min_fee', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Membership Block Display Minimum Fee') , + 'title' => ts('Membership Block Display Minimum Fee'), 'description' => 'Display minimum membership fee', 'default' => '1', 'table_name' => 'civicrm_membership_block', 'entity' => 'MembershipBlock', 'bao' => 'CRM_Member_BAO_MembershipBlock', 'localizable' => 0, - ) , - 'is_separate_payment' => array( + ], + 'is_separate_payment' => [ 'name' => 'is_separate_payment', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Membership Block Is Separate Payment') , + 'title' => ts('Membership Block Is Separate Payment'), 'description' => 'Should membership transactions be processed separately', 'default' => '1', 'table_name' => 'civicrm_membership_block', 'entity' => 'MembershipBlock', 'bao' => 'CRM_Member_BAO_MembershipBlock', 'localizable' => 0, - ) , - 'new_title' => array( + ], + 'new_title' => [ 'name' => 'new_title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Membership Block New Title') , + 'title' => ts('Membership Block New Title'), 'description' => 'Title to display at top of block', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -250,21 +243,21 @@ static function &fields() { 'entity' => 'MembershipBlock', 'bao' => 'CRM_Member_BAO_MembershipBlock', 'localizable' => 1, - ) , - 'new_text' => array( + ], + 'new_text' => [ 'name' => 'new_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Membership Block New Text') , + 'title' => ts('Membership Block New Text'), 'description' => 'Text to display below title', 'table_name' => 'civicrm_membership_block', 'entity' => 'MembershipBlock', 'bao' => 'CRM_Member_BAO_MembershipBlock', 'localizable' => 1, - ) , - 'renewal_title' => array( + ], + 'renewal_title' => [ 'name' => 'renewal_title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Membership Block Renewal Title') , + 'title' => ts('Membership Block Renewal Title'), 'description' => 'Title for renewal', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -272,71 +265,75 @@ static function &fields() { 'entity' => 'MembershipBlock', 'bao' => 'CRM_Member_BAO_MembershipBlock', 'localizable' => 1, - ) , - 'renewal_text' => array( + ], + 'renewal_text' => [ 'name' => 'renewal_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Membership Block Renewal Text') , + 'title' => ts('Membership Block Renewal Text'), 'description' => 'Text to display for member renewal', 'table_name' => 'civicrm_membership_block', 'entity' => 'MembershipBlock', 'bao' => 'CRM_Member_BAO_MembershipBlock', 'localizable' => 1, - ) , - 'is_required' => array( + ], + 'is_required' => [ 'name' => 'is_required', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Required') , + 'title' => ts('Is Required'), 'description' => 'Is membership sign up optional', 'table_name' => 'civicrm_membership_block', 'entity' => 'MembershipBlock', 'bao' => 'CRM_Member_BAO_MembershipBlock', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Active') , + 'title' => ts('Is Active'), 'description' => 'Is this membership_block enabled', 'default' => '1', 'table_name' => 'civicrm_membership_block', 'entity' => 'MembershipBlock', 'bao' => 'CRM_Member_BAO_MembershipBlock', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -344,10 +341,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_block', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_block', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -355,15 +353,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_block', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_block', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Member/DAO/MembershipLog.php b/CRM/Member/DAO/MembershipLog.php index 8b7f6b986e4c..3b6310bd57d4 100644 --- a/CRM/Member/DAO/MembershipLog.php +++ b/CRM/Member/DAO/MembershipLog.php @@ -1,29 +1,5 @@ __table = 'civicrm_membership_log'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_id', 'civicrm_membership', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'status_id', 'civicrm_membership_status', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'modified_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_type_id', 'civicrm_membership_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'membership_id', 'civicrm_membership', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'status_id', 'civicrm_membership_status', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'modified_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'membership_type_id', 'civicrm_membership_type', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Log ID') , - 'required' => true, + 'title' => ts('Membership Log ID'), + 'required' => TRUE, 'table_name' => 'civicrm_membership_log', 'entity' => 'MembershipLog', 'bao' => 'CRM_Member_BAO_MembershipLog', 'localizable' => 0, - ) , - 'membership_id' => array( + ], + 'membership_id' => [ 'name' => 'membership_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership ID') , + 'title' => ts('Membership ID'), 'description' => 'FK to Membership table', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_membership_log', 'entity' => 'MembershipLog', 'bao' => 'CRM_Member_BAO_MembershipLog', 'localizable' => 0, 'FKClassName' => 'CRM_Member_DAO_Membership', - ) , - 'status_id' => array( + ], + 'status_id' => [ 'name' => 'status_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Status') , + 'title' => ts('Membership Status'), 'description' => 'New status assigned to membership by this action. FK to Membership Status', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_membership_log', 'entity' => 'MembershipLog', 'bao' => 'CRM_Member_BAO_MembershipLog', 'localizable' => 0, 'FKClassName' => 'CRM_Member_DAO_MembershipStatus', - ) , - 'start_date' => array( + ], + 'start_date' => [ 'name' => 'start_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Membership Log Start Date') , + 'title' => ts('Membership Log Start Date'), 'description' => 'New membership period start date', 'table_name' => 'civicrm_membership_log', 'entity' => 'MembershipLog', 'bao' => 'CRM_Member_BAO_MembershipLog', 'localizable' => 0, - ) , - 'end_date' => array( + ], + 'end_date' => [ 'name' => 'end_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Membership Log End Date') , + 'title' => ts('Membership Log End Date'), 'description' => 'New membership period expiration date.', 'table_name' => 'civicrm_membership_log', 'entity' => 'MembershipLog', 'bao' => 'CRM_Member_BAO_MembershipLog', 'localizable' => 0, - ) , - 'modified_id' => array( + ], + 'modified_id' => [ 'name' => 'modified_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Log modified By') , + 'title' => ts('Membership Log modified By'), 'description' => 'FK to Contact ID of person under whose credentials this data modification was made.', 'table_name' => 'civicrm_membership_log', 'entity' => 'MembershipLog', 'bao' => 'CRM_Member_BAO_MembershipLog', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'modified_date' => array( + ], + 'modified_date' => [ 'name' => 'modified_date', 'type' => CRM_Utils_Type::T_DATE, - 'title' => ts('Membership Change Date') , + 'title' => ts('Membership Change Date'), 'description' => 'Date this membership modification action was logged.', 'table_name' => 'civicrm_membership_log', 'entity' => 'MembershipLog', 'bao' => 'CRM_Member_BAO_MembershipLog', 'localizable' => 0, - ) , - 'membership_type_id' => array( + ], + 'membership_type_id' => [ 'name' => 'membership_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Type ID') , + 'title' => ts('Membership Type ID'), 'description' => 'FK to Membership Type.', 'table_name' => 'civicrm_membership_log', 'entity' => 'MembershipLog', 'bao' => 'CRM_Member_BAO_MembershipLog', 'localizable' => 0, 'FKClassName' => 'CRM_Member_DAO_MembershipType', - ) , - 'max_related' => array( + ], + 'max_related' => [ 'name' => 'max_related', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Maximum Related Memberships') , + 'title' => ts('Maximum Related Memberships'), 'description' => 'Maximum number of related memberships.', 'table_name' => 'civicrm_membership_log', 'entity' => 'MembershipLog', 'bao' => 'CRM_Member_BAO_MembershipLog', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -271,10 +263,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_log', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_log', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -282,15 +275,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_log', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_log', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Member/DAO/MembershipPayment.php b/CRM/Member/DAO/MembershipPayment.php index 73af131b1e84..6d7ea99b97f8 100644 --- a/CRM/Member/DAO/MembershipPayment.php +++ b/CRM/Member/DAO/MembershipPayment.php @@ -1,29 +1,5 @@ __table = 'civicrm_membership_payment'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_id', 'civicrm_membership', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_id', 'civicrm_contribution', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'membership_id', 'civicrm_membership', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_id', 'civicrm_contribution', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Payment ID') , - 'required' => true, + 'title' => ts('Membership Payment ID'), + 'required' => TRUE, 'table_name' => 'civicrm_membership_payment', 'entity' => 'MembershipPayment', 'bao' => 'CRM_Member_BAO_MembershipPayment', 'localizable' => 0, - ) , - 'membership_id' => array( + ], + 'membership_id' => [ 'name' => 'membership_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership') , + 'title' => ts('Membership'), 'description' => 'FK to Membership table', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_membership_payment', 'entity' => 'MembershipPayment', 'bao' => 'CRM_Member_BAO_MembershipPayment', 'localizable' => 0, 'FKClassName' => 'CRM_Member_DAO_Membership', - ) , - 'contribution_id' => array( + ], + 'contribution_id' => [ 'name' => 'contribution_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contribution') , + 'title' => ts('Contribution'), 'description' => 'FK to contribution table.', 'table_name' => 'civicrm_membership_payment', 'entity' => 'MembershipPayment', 'bao' => 'CRM_Member_BAO_MembershipPayment', 'localizable' => 0, 'FKClassName' => 'CRM_Contribute_DAO_Contribution', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -170,10 +156,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_payment', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_payment', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -181,26 +168,32 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_payment', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_payment', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_contribution_membership' => array( + $indices = [ + 'UI_contribution_membership' => [ 'name' => 'UI_contribution_membership', - 'field' => array( + 'field' => [ 0 => 'contribution_id', 1 => 'membership_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_membership_payment::1::contribution_id::membership_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Member/DAO/MembershipStatus.php b/CRM/Member/DAO/MembershipStatus.php index 3d7f1d8dafdd..b40573e63745 100644 --- a/CRM/Member/DAO/MembershipStatus.php +++ b/CRM/Member/DAO/MembershipStatus.php @@ -1,29 +1,5 @@ __table = 'civicrm_membership_status'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Status ID') , + 'title' => ts('Membership Status ID'), 'description' => 'Membership Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_membership_status', 'entity' => 'MembershipStatus', 'bao' => 'CRM_Member_BAO_MembershipStatus', 'localizable' => 0, - ) , - 'membership_status' => array( + ], + 'membership_status' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Membership Status') , + 'title' => ts('Membership Status'), 'description' => 'Name for Membership Status', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_membership_status.name', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_membership_status', 'entity' => 'MembershipStatus', 'bao' => 'CRM_Member_BAO_MembershipStatus', 'localizable' => 0, - ) , - 'label' => array( + ], + 'label' => [ 'name' => 'label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Label') , + 'title' => ts('Label'), 'description' => 'Label for Membership Status', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -193,11 +186,11 @@ static function &fields() { 'entity' => 'MembershipStatus', 'bao' => 'CRM_Member_BAO_MembershipStatus', 'localizable' => 1, - ) , - 'start_event' => array( + ], + 'start_event' => [ 'name' => 'start_event', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Start Event') , + 'title' => ts('Start Event'), 'description' => 'Event when this status starts.', 'maxlength' => 12, 'size' => CRM_Utils_Type::TWELVE, @@ -205,17 +198,17 @@ static function &fields() { 'entity' => 'MembershipStatus', 'bao' => 'CRM_Member_BAO_MembershipStatus', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::eventDate', - ) - ) , - 'start_event_adjust_unit' => array( + ] + ], + 'start_event_adjust_unit' => [ 'name' => 'start_event_adjust_unit', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Start Event Adjust Unit') , + 'title' => ts('Start Event Adjust Unit'), 'description' => 'Unit used for adjusting from start_event.', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -223,27 +216,27 @@ static function &fields() { 'entity' => 'MembershipStatus', 'bao' => 'CRM_Member_BAO_MembershipStatus', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::unitList', - ) - ) , - 'start_event_adjust_interval' => array( + ] + ], + 'start_event_adjust_interval' => [ 'name' => 'start_event_adjust_interval', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Start Event Adjust Interval') , + 'title' => ts('Start Event Adjust Interval'), 'description' => 'Status range begins this many units from start_event.', 'table_name' => 'civicrm_membership_status', 'entity' => 'MembershipStatus', 'bao' => 'CRM_Member_BAO_MembershipStatus', 'localizable' => 0, - ) , - 'end_event' => array( + ], + 'end_event' => [ 'name' => 'end_event', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('End Event') , + 'title' => ts('End Event'), 'description' => 'Event after which this status ends.', 'maxlength' => 12, 'size' => CRM_Utils_Type::TWELVE, @@ -251,17 +244,17 @@ static function &fields() { 'entity' => 'MembershipStatus', 'bao' => 'CRM_Member_BAO_MembershipStatus', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::eventDate', - ) - ) , - 'end_event_adjust_unit' => array( + ] + ], + 'end_event_adjust_unit' => [ 'name' => 'end_event_adjust_unit', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('End Event Adjust Unit') , + 'title' => ts('End Event Adjust Unit'), 'description' => 'Unit used for adjusting from the ending event.', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -269,116 +262,120 @@ static function &fields() { 'entity' => 'MembershipStatus', 'bao' => 'CRM_Member_BAO_MembershipStatus', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::unitList', - ) - ) , - 'end_event_adjust_interval' => array( + ] + ], + 'end_event_adjust_interval' => [ 'name' => 'end_event_adjust_interval', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('End Event Adjust Interval') , + 'title' => ts('End Event Adjust Interval'), 'description' => 'Status range ends this many units from end_event.', 'table_name' => 'civicrm_membership_status', 'entity' => 'MembershipStatus', 'bao' => 'CRM_Member_BAO_MembershipStatus', 'localizable' => 0, - ) , - 'is_current_member' => array( + ], + 'is_current_member' => [ 'name' => 'is_current_member', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Current Membership?') , + 'title' => ts('Current Membership?'), 'description' => 'Does this status aggregate to current members (e.g. New, Renewed, Grace might all be TRUE... while Unrenewed, Lapsed, Inactive would be FALSE).', 'table_name' => 'civicrm_membership_status', 'entity' => 'MembershipStatus', 'bao' => 'CRM_Member_BAO_MembershipStatus', 'localizable' => 0, - ) , - 'is_admin' => array( + ], + 'is_admin' => [ 'name' => 'is_admin', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Admin Assigned Only?') , + 'title' => ts('Admin Assigned Only?'), 'description' => 'Is this status for admin/manual assignment only.', 'table_name' => 'civicrm_membership_status', 'entity' => 'MembershipStatus', 'bao' => 'CRM_Member_BAO_MembershipStatus', 'localizable' => 0, - ) , - 'weight' => array( + ], + 'weight' => [ 'name' => 'weight', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Order') , + 'title' => ts('Order'), 'table_name' => 'civicrm_membership_status', 'entity' => 'MembershipStatus', 'bao' => 'CRM_Member_BAO_MembershipStatus', 'localizable' => 0, - ) , - 'is_default' => array( + ], + 'is_default' => [ 'name' => 'is_default', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Default Status?') , + 'title' => ts('Default Status?'), 'description' => 'Assign this status to a membership record if no other status match is found.', 'table_name' => 'civicrm_membership_status', 'entity' => 'MembershipStatus', 'bao' => 'CRM_Member_BAO_MembershipStatus', 'localizable' => 0, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Active') , + 'title' => ts('Is Active'), 'description' => 'Is this membership_status enabled.', 'default' => '1', 'table_name' => 'civicrm_membership_status', 'entity' => 'MembershipStatus', 'bao' => 'CRM_Member_BAO_MembershipStatus', 'localizable' => 0, - ) , - 'is_reserved' => array( + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Reserved') , + 'title' => ts('Is Reserved'), 'description' => 'Is this membership_status reserved.', 'table_name' => 'civicrm_membership_status', 'entity' => 'MembershipStatus', 'bao' => 'CRM_Member_BAO_MembershipStatus', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -386,10 +383,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_status', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_status', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -397,15 +395,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_status', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_status', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Member/DAO/MembershipType.php b/CRM/Member/DAO/MembershipType.php index 3077ceba0fa0..177dcccedc62 100644 --- a/CRM/Member/DAO/MembershipType.php +++ b/CRM/Member/DAO/MembershipType.php @@ -1,29 +1,5 @@ __table = 'civicrm_membership_type'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'member_of_contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'member_of_contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Type ID') , + 'title' => ts('Membership Type ID'), 'description' => 'Membership Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_membership_type', 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, - ) , - 'domain_id' => array( + ], + 'domain_id' => [ 'name' => 'domain_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Type Domain') , + 'title' => ts('Membership Type Domain'), 'description' => 'Which Domain is this match entry for', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_membership_type', 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Domain', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'membership_type' => array( + ] + ], + 'membership_type' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Membership Type') , + 'title' => ts('Membership Type'), 'description' => 'Name of Membership Type', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_membership_type.name', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_membership_type', 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 1, - ) , - 'description' => array( + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Membership Type Description') , + 'title' => ts('Membership Type Description'), 'description' => 'Description of Membership Type', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -260,57 +258,57 @@ static function &fields() { 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'member_of_contact_id' => array( + ], + ], + 'member_of_contact_id' => [ 'name' => 'member_of_contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Type Organization') , + 'title' => ts('Membership Type Organization'), 'description' => 'Owner organization for this membership type. FK to Contact ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_membership_type', 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'financial_type_id' => array( + ], + 'financial_type_id' => [ 'name' => 'financial_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Financial Type') , + 'title' => ts('Membership Financial Type'), 'description' => 'If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_membership_type', 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_FinancialType', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'minimum_fee' => array( + ] + ], + 'minimum_fee' => [ 'name' => 'minimum_fee', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('membership Type Minimum Fee') , + 'title' => ts('membership Type Minimum Fee'), 'description' => 'Minimum fee for this membership (0 for free/complimentary memberships).', - 'precision' => array( + 'precision' => [ 18, 9 - ) , + ], 'table_name' => 'civicrm_membership_type', 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, - ) , - 'duration_unit' => array( + ], + 'duration_unit' => [ 'name' => 'duration_unit', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Membership Type Duration Unit') , + 'title' => ts('Membership Type Duration Unit'), 'description' => 'Unit in which membership period is expressed.', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -318,27 +316,27 @@ static function &fields() { 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::membershipTypeUnitList', - ) - ) , - 'duration_interval' => array( + ] + ], + 'duration_interval' => [ 'name' => 'duration_interval', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Type Duration Interval') , + 'title' => ts('Membership Type Duration Interval'), 'description' => 'Number of duration units in membership period (e.g. 1 year, 12 months).', 'table_name' => 'civicrm_membership_type', 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, - ) , - 'period_type' => array( + ], + 'period_type' => [ 'name' => 'period_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Membership Type Plan') , + 'title' => ts('Membership Type Plan'), 'description' => 'Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -346,34 +344,34 @@ static function &fields() { 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::periodType', - ) - ) , - 'fixed_period_start_day' => array( + ] + ], + 'fixed_period_start_day' => [ 'name' => 'fixed_period_start_day', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Fixed Period Start Day') , + 'title' => ts('Fixed Period Start Day'), 'description' => 'For fixed period memberships, month and day (mmdd) on which subscription/membership will start. Period start is back-dated unless after rollover day.', 'table_name' => 'civicrm_membership_type', 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, - ) , - 'fixed_period_rollover_day' => array( + ], + 'fixed_period_rollover_day' => [ 'name' => 'fixed_period_rollover_day', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Fixed Period Rollover Day') , + 'title' => ts('Fixed Period Rollover Day'), 'description' => 'For fixed period memberships, signups after this day (mmdd) rollover to next period.', 'table_name' => 'civicrm_membership_type', 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, - ) , - 'relationship_type_id' => array( + ], + 'relationship_type_id' => [ 'name' => 'relationship_type_id', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Membership Type Relationship') , + 'title' => ts('Membership Type Relationship'), 'description' => 'FK to Relationship Type ID', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -381,58 +379,58 @@ static function &fields() { 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, - ) , - 'relationship_direction' => array( + ], + 'relationship_direction' => [ 'name' => 'relationship_direction', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Relationship Direction') , + 'title' => ts('Relationship Direction'), 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_membership_type', 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, - ) , - 'max_related' => array( + ], + 'max_related' => [ 'name' => 'max_related', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Max Related Members for Type') , + 'title' => ts('Max Related Members for Type'), 'description' => 'Maximum number of related memberships.', 'table_name' => 'civicrm_membership_type', 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, - ) , - 'visibility' => array( + ], + 'visibility' => [ 'name' => 'visibility', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Visible') , + 'title' => ts('Visible'), 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_membership_type', 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::memberVisibility', - ) - ) , - 'weight' => array( + ] + ], + 'weight' => [ 'name' => 'weight', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Order') , + 'title' => ts('Order'), 'table_name' => 'civicrm_membership_type', 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, - ) , - 'receipt_text_signup' => array( + ], + 'receipt_text_signup' => [ 'name' => 'receipt_text_signup', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Membership Type Receipt Text') , + 'title' => ts('Membership Type Receipt Text'), 'description' => 'Receipt Text for membership signup', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -440,14 +438,14 @@ static function &fields() { 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'receipt_text_renewal' => array( + ], + ], + 'receipt_text_renewal' => [ 'name' => 'receipt_text_renewal', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Membership Type Renewal Text') , + 'title' => ts('Membership Type Renewal Text'), 'description' => 'Receipt Text for membership renewal', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -455,67 +453,71 @@ static function &fields() { 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'auto_renew' => array( + ], + ], + 'auto_renew' => [ 'name' => 'auto_renew', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Auto Renew') , + 'title' => ts('Auto Renew'), 'description' => '0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;', 'table_name' => 'civicrm_membership_type', 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::memberAutoRenew', - ) - ) , - 'is_active' => array( + ] + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Active') , + 'title' => ts('Is Active'), 'description' => 'Is this membership_type enabled', 'default' => '1', 'table_name' => 'civicrm_membership_type', 'entity' => 'MembershipType', 'bao' => 'CRM_Member_BAO_MembershipType', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -523,10 +525,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_type', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_type', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -534,24 +537,30 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_type', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_type', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_relationship_type_id' => array( + $indices = [ + 'index_relationship_type_id' => [ 'name' => 'index_relationship_type_id', - 'field' => array( + 'field' => [ 0 => 'relationship_type_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_membership_type::0::relationship_type_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/PCP/DAO/PCP.php b/CRM/PCP/DAO/PCP.php index 7ea180c19d5b..623651863cba 100644 --- a/CRM/PCP/DAO/PCP.php +++ b/CRM/PCP/DAO/PCP.php @@ -1,29 +1,5 @@ __table = 'civicrm_pcp'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'pcp_id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'pcp_id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Personal Campaign Page ID') , + 'title' => ts('Personal Campaign Page ID'), 'description' => 'Personal Campaign Page ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_pcp', 'entity' => 'PCP', 'bao' => 'CRM_PCP_BAO_PCP', 'localizable' => 0, - ) , - 'pcp_contact_id' => array( + ], + 'pcp_contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'FK to Contact ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_pcp', 'entity' => 'PCP', 'bao' => 'CRM_PCP_BAO_PCP', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'EntityRef', - ) , - ) , - 'status_id' => array( + ], + ], + 'status_id' => [ 'name' => 'status_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Personal Campaign Page Status') , - 'required' => true, + 'title' => ts('Personal Campaign Page Status'), + 'required' => TRUE, 'table_name' => 'civicrm_pcp', 'entity' => 'PCP', 'bao' => 'CRM_PCP_BAO_PCP', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'pcp_status', 'optionEditPath' => 'civicrm/admin/options/pcp_status', - ) - ) , - 'title' => array( + ] + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Personal Campaign Page Title') , + 'title' => ts('Personal Campaign Page Title'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'default' => 'NULL', @@ -222,40 +211,40 @@ static function &fields() { 'entity' => 'PCP', 'bao' => 'CRM_PCP_BAO_PCP', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'intro_text' => array( + ], + ], + 'intro_text' => [ 'name' => 'intro_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Intro Text') , + 'title' => ts('Intro Text'), 'default' => 'NULL', 'table_name' => 'civicrm_pcp', 'entity' => 'PCP', 'bao' => 'CRM_PCP_BAO_PCP', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'page_text' => array( + ], + ], + 'page_text' => [ 'name' => 'page_text', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Page Text') , + 'title' => ts('Page Text'), 'default' => 'NULL', 'table_name' => 'civicrm_pcp', 'entity' => 'PCP', 'bao' => 'CRM_PCP_BAO_PCP', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'donate_link_text' => array( + ], + ], + 'donate_link_text' => [ 'name' => 'donate_link_text', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Donate Link Text') , + 'title' => ts('Donate Link Text'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'default' => 'NULL', @@ -263,25 +252,25 @@ static function &fields() { 'entity' => 'PCP', 'bao' => 'CRM_PCP_BAO_PCP', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'page_id' => array( + ], + ], + 'page_id' => [ 'name' => 'page_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contribution Page') , + 'title' => ts('Contribution Page'), 'description' => 'The Contribution or Event Page which triggered this pcp', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_pcp', 'entity' => 'PCP', 'bao' => 'CRM_PCP_BAO_PCP', 'localizable' => 0, - ) , - 'page_type' => array( + ], + 'page_type' => [ 'name' => 'page_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('PCP Page Type') , + 'title' => ts('PCP Page Type'), 'description' => 'The type of PCP this is: contribute or event', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -290,66 +279,66 @@ static function &fields() { 'entity' => 'PCP', 'bao' => 'CRM_PCP_BAO_PCP', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - ) , - 'pcp_block_id' => array( + ], + ], + 'pcp_block_id' => [ 'name' => 'pcp_block_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('PCP Block') , + 'title' => ts('PCP Block'), 'description' => 'The pcp block that this pcp page was created from', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_pcp', 'entity' => 'PCP', 'bao' => 'CRM_PCP_BAO_PCP', 'localizable' => 0, - ) , - 'is_thermometer' => array( + ], + 'is_thermometer' => [ 'name' => 'is_thermometer', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Use Thermometer?') , + 'title' => ts('Use Thermometer?'), 'table_name' => 'civicrm_pcp', 'entity' => 'PCP', 'bao' => 'CRM_PCP_BAO_PCP', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'is_honor_roll' => array( + ], + ], + 'is_honor_roll' => [ 'name' => 'is_honor_roll', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Show Honor Roll?') , + 'title' => ts('Show Honor Roll?'), 'table_name' => 'civicrm_pcp', 'entity' => 'PCP', 'bao' => 'CRM_PCP_BAO_PCP', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'goal_amount' => array( + ], + ], + 'goal_amount' => [ 'name' => 'goal_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Goal Amount') , + 'title' => ts('Goal Amount'), 'description' => 'Goal amount of this Personal Campaign Page.', - 'precision' => array( + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_pcp', 'entity' => 'PCP', 'bao' => 'CRM_PCP_BAO_PCP', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'currency' => array( + ], + ], + 'currency' => [ 'name' => 'currency', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Currency') , + 'title' => ts('Currency'), 'description' => '3 character string, value from config setting or input via user.', 'maxlength' => 3, 'size' => CRM_Utils_Type::FOUR, @@ -358,75 +347,79 @@ static function &fields() { 'entity' => 'PCP', 'bao' => 'CRM_PCP_BAO_PCP', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_currency', 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ) - ) , - 'is_active' => array( + ] + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Enabled?') , + 'title' => ts('Enabled?'), 'description' => 'Is Personal Campaign Page enabled/active?', 'table_name' => 'civicrm_pcp', 'entity' => 'PCP', 'bao' => 'CRM_PCP_BAO_PCP', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'is_notify' => array( + ], + ], + 'is_notify' => [ 'name' => 'is_notify', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Notify Owner?') , + 'title' => ts('Notify Owner?'), 'description' => 'Notify owner via email when someone donates to page?', 'table_name' => 'civicrm_pcp', 'entity' => 'PCP', 'bao' => 'CRM_PCP_BAO_PCP', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - ); + ], + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -434,10 +427,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pcp', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pcp', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -445,15 +439,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pcp', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pcp', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/PCP/DAO/PCPBlock.php b/CRM/PCP/DAO/PCPBlock.php index f3a4f7a7c24e..b68880302e84 100644 --- a/CRM/PCP/DAO/PCPBlock.php +++ b/CRM/PCP/DAO/PCPBlock.php @@ -1,29 +1,5 @@ __table = 'civicrm_pcp_block'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'supporter_profile_id', 'civicrm_uf_group', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'target_entity_id', NULL, 'id', 'target_entity_type'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'supporter_profile_id', 'civicrm_uf_group', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'target_entity_id', NULL, 'id', 'target_entity_type'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('PCP Block ID') , + 'title' => ts('PCP Block ID'), 'description' => 'PCP block Id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_pcp_block', 'entity' => 'PCPBlock', 'bao' => 'CRM_PCP_BAO_PCPBlock', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Table') , + 'title' => ts('Entity Table'), 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_pcp_block', 'entity' => 'PCPBlock', 'bao' => 'CRM_PCP_BAO_PCPBlock', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity') , + 'title' => ts('Entity'), 'description' => 'FK to civicrm_contribution_page.id OR civicrm_event.id', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_pcp_block', 'entity' => 'PCPBlock', 'bao' => 'CRM_PCP_BAO_PCPBlock', 'localizable' => 0, - ) , - 'target_entity_type' => array( + ], + 'target_entity_type' => [ 'name' => 'target_entity_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Target Entity') , + 'title' => ts('Target Entity'), 'description' => 'The type of entity that this pcp targets', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'default' => 'contribute', @@ -204,22 +196,22 @@ static function &fields() { 'entity' => 'PCPBlock', 'bao' => 'CRM_PCP_BAO_PCPBlock', 'localizable' => 0, - ) , - 'target_entity_id' => array( + ], + 'target_entity_id' => [ 'name' => 'target_entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Target Entity ID') , + 'title' => ts('Target Entity ID'), 'description' => 'The entity that this pcp targets', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_pcp_block', 'entity' => 'PCPBlock', 'bao' => 'CRM_PCP_BAO_PCPBlock', 'localizable' => 0, - ) , - 'supporter_profile_id' => array( + ], + 'supporter_profile_id' => [ 'name' => 'supporter_profile_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Supporter Profile') , + 'title' => ts('Supporter Profile'), 'description' => 'FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?', 'default' => 'NULL', 'table_name' => 'civicrm_pcp_block', @@ -227,61 +219,61 @@ static function &fields() { 'bao' => 'CRM_PCP_BAO_PCPBlock', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_UFGroup', - ) , - 'owner_notify_id' => array( + ], + 'owner_notify_id' => [ 'name' => 'owner_notify_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Owner Notification') , + 'title' => ts('Owner Notification'), 'description' => 'FK to civicrm_option_group with name = PCP owner notifications', 'table_name' => 'civicrm_pcp_block', 'entity' => 'PCPBlock', 'bao' => 'CRM_PCP_BAO_PCPBlock', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Radio', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'pcp_owner_notify', 'optionEditPath' => 'civicrm/admin/options/pcp_owner_notify', - ) - ) , - 'is_approval_needed' => array( + ] + ], + 'is_approval_needed' => [ 'name' => 'is_approval_needed', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Approval Required?') , + 'title' => ts('Approval Required?'), 'description' => 'Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?', 'default' => 'NULL', 'table_name' => 'civicrm_pcp_block', 'entity' => 'PCPBlock', 'bao' => 'CRM_PCP_BAO_PCPBlock', 'localizable' => 0, - ) , - 'is_tellfriend_enabled' => array( + ], + 'is_tellfriend_enabled' => [ 'name' => 'is_tellfriend_enabled', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Tell a Friend Enabled?') , + 'title' => ts('Tell a Friend Enabled?'), 'description' => 'Does Personal Campaign Page allow using tell a friend?', 'default' => 'NULL', 'table_name' => 'civicrm_pcp_block', 'entity' => 'PCPBlock', 'bao' => 'CRM_PCP_BAO_PCPBlock', 'localizable' => 0, - ) , - 'tellfriend_limit' => array( + ], + 'tellfriend_limit' => [ 'name' => 'tellfriend_limit', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Tell A Friend Limit') , + 'title' => ts('Tell A Friend Limit'), 'description' => 'Maximum recipient fields allowed in tell a friend', 'default' => 'NULL', 'table_name' => 'civicrm_pcp_block', 'entity' => 'PCPBlock', 'bao' => 'CRM_PCP_BAO_PCPBlock', 'localizable' => 0, - ) , - 'link_text' => array( + ], + 'link_text' => [ 'name' => 'link_text', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Link Text') , + 'title' => ts('Link Text'), 'description' => 'Link text for PCP.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -290,22 +282,22 @@ static function &fields() { 'entity' => 'PCPBlock', 'bao' => 'CRM_PCP_BAO_PCPBlock', 'localizable' => 1, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Enabled?') , + 'title' => ts('Enabled?'), 'description' => 'Is Personal Campaign Page Block enabled/active?', 'default' => '1', 'table_name' => 'civicrm_pcp_block', 'entity' => 'PCPBlock', 'bao' => 'CRM_PCP_BAO_PCPBlock', 'localizable' => 0, - ) , - 'notify_email' => array( + ], + 'notify_email' => [ 'name' => 'notify_email', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Notification Email') , + 'title' => ts('Notification Email'), 'description' => 'If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -314,40 +306,44 @@ static function &fields() { 'entity' => 'PCPBlock', 'bao' => 'CRM_PCP_BAO_PCPBlock', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -355,10 +351,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pcp_block', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pcp_block', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -366,15 +363,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pcp_block', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pcp_block', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Pledge/DAO/Pledge.php b/CRM/Pledge/DAO/Pledge.php index d63802f49bc9..3badb084b992 100644 --- a/CRM/Pledge/DAO/Pledge.php +++ b/CRM/Pledge/DAO/Pledge.php @@ -1,29 +1,5 @@ __table = 'civicrm_pledge'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_page_id', 'civicrm_contribution_page', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_page_id', 'civicrm_contribution_page', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'pledge_id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'pledge_id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Pledge ID') , + 'title' => ts('Pledge ID'), 'description' => 'Pledge ID', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_pledge.id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - ) , - 'pledge_contact_id' => array( + ], + 'pledge_contact_id' => [ 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contact ID') , + 'title' => ts('Contact ID'), 'description' => 'Foreign key to civicrm_contact.id .', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_pledge.contact_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - 'html' => array( + 'html' => [ 'type' => 'EntityRef', - ) , - ) , - 'pledge_financial_type_id' => array( + ], + ], + 'pledge_financial_type_id' => [ 'name' => 'financial_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Type') , + 'title' => ts('Type'), 'description' => 'FK to Financial Type', 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_FinancialType', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'pledge_contribution_page_id' => array( + ] + ], + 'pledge_contribution_page_id' => [ 'name' => 'contribution_page_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Pledge Contribution Page') , + 'title' => ts('Pledge Contribution Page'), 'description' => 'The Contribution Page which triggered this contribution', 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage', - ) , - 'pledge_amount' => array( + ], + 'pledge_amount' => [ 'name' => 'amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Total Pledged') , + 'title' => ts('Total Pledged'), 'description' => 'Total pledged amount.', - 'required' => true, - 'precision' => array( + 'required' => TRUE, + 'precision' => [ 20, 2 - ) , - 'import' => true, + ], + 'import' => TRUE, 'where' => 'civicrm_pledge.amount', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'pledge_original_installment_amount' => array( + ], + ], + 'pledge_original_installment_amount' => [ 'name' => 'original_installment_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Original Installment Amount') , + 'title' => ts('Original Installment Amount'), 'description' => 'Original amount for each of the installments.', - 'required' => true, - 'precision' => array( + 'required' => TRUE, + 'precision' => [ 20, 2 - ) , - 'export' => true, + ], + 'export' => TRUE, 'where' => 'civicrm_pledge.original_installment_amount', 'headerPattern' => '', 'dataPattern' => '', @@ -326,14 +328,14 @@ static function &fields() { 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'currency' => array( + ], + ], + 'currency' => [ 'name' => 'currency', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Pledge Currency') , + 'title' => ts('Pledge Currency'), 'description' => '3 character string, value from config setting or input via user.', 'maxlength' => 3, 'size' => CRM_Utils_Type::FOUR, @@ -342,20 +344,20 @@ static function &fields() { 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_currency', 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ) - ) , - 'pledge_frequency_unit' => array( + ] + ], + 'pledge_frequency_unit' => [ 'name' => 'frequency_unit', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Pledge Frequency Unit') , + 'title' => ts('Pledge Frequency Unit'), 'description' => 'Time units for recurrence of pledge payments.', 'maxlength' => 8, 'size' => CRM_Utils_Type::EIGHT, @@ -364,51 +366,51 @@ static function &fields() { 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'recur_frequency_units', 'keyColumn' => 'name', 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units', - ) - ) , - 'pledge_frequency_interval' => array( + ] + ], + 'pledge_frequency_interval' => [ 'name' => 'frequency_interval', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Pledge Frequency Interval') , + 'title' => ts('Pledge Frequency Interval'), 'description' => 'Number of time units for recurrence of pledge payments.', - 'required' => true, + 'required' => TRUE, 'default' => '1', 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'frequency_day' => array( + ], + ], + 'frequency_day' => [ 'name' => 'frequency_day', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Pledge day') , + 'title' => ts('Pledge day'), 'description' => 'Day in the period when the pledge payment is due e.g. 1st of month, 15th etc. Use this to set the scheduled dates for pledge payments.', - 'required' => true, + 'required' => TRUE, 'default' => '3', 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - ) , - 'installments' => array( + ], + ], + 'installments' => [ 'name' => 'installments', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Pledge Number of Installments') , + 'title' => ts('Pledge Number of Installments'), 'description' => 'Total number of payments to be made.', - 'export' => true, + 'export' => TRUE, 'where' => 'civicrm_pledge.installments', 'headerPattern' => '', 'dataPattern' => '', @@ -417,227 +419,231 @@ static function &fields() { 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'start_date' => array( + ], + ], + 'start_date' => [ 'name' => 'start_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Pledge Start Date') , + 'title' => ts('Pledge Start Date'), 'description' => 'The date the first scheduled pledge occurs.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'pledge_create_date' => array( + ], + ], + 'pledge_create_date' => [ 'name' => 'create_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Pledge Made') , + 'title' => ts('Pledge Made'), 'description' => 'When this pledge record was created.', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_pledge.create_date', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'acknowledge_date' => array( + ], + ], + 'acknowledge_date' => [ 'name' => 'acknowledge_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Pledge Acknowledged') , + 'title' => ts('Pledge Acknowledged'), 'description' => 'When a pledge acknowledgement message was sent to the contributor.', 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'modified_date' => array( + ], + ], + 'modified_date' => [ 'name' => 'modified_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Pledge Modified Date') , + 'title' => ts('Pledge Modified Date'), 'description' => 'Last updated date for this pledge record.', 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - ) , - 'cancel_date' => array( + ], + 'cancel_date' => [ 'name' => 'cancel_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Pledge Cancelled Date') , + 'title' => ts('Pledge Cancelled Date'), 'description' => 'Date this pledge was cancelled by contributor.', 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'end_date' => array( + ], + ], + 'end_date' => [ 'name' => 'end_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Pledge End Date') , + 'title' => ts('Pledge End Date'), 'description' => 'Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).', 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'max_reminders' => array( + ], + ], + 'max_reminders' => [ 'name' => 'max_reminders', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Maximum Number of Reminders') , + 'title' => ts('Maximum Number of Reminders'), 'description' => 'The maximum number of payment reminders to send for any given payment.', 'default' => '1', 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'initial_reminder_day' => array( + ], + ], + 'initial_reminder_day' => [ 'name' => 'initial_reminder_day', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Initial Reminder Day') , + 'title' => ts('Initial Reminder Day'), 'description' => 'Send initial reminder this many days prior to the payment due date.', 'default' => '5', 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - ) , - 'additional_reminder_day' => array( + ], + ], + 'additional_reminder_day' => [ 'name' => 'additional_reminder_day', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Additional Reminder Days') , + 'title' => ts('Additional Reminder Days'), 'description' => 'Send additional reminder this many days after last one sent, up to maximum number of reminders.', 'default' => '5', 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'pledge_status_id' => array( + ], + ], + 'pledge_status_id' => [ 'name' => 'status_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Pledge Status Id') , + 'title' => ts('Pledge Status Id'), 'description' => 'Implicit foreign key to civicrm_option_values in the pledge_status option group.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_pledge.status_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => false, + 'export' => FALSE, 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'pledge_status', 'optionEditPath' => 'civicrm/admin/options/pledge_status', - ) - ) , - 'pledge_is_test' => array( + ] + ], + 'pledge_is_test' => [ 'name' => 'is_test', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Test') , - 'import' => true, + 'title' => ts('Test'), + 'import' => TRUE, 'where' => 'civicrm_pledge.is_test', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'pledge_campaign_id' => array( + ], + ], + 'pledge_campaign_id' => [ 'name' => 'campaign_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Campaign') , + 'title' => ts('Campaign'), 'description' => 'The campaign for which this pledge has been initiated.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_pledge.campaign_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, 'FKClassName' => 'CRM_Campaign_DAO_Campaign', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -645,10 +651,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -656,24 +663,30 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_status' => array( + $indices = [ + 'index_status' => [ 'name' => 'index_status', - 'field' => array( + 'field' => [ 0 => 'status_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_pledge::0::status_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Pledge/DAO/PledgeBlock.php b/CRM/Pledge/DAO/PledgeBlock.php index e6cfa9fdcef2..794bbc04a7f2 100644 --- a/CRM/Pledge/DAO/PledgeBlock.php +++ b/CRM/Pledge/DAO/PledgeBlock.php @@ -1,29 +1,5 @@ __table = 'civicrm_pledge_block'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Pledge Block ID') , + 'title' => ts('Pledge Block ID'), 'description' => 'Pledge ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_pledge_block', 'entity' => 'PledgeBlock', 'bao' => 'CRM_Pledge_BAO_PledgeBlock', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Table') , + 'title' => ts('Entity Table'), 'description' => 'physical tablename for entity being joined to pledge, e.g. civicrm_contact', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -167,22 +158,22 @@ static function &fields() { 'entity' => 'PledgeBlock', 'bao' => 'CRM_Pledge_BAO_PledgeBlock', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity Id') , + 'title' => ts('Entity Id'), 'description' => 'FK to entity table specified in entity_table column.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_pledge_block', 'entity' => 'PledgeBlock', 'bao' => 'CRM_Pledge_BAO_PledgeBlock', 'localizable' => 0, - ) , - 'pledge_frequency_unit' => array( + ], + 'pledge_frequency_unit' => [ 'name' => 'pledge_frequency_unit', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Pledge Frequency Unit') , + 'title' => ts('Pledge Frequency Unit'), 'description' => 'Delimited list of supported frequency units', 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, @@ -191,54 +182,54 @@ static function &fields() { 'bao' => 'CRM_Pledge_BAO_PledgeBlock', 'localizable' => 0, 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED, - ) , - 'is_pledge_interval' => array( + ], + 'is_pledge_interval' => [ 'name' => 'is_pledge_interval', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Expose Frequency Interval?') , + 'title' => ts('Expose Frequency Interval?'), 'description' => 'Is frequency interval exposed on the contribution form.', 'table_name' => 'civicrm_pledge_block', 'entity' => 'PledgeBlock', 'bao' => 'CRM_Pledge_BAO_PledgeBlock', 'localizable' => 0, - ) , - 'max_reminders' => array( + ], + 'max_reminders' => [ 'name' => 'max_reminders', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Maximum Number of Reminders') , + 'title' => ts('Maximum Number of Reminders'), 'description' => 'The maximum number of payment reminders to send for any given payment.', 'default' => '1', 'table_name' => 'civicrm_pledge_block', 'entity' => 'PledgeBlock', 'bao' => 'CRM_Pledge_BAO_PledgeBlock', 'localizable' => 0, - ) , - 'initial_reminder_day' => array( + ], + 'initial_reminder_day' => [ 'name' => 'initial_reminder_day', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Initial Reminder Day') , + 'title' => ts('Initial Reminder Day'), 'description' => 'Send initial reminder this many days prior to the payment due date.', 'default' => '5', 'table_name' => 'civicrm_pledge_block', 'entity' => 'PledgeBlock', 'bao' => 'CRM_Pledge_BAO_PledgeBlock', 'localizable' => 0, - ) , - 'additional_reminder_day' => array( + ], + 'additional_reminder_day' => [ 'name' => 'additional_reminder_day', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Additional Reminder Days') , + 'title' => ts('Additional Reminder Days'), 'description' => 'Send additional reminder this many days after last one sent, up to maximum number of reminders.', 'default' => '5', 'table_name' => 'civicrm_pledge_block', 'entity' => 'PledgeBlock', 'bao' => 'CRM_Pledge_BAO_PledgeBlock', 'localizable' => 0, - ) , - 'pledge_start_date' => array( + ], + 'pledge_start_date' => [ 'name' => 'pledge_start_date', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Pledge Start Date') , + 'title' => ts('Pledge Start Date'), 'description' => 'The date the first scheduled pledge occurs.', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -246,62 +237,66 @@ static function &fields() { 'entity' => 'PledgeBlock', 'bao' => 'CRM_Pledge_BAO_PledgeBlock', 'localizable' => 0, - ) , - 'is_pledge_start_date_visible' => array( + ], + 'is_pledge_start_date_visible' => [ 'name' => 'is_pledge_start_date_visible', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Show Recurring Donation Start Date?') , + 'title' => ts('Show Recurring Donation Start Date?'), 'description' => 'If true - recurring start date is shown.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_pledge_block', 'entity' => 'PledgeBlock', 'bao' => 'CRM_Pledge_BAO_PledgeBlock', 'localizable' => 0, - ) , - 'is_pledge_start_date_editable' => array( + ], + 'is_pledge_start_date_editable' => [ 'name' => 'is_pledge_start_date_editable', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Allow Edits to Recurring Donation Start Date?') , + 'title' => ts('Allow Edits to Recurring Donation Start Date?'), 'description' => 'If true - recurring start date is editable.', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_pledge_block', 'entity' => 'PledgeBlock', 'bao' => 'CRM_Pledge_BAO_PledgeBlock', 'localizable' => 0, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -309,10 +304,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge_block', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge_block', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -320,25 +316,31 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge_block', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge_block', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_entity' => array( + $indices = [ + 'index_entity' => [ 'name' => 'index_entity', - 'field' => array( + 'field' => [ 0 => 'entity_table', 1 => 'entity_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_pledge_block::0::entity_table::entity_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Pledge/DAO/PledgePayment.php b/CRM/Pledge/DAO/PledgePayment.php index c51fc033dfe7..120177e5238e 100644 --- a/CRM/Pledge/DAO/PledgePayment.php +++ b/CRM/Pledge/DAO/PledgePayment.php @@ -1,29 +1,5 @@ __table = 'civicrm_pledge_payment'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'pledge_id', 'civicrm_pledge', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_id', 'civicrm_contribution', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'pledge_id', 'civicrm_pledge', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_id', 'civicrm_contribution', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'pledge_payment_id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'pledge_payment_id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Payment ID') , - 'required' => true, - 'import' => true, + 'title' => ts('Payment ID'), + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_pledge_payment.id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_pledge_payment', 'entity' => 'PledgePayment', 'bao' => 'CRM_Pledge_BAO_PledgePayment', 'localizable' => 0, - ) , - 'pledge_id' => array( + ], + 'pledge_id' => [ 'name' => 'pledge_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Pledge') , + 'title' => ts('Pledge'), 'description' => 'FK to Pledge table', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_pledge_payment', 'entity' => 'PledgePayment', 'bao' => 'CRM_Pledge_BAO_PledgePayment', 'localizable' => 0, 'FKClassName' => 'CRM_Pledge_DAO_Pledge', - ) , - 'contribution_id' => array( + ], + 'contribution_id' => [ 'name' => 'contribution_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Contribution') , + 'title' => ts('Contribution'), 'description' => 'FK to contribution table.', 'table_name' => 'civicrm_pledge_payment', 'entity' => 'PledgePayment', 'bao' => 'CRM_Pledge_BAO_PledgePayment', 'localizable' => 0, 'FKClassName' => 'CRM_Contribute_DAO_Contribution', - ) , - 'pledge_payment_scheduled_amount' => array( + ], + 'pledge_payment_scheduled_amount' => [ 'name' => 'scheduled_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Scheduled Amount') , + 'title' => ts('Scheduled Amount'), 'description' => 'Pledged amount for this payment (the actual contribution amount might be different).', - 'required' => true, - 'precision' => array( + 'required' => TRUE, + 'precision' => [ 20, 2 - ) , - 'import' => true, + ], + 'import' => TRUE, 'where' => 'civicrm_pledge_payment.scheduled_amount', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_pledge_payment', 'entity' => 'PledgePayment', 'bao' => 'CRM_Pledge_BAO_PledgePayment', 'localizable' => 0, - ) , - 'pledge_payment_actual_amount' => array( + ], + 'pledge_payment_actual_amount' => [ 'name' => 'actual_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Actual Amount') , + 'title' => ts('Actual Amount'), 'description' => 'Actual amount that is paid as the Pledged installment amount.', - 'precision' => array( + 'precision' => [ 20, 2 - ) , - 'import' => true, + ], + 'import' => TRUE, 'where' => 'civicrm_pledge_payment.actual_amount', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_pledge_payment', 'entity' => 'PledgePayment', 'bao' => 'CRM_Pledge_BAO_PledgePayment', 'localizable' => 0, - ) , - 'currency' => array( + ], + 'currency' => [ 'name' => 'currency', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Currency') , + 'title' => ts('Currency'), 'description' => '3 character string, value from config setting or input via user.', 'maxlength' => 3, 'size' => CRM_Utils_Type::FOUR, @@ -227,113 +215,117 @@ static function &fields() { 'entity' => 'PledgePayment', 'bao' => 'CRM_Pledge_BAO_PledgePayment', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_currency', 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ) - ) , - 'pledge_payment_scheduled_date' => array( + ] + ], + 'pledge_payment_scheduled_date' => [ 'name' => 'scheduled_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Scheduled Date') , + 'title' => ts('Scheduled Date'), 'description' => 'The date the pledge payment is supposed to happen.', - 'required' => true, - 'import' => true, + 'required' => TRUE, + 'import' => TRUE, 'where' => 'civicrm_pledge_payment.scheduled_date', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_pledge_payment', 'entity' => 'PledgePayment', 'bao' => 'CRM_Pledge_BAO_PledgePayment', 'localizable' => 0, - ) , - 'pledge_payment_reminder_date' => array( + ], + 'pledge_payment_reminder_date' => [ 'name' => 'reminder_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Last Reminder') , + 'title' => ts('Last Reminder'), 'description' => 'The date that the most recent payment reminder was sent.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_pledge_payment.reminder_date', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_pledge_payment', 'entity' => 'PledgePayment', 'bao' => 'CRM_Pledge_BAO_PledgePayment', 'localizable' => 0, - ) , - 'pledge_payment_reminder_count' => array( + ], + 'pledge_payment_reminder_count' => [ 'name' => 'reminder_count', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Reminders Sent') , + 'title' => ts('Reminders Sent'), 'description' => 'The number of payment reminders sent.', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_pledge_payment.reminder_count', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_pledge_payment', 'entity' => 'PledgePayment', 'bao' => 'CRM_Pledge_BAO_PledgePayment', 'localizable' => 0, - ) , - 'pledge_payment_status_id' => array( + ], + 'pledge_payment_status_id' => [ 'name' => 'status_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Payment Status') , - 'import' => true, + 'title' => ts('Payment Status'), + 'import' => TRUE, 'where' => 'civicrm_pledge_payment.status_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => false, + 'export' => FALSE, 'table_name' => 'civicrm_pledge_payment', 'entity' => 'PledgePayment', 'bao' => 'CRM_Pledge_BAO_PledgePayment', 'localizable' => 0, - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'optionGroupName' => 'contribution_status', 'optionEditPath' => 'civicrm/admin/options/contribution_status', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -341,10 +333,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge_payment', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge_payment', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -352,33 +345,39 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge_payment', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge_payment', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_contribution_pledge' => array( + $indices = [ + 'index_contribution_pledge' => [ 'name' => 'index_contribution_pledge', - 'field' => array( + 'field' => [ 0 => 'contribution_id', 1 => 'pledge_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_pledge_payment::0::contribution_id::pledge_id', - ) , - 'index_status' => array( + ], + 'index_status' => [ 'name' => 'index_status', - 'field' => array( + 'field' => [ 0 => 'status_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_pledge_payment::0::status_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Price/DAO/LineItem.php b/CRM/Price/DAO/LineItem.php index 2f05c853d160..905b47099ffd 100644 --- a/CRM/Price/DAO/LineItem.php +++ b/CRM/Price/DAO/LineItem.php @@ -1,29 +1,5 @@ __table = 'civicrm_line_item'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_id', 'civicrm_contribution', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'price_field_id', 'civicrm_price_field', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'price_field_value_id', 'civicrm_price_field_value', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_id', 'civicrm_contribution', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'price_field_id', 'civicrm_price_field', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'price_field_value_id', 'civicrm_price_field_value', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Line Item ID') , + 'title' => ts('Line Item ID'), 'description' => 'Line Item', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_line_item', 'entity' => 'LineItem', 'bao' => 'CRM_Price_BAO_LineItem', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Line Item Entity Type') , + 'title' => ts('Line Item Entity Type'), 'description' => 'table which has the transaction', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_line_item', 'entity' => 'LineItem', 'bao' => 'CRM_Price_BAO_LineItem', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Line Item Entity') , + 'title' => ts('Line Item Entity'), 'description' => 'entry in table', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_line_item', 'entity' => 'LineItem', 'bao' => 'CRM_Price_BAO_LineItem', 'localizable' => 0, - ) , - 'contribution_id' => array( + ], + 'contribution_id' => [ 'name' => 'contribution_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Line Item Contribution') , + 'title' => ts('Line Item Contribution'), 'description' => 'FK to civicrm_contribution', 'table_name' => 'civicrm_line_item', 'entity' => 'LineItem', 'bao' => 'CRM_Price_BAO_LineItem', 'localizable' => 0, 'FKClassName' => 'CRM_Contribute_DAO_Contribution', - ) , - 'price_field_id' => array( + ], + 'price_field_id' => [ 'name' => 'price_field_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Line Item Price Field') , + 'title' => ts('Line Item Price Field'), 'description' => 'FK to civicrm_price_field', 'table_name' => 'civicrm_line_item', 'entity' => 'LineItem', 'bao' => 'CRM_Price_BAO_LineItem', 'localizable' => 0, 'FKClassName' => 'CRM_Price_DAO_PriceField', - ) , - 'label' => array( + ], + 'label' => [ 'name' => 'label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Line Item Label') , + 'title' => ts('Line Item Label'), 'description' => 'descriptive label for item - from price_field_value.label', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -236,79 +230,79 @@ static function &fields() { 'entity' => 'LineItem', 'bao' => 'CRM_Price_BAO_LineItem', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'qty' => array( + ], + ], + 'qty' => [ 'name' => 'qty', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Line Item Quantity') , + 'title' => ts('Line Item Quantity'), 'description' => 'How many items ordered', - 'required' => true, - 'precision' => array( + 'required' => TRUE, + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_line_item', 'entity' => 'LineItem', 'bao' => 'CRM_Price_BAO_LineItem', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'unit_price' => array( + ], + ], + 'unit_price' => [ 'name' => 'unit_price', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Unit Price') , + 'title' => ts('Unit Price'), 'description' => 'price of each item', - 'required' => true, - 'precision' => array( + 'required' => TRUE, + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_line_item', 'entity' => 'LineItem', 'bao' => 'CRM_Price_BAO_LineItem', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'line_total' => array( + ], + ], + 'line_total' => [ 'name' => 'line_total', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Line Item Total') , + 'title' => ts('Line Item Total'), 'description' => 'qty * unit_price', - 'required' => true, - 'precision' => array( + 'required' => TRUE, + 'precision' => [ 20, 2 - ) , + ], 'table_name' => 'civicrm_line_item', 'entity' => 'LineItem', 'bao' => 'CRM_Price_BAO_LineItem', 'localizable' => 0, - ) , - 'participant_count' => array( + ], + 'participant_count' => [ 'name' => 'participant_count', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Line Item Participant Count') , + 'title' => ts('Line Item Participant Count'), 'description' => 'Participant count for field', 'default' => 'NULL', 'table_name' => 'civicrm_line_item', 'entity' => 'LineItem', 'bao' => 'CRM_Price_BAO_LineItem', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'price_field_value_id' => array( + ], + ], + 'price_field_value_id' => [ 'name' => 'price_field_value_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Line Item Option') , + 'title' => ts('Line Item Option'), 'description' => 'FK to civicrm_price_field_value', 'default' => 'NULL', 'table_name' => 'civicrm_line_item', @@ -316,11 +310,11 @@ static function &fields() { 'bao' => 'CRM_Price_BAO_LineItem', 'localizable' => 0, 'FKClassName' => 'CRM_Price_DAO_PriceFieldValue', - ) , - 'financial_type_id' => array( + ], + 'financial_type_id' => [ 'name' => 'financial_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Type') , + 'title' => ts('Financial Type'), 'description' => 'FK to Financial Type.', 'default' => 'NULL', 'table_name' => 'civicrm_line_item', @@ -328,89 +322,93 @@ static function &fields() { 'bao' => 'CRM_Price_BAO_LineItem', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_FinancialType', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'non_deductible_amount' => array( + ] + ], + 'non_deductible_amount' => [ 'name' => 'non_deductible_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Non-deductible Amount') , + 'title' => ts('Non-deductible Amount'), 'description' => 'Portion of total amount which is NOT tax deductible.', - 'required' => true, - 'precision' => array( + 'required' => TRUE, + 'precision' => [ 20, 2 - ) , + ], 'default' => '0.0', 'table_name' => 'civicrm_line_item', 'entity' => 'LineItem', 'bao' => 'CRM_Price_BAO_LineItem', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'tax_amount' => array( + ], + ], + 'tax_amount' => [ 'name' => 'tax_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Tax Amount') , + 'title' => ts('Tax Amount'), 'description' => 'tax of each item', - 'precision' => array( + 'precision' => [ 20, 2 - ) , - 'import' => true, + ], + 'import' => TRUE, 'where' => 'civicrm_line_item.tax_amount', 'headerPattern' => '/tax(.?am(ou)?nt)?/i', 'dataPattern' => '/^\d+(\.\d{2})?$/', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_line_item', 'entity' => 'LineItem', 'bao' => 'CRM_Price_BAO_LineItem', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - ); + ], + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -418,10 +416,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'line_item', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'line_item', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -429,38 +428,44 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'line_item', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'line_item', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_entity' => array( + $indices = [ + 'index_entity' => [ 'name' => 'index_entity', - 'field' => array( + 'field' => [ 0 => 'entity_table', 1 => 'entity_id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_line_item::0::entity_table::entity_id', - ) , - 'UI_line_item_value' => array( + ], + 'UI_line_item_value' => [ 'name' => 'UI_line_item_value', - 'field' => array( + 'field' => [ 0 => 'entity_table', 1 => 'entity_id', 2 => 'contribution_id', 3 => 'price_field_value_id', 4 => 'price_field_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_line_item::1::entity_table::entity_id::contribution_id::price_field_value_id::price_field_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Price/DAO/PriceField.php b/CRM/Price/DAO/PriceField.php index b9af981d7956..f3749ea0522f 100644 --- a/CRM/Price/DAO/PriceField.php +++ b/CRM/Price/DAO/PriceField.php @@ -1,29 +1,5 @@ 1) * * @var boolean */ public $is_required; + /** * If non-zero, do not show this field before the date specified * * @var datetime */ public $active_on; + /** * If non-zero, do not show this field after the date specified * * @var datetime */ public $expire_on; + /** * Optional scripting attributes for field * * @var string */ public $javascript; + /** * Implicit FK to civicrm_option_group with name = 'visibility' * * @var int unsigned */ public $visibility_id; + /** * Class constructor. */ - function __construct() { + public function __construct() { $this->__table = 'civicrm_price_field'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'price_set_id', 'civicrm_price_set', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'price_set_id', 'civicrm_price_set', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Price Field ID') , + 'title' => ts('Price Field ID'), 'description' => 'Price Field', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_price_field', 'entity' => 'PriceField', 'bao' => 'CRM_Price_BAO_PriceField', 'localizable' => 0, - ) , - 'price_set_id' => array( + ], + 'price_set_id' => [ 'name' => 'price_set_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Price Set') , + 'title' => ts('Price Set'), 'description' => 'FK to civicrm_price_set', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_price_field', 'entity' => 'PriceField', 'bao' => 'CRM_Price_BAO_PriceField', 'localizable' => 0, 'FKClassName' => 'CRM_Price_DAO_PriceSet', - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Name') , + 'title' => ts('Name'), 'description' => 'Variable name/programmatic handle for this field.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_price_field', 'entity' => 'PriceField', 'bao' => 'CRM_Price_BAO_PriceField', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'label' => array( + ], + ], + 'label' => [ 'name' => 'label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Label') , + 'title' => ts('Label'), 'description' => 'Text for form field label (also friendly name for administering this field).', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_price_field', 'entity' => 'PriceField', 'bao' => 'CRM_Price_BAO_PriceField', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'html_type' => array( + ], + ], + 'html_type' => [ 'name' => 'html_type', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Html Type') , - 'required' => true, + 'title' => ts('Html Type'), + 'required' => TRUE, 'maxlength' => 12, 'size' => CRM_Utils_Type::TWELVE, 'table_name' => 'civicrm_price_field', 'entity' => 'PriceField', 'bao' => 'CRM_Price_BAO_PriceField', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'callback' => 'CRM_Price_BAO_PriceField::htmlTypes', - ) - ) , - 'is_enter_qty' => array( + ] + ], + 'is_enter_qty' => [ 'name' => 'is_enter_qty', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Price Field Quantity Required?') , + 'title' => ts('Price Field Quantity Required?'), 'description' => 'Enter a quantity for this field?', 'table_name' => 'civicrm_price_field', 'entity' => 'PriceField', 'bao' => 'CRM_Price_BAO_PriceField', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'help_pre' => array( + ], + ], + 'help_pre' => [ 'name' => 'help_pre', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Price Field Pre Text') , + 'title' => ts('Price Field Pre Text'), 'description' => 'Description and/or help text to display before this field.', 'rows' => 4, 'cols' => 80, @@ -277,14 +273,14 @@ static function &fields() { 'entity' => 'PriceField', 'bao' => 'CRM_Price_BAO_PriceField', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'help_post' => array( + ], + ], + 'help_post' => [ 'name' => 'help_post', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Price Field Post Text') , + 'title' => ts('Price Field Post Text'), 'description' => 'Description and/or help text to display after this field.', 'rows' => 4, 'cols' => 80, @@ -292,112 +288,112 @@ static function &fields() { 'entity' => 'PriceField', 'bao' => 'CRM_Price_BAO_PriceField', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'weight' => array( + ], + ], + 'weight' => [ 'name' => 'weight', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Order') , + 'title' => ts('Order'), 'description' => 'Order in which the fields should appear', 'default' => '1', 'table_name' => 'civicrm_price_field', 'entity' => 'PriceField', 'bao' => 'CRM_Price_BAO_PriceField', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - ) , - 'is_display_amounts' => array( + ], + ], + 'is_display_amounts' => [ 'name' => 'is_display_amounts', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Price Field Show Amounts?') , + 'title' => ts('Price Field Show Amounts?'), 'description' => 'Should the price be displayed next to the label for each option?', 'default' => '1', 'table_name' => 'civicrm_price_field', 'entity' => 'PriceField', 'bao' => 'CRM_Price_BAO_PriceField', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'options_per_line' => array( + ], + ], + 'options_per_line' => [ 'name' => 'options_per_line', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Price Field Options per Row') , + 'title' => ts('Price Field Options per Row'), 'description' => 'number of options per line for checkbox and radio', 'default' => '1', 'table_name' => 'civicrm_price_field', 'entity' => 'PriceField', 'bao' => 'CRM_Price_BAO_PriceField', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'is_active' => array( + ], + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Price Field Is Active?') , + 'title' => ts('Price Field Is Active?'), 'description' => 'Is this price field active', 'default' => '1', 'table_name' => 'civicrm_price_field', 'entity' => 'PriceField', 'bao' => 'CRM_Price_BAO_PriceField', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'is_required' => array( + ], + ], + 'is_required' => [ 'name' => 'is_required', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Price Field is Required?') , + 'title' => ts('Price Field is Required?'), 'description' => 'Is this price field required (value must be > 1)', 'default' => '1', 'table_name' => 'civicrm_price_field', 'entity' => 'PriceField', 'bao' => 'CRM_Price_BAO_PriceField', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'active_on' => array( + ], + ], + 'active_on' => [ 'name' => 'active_on', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Price Field Start Date') , + 'title' => ts('Price Field Start Date'), 'description' => 'If non-zero, do not show this field before the date specified', 'default' => 'NULL', 'table_name' => 'civicrm_price_field', 'entity' => 'PriceField', 'bao' => 'CRM_Price_BAO_PriceField', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'expire_on' => array( + ], + ], + 'expire_on' => [ 'name' => 'expire_on', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Price Field End Date') , + 'title' => ts('Price Field End Date'), 'description' => 'If non-zero, do not show this field after the date specified', 'default' => 'NULL', 'table_name' => 'civicrm_price_field', 'entity' => 'PriceField', 'bao' => 'CRM_Price_BAO_PriceField', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'javascript' => array( + ], + ], + 'javascript' => [ 'name' => 'javascript', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Price Field Javascript') , + 'title' => ts('Price Field Javascript'), 'description' => 'Optional scripting attributes for field', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -405,61 +401,65 @@ static function &fields() { 'entity' => 'PriceField', 'bao' => 'CRM_Price_BAO_PriceField', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'visibility_id' => array( + ], + ], + 'visibility_id' => [ 'name' => 'visibility_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Price Field Visibility') , + 'title' => ts('Price Field Visibility'), 'description' => 'Implicit FK to civicrm_option_group with name = \'visibility\'', 'default' => '1', 'table_name' => 'civicrm_price_field', 'entity' => 'PriceField', 'bao' => 'CRM_Price_BAO_PriceField', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'visibility', 'optionEditPath' => 'civicrm/admin/options/visibility', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -467,10 +467,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_field', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_field', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -478,24 +479,30 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_field', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_field', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_name' => array( + $indices = [ + 'index_name' => [ 'name' => 'index_name', - 'field' => array( + 'field' => [ 0 => 'name', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_price_field::0::name', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Price/DAO/PriceFieldValue.php b/CRM/Price/DAO/PriceFieldValue.php index fb0465b855a2..3526b30c3235 100644 --- a/CRM/Price/DAO/PriceFieldValue.php +++ b/CRM/Price/DAO/PriceFieldValue.php @@ -1,29 +1,5 @@ Price field option description. * * @var text */ public $description; + /** * Price field option pre help text. * * @var text */ public $help_pre; + /** * Price field option post field help. * * @var text */ public $help_post; + /** * Price field option amount * * @var float */ public $amount; + /** * Number of participants per field option * * @var int unsigned */ public $count; + /** * Max number of participants per field options * * @var int unsigned */ public $max_value; + /** * Order in which the field options should appear * * @var int */ public $weight; + /** * FK to Membership Type * * @var int unsigned */ public $membership_type_id; + /** * Number of terms for this membership * * @var int unsigned */ public $membership_num_terms; + /** * Is this default price field option * * @var boolean */ public $is_default; + /** * Is this price field value active * * @var boolean */ public $is_active; + /** * FK to Financial Type. * * @var int unsigned */ public $financial_type_id; + /** * Portion of total amount which is NOT tax deductible. * * @var float */ public $non_deductible_amount; + /** * Implicit FK to civicrm_option_group with name = 'visibility' * * @var int unsigned */ public $visibility_id; + /** * Class constructor. */ - function __construct() { + public function __construct() { $this->__table = 'civicrm_price_field_value'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'price_field_id', 'civicrm_price_field', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_type_id', 'civicrm_membership_type', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'price_field_id', 'civicrm_price_field', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'membership_type_id', 'civicrm_membership_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Price Field Value ID') , + 'title' => ts('Price Field Value ID'), 'description' => 'Price Field Value', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_price_field_value', 'entity' => 'PriceFieldValue', 'bao' => 'CRM_Price_BAO_PriceFieldValue', 'localizable' => 0, - ) , - 'price_field_id' => array( + ], + 'price_field_id' => [ 'name' => 'price_field_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Price Field') , + 'title' => ts('Price Field'), 'description' => 'FK to civicrm_price_field', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_price_field_value', 'entity' => 'PriceFieldValue', 'bao' => 'CRM_Price_BAO_PriceFieldValue', 'localizable' => 0, 'FKClassName' => 'CRM_Price_DAO_PriceField', - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Name') , + 'title' => ts('Name'), 'description' => 'Price field option name', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -223,14 +221,14 @@ static function &fields() { 'entity' => 'PriceFieldValue', 'bao' => 'CRM_Price_BAO_PriceFieldValue', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'label' => array( + ], + ], + 'label' => [ 'name' => 'label', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Label') , + 'title' => ts('Label'), 'description' => 'Price field option label', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -238,14 +236,14 @@ static function &fields() { 'entity' => 'PriceFieldValue', 'bao' => 'CRM_Price_BAO_PriceFieldValue', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'description' => array( + ], + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Description') , + 'title' => ts('Description'), 'description' => '>Price field option description.', 'rows' => 2, 'cols' => 60, @@ -254,14 +252,14 @@ static function &fields() { 'entity' => 'PriceFieldValue', 'bao' => 'CRM_Price_BAO_PriceFieldValue', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'help_pre' => array( + ], + ], + 'help_pre' => [ 'name' => 'help_pre', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Help Pre') , + 'title' => ts('Help Pre'), 'description' => 'Price field option pre help text.', 'rows' => 2, 'cols' => 60, @@ -270,14 +268,14 @@ static function &fields() { 'entity' => 'PriceFieldValue', 'bao' => 'CRM_Price_BAO_PriceFieldValue', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'help_post' => array( + ], + ], + 'help_post' => [ 'name' => 'help_post', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Help Post') , + 'title' => ts('Help Post'), 'description' => 'Price field option post field help.', 'rows' => 2, 'cols' => 60, @@ -286,74 +284,74 @@ static function &fields() { 'entity' => 'PriceFieldValue', 'bao' => 'CRM_Price_BAO_PriceFieldValue', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'amount' => array( + ], + ], + 'amount' => [ 'name' => 'amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Amount') , + 'title' => ts('Amount'), 'description' => 'Price field option amount', - 'required' => true, - 'precision' => array( + 'required' => TRUE, + 'precision' => [ 18, 9 - ) , + ], 'table_name' => 'civicrm_price_field_value', 'entity' => 'PriceFieldValue', 'bao' => 'CRM_Price_BAO_PriceFieldValue', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'count' => array( + ], + ], + 'count' => [ 'name' => 'count', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Count') , + 'title' => ts('Count'), 'description' => 'Number of participants per field option', 'default' => 'NULL', 'table_name' => 'civicrm_price_field_value', 'entity' => 'PriceFieldValue', 'bao' => 'CRM_Price_BAO_PriceFieldValue', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'max_value' => array( + ], + ], + 'max_value' => [ 'name' => 'max_value', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Max Value') , + 'title' => ts('Max Value'), 'description' => 'Max number of participants per field options', 'default' => 'NULL', 'table_name' => 'civicrm_price_field_value', 'entity' => 'PriceFieldValue', 'bao' => 'CRM_Price_BAO_PriceFieldValue', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'weight' => array( + ], + ], + 'weight' => [ 'name' => 'weight', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Order') , + 'title' => ts('Order'), 'description' => 'Order in which the field options should appear', 'default' => '1', 'table_name' => 'civicrm_price_field_value', 'entity' => 'PriceFieldValue', 'bao' => 'CRM_Price_BAO_PriceFieldValue', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'membership_type_id' => array( + ], + ], + 'membership_type_id' => [ 'name' => 'membership_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Type') , + 'title' => ts('Membership Type'), 'description' => 'FK to Membership Type', 'default' => 'NULL', 'table_name' => 'civicrm_price_field_value', @@ -361,52 +359,52 @@ static function &fields() { 'bao' => 'CRM_Price_BAO_PriceFieldValue', 'localizable' => 0, 'FKClassName' => 'CRM_Member_DAO_MembershipType', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - ) , - 'membership_num_terms' => array( + ], + ], + 'membership_num_terms' => [ 'name' => 'membership_num_terms', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Membership Num Terms') , + 'title' => ts('Membership Num Terms'), 'description' => 'Number of terms for this membership', 'default' => 'NULL', 'table_name' => 'civicrm_price_field_value', 'entity' => 'PriceFieldValue', 'bao' => 'CRM_Price_BAO_PriceFieldValue', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'is_default' => array( + ], + ], + 'is_default' => [ 'name' => 'is_default', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Default Price Field Option?') , + 'title' => ts('Is Default Price Field Option?'), 'description' => 'Is this default price field option', 'table_name' => 'civicrm_price_field_value', 'entity' => 'PriceFieldValue', 'bao' => 'CRM_Price_BAO_PriceFieldValue', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'is_active' => array( + ], + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Price Field Value is Active') , + 'title' => ts('Price Field Value is Active'), 'description' => 'Is this price field value active', 'default' => '1', 'table_name' => 'civicrm_price_field_value', 'entity' => 'PriceFieldValue', 'bao' => 'CRM_Price_BAO_PriceFieldValue', 'localizable' => 0, - ) , - 'financial_type_id' => array( + ], + 'financial_type_id' => [ 'name' => 'financial_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Type') , + 'title' => ts('Financial Type'), 'description' => 'FK to Financial Type.', 'default' => 'NULL', 'table_name' => 'civicrm_price_field_value', @@ -414,85 +412,89 @@ static function &fields() { 'bao' => 'CRM_Price_BAO_PriceFieldValue', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_FinancialType', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'non_deductible_amount' => array( + ] + ], + 'non_deductible_amount' => [ 'name' => 'non_deductible_amount', 'type' => CRM_Utils_Type::T_MONEY, - 'title' => ts('Non-deductible Amount') , + 'title' => ts('Non-deductible Amount'), 'description' => 'Portion of total amount which is NOT tax deductible.', - 'required' => true, - 'precision' => array( + 'required' => TRUE, + 'precision' => [ 20, 2 - ) , + ], 'default' => '0.0', 'table_name' => 'civicrm_price_field_value', 'entity' => 'PriceFieldValue', 'bao' => 'CRM_Price_BAO_PriceFieldValue', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'visibility_id' => array( + ], + ], + 'visibility_id' => [ 'name' => 'visibility_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Price Field Option Visibility') , + 'title' => ts('Price Field Option Visibility'), 'description' => 'Implicit FK to civicrm_option_group with name = \'visibility\'', 'default' => '1', 'table_name' => 'civicrm_price_field_value', 'entity' => 'PriceFieldValue', 'bao' => 'CRM_Price_BAO_PriceFieldValue', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'optionGroupName' => 'visibility', 'optionEditPath' => 'civicrm/admin/options/visibility', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -500,10 +502,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_field_value', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_field_value', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -511,15 +514,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_field_value', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_field_value', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Price/DAO/PriceSet.php b/CRM/Price/DAO/PriceSet.php index e310a831a87c..5f9e11726c51 100644 --- a/CRM/Price/DAO/PriceSet.php +++ b/CRM/Price/DAO/PriceSet.php @@ -1,29 +1,5 @@ __table = 'civicrm_price_set'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Price Set ID') , + 'title' => ts('Price Set ID'), 'description' => 'Price Set', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_price_set', 'entity' => 'PriceSet', 'bao' => 'CRM_Price_BAO_PriceSet', 'localizable' => 0, - ) , - 'domain_id' => array( + ], + 'domain_id' => [ 'name' => 'domain_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Price Set Domain') , + 'title' => ts('Price Set Domain'), 'description' => 'Which Domain is this price-set for', 'table_name' => 'civicrm_price_set', 'entity' => 'PriceSet', 'bao' => 'CRM_Price_BAO_PriceSet', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Domain', - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'name' => array( + ] + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Name') , + 'title' => ts('Name'), 'description' => 'Variable name/programmatic handle for this set of price fields.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_price_set', 'entity' => 'PriceSet', 'bao' => 'CRM_Price_BAO_PriceSet', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'title' => array( + ], + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Price Set Title') , + 'title' => ts('Price Set Title'), 'description' => 'Displayed title for the Price Set.', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_price_set', 'entity' => 'PriceSet', 'bao' => 'CRM_Price_BAO_PriceSet', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'is_active' => array( + ], + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Price Set Is Active?') , + 'title' => ts('Price Set Is Active?'), 'description' => 'Is this price set active', 'default' => '1', 'table_name' => 'civicrm_price_set', 'entity' => 'PriceSet', 'bao' => 'CRM_Price_BAO_PriceSet', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'help_pre' => array( + ], + ], + 'help_pre' => [ 'name' => 'help_pre', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Price Set Pre Help') , + 'title' => ts('Price Set Pre Help'), 'description' => 'Description and/or help text to display before fields in form.', 'rows' => 4, 'cols' => 80, @@ -245,14 +238,14 @@ static function &fields() { 'entity' => 'PriceSet', 'bao' => 'CRM_Price_BAO_PriceSet', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'help_post' => array( + ], + ], + 'help_post' => [ 'name' => 'help_post', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Price Set Post Help') , + 'title' => ts('Price Set Post Help'), 'description' => 'Description and/or help text to display after fields in form.', 'rows' => 4, 'cols' => 80, @@ -260,14 +253,14 @@ static function &fields() { 'entity' => 'PriceSet', 'bao' => 'CRM_Price_BAO_PriceSet', 'localizable' => 1, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'javascript' => array( + ], + ], + 'javascript' => [ 'name' => 'javascript', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Price Set Javascript') , + 'title' => ts('Price Set Javascript'), 'description' => 'Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -275,35 +268,35 @@ static function &fields() { 'entity' => 'PriceSet', 'bao' => 'CRM_Price_BAO_PriceSet', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'extends' => array( + ], + ], + 'extends' => [ 'name' => 'extends', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Price Set Extends') , + 'title' => ts('Price Set Extends'), 'description' => 'What components are using this price set?', - 'required' => true, + 'required' => TRUE, 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_price_set', 'entity' => 'PriceSet', 'bao' => 'CRM_Price_BAO_PriceSet', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_component', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'financial_type_id' => array( + ] + ], + 'financial_type_id' => [ 'name' => 'financial_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Financial Type') , + 'title' => ts('Financial Type'), 'description' => 'FK to Financial Type(for membership price sets only).', 'default' => 'NULL', 'table_name' => 'civicrm_price_set', @@ -311,87 +304,91 @@ static function &fields() { 'bao' => 'CRM_Price_BAO_PriceSet', 'localizable' => 0, 'FKClassName' => 'CRM_Financial_DAO_FinancialType', - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - 'pseudoconstant' => array( + ], + 'pseudoconstant' => [ 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'is_quick_config' => array( + ] + ], + 'is_quick_config' => [ 'name' => 'is_quick_config', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is Price Set Quick Config?') , + 'title' => ts('Is Price Set Quick Config?'), 'description' => 'Is set if edited on Contribution or Event Page rather than through Manage Price Sets', 'table_name' => 'civicrm_price_set', 'entity' => 'PriceSet', 'bao' => 'CRM_Price_BAO_PriceSet', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'is_reserved' => array( + ], + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Price Set Is Reserved') , + 'title' => ts('Price Set Is Reserved'), 'description' => 'Is this a predefined system price set (i.e. it can not be deleted, edited)?', 'table_name' => 'civicrm_price_set', 'entity' => 'PriceSet', 'bao' => 'CRM_Price_BAO_PriceSet', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'min_amount' => array( + ], + ], + 'min_amount' => [ 'name' => 'min_amount', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Minimum Amount') , + 'title' => ts('Minimum Amount'), 'description' => 'Minimum Amount required for this set.', 'table_name' => 'civicrm_price_set', 'entity' => 'PriceSet', 'bao' => 'CRM_Price_BAO_PriceSet', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - ); + ], + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return CRM_Core_DAO::getLocaleTableName(self::$_tableName); } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -399,10 +396,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_set', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_set', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -410,25 +408,31 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_set', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_set', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_name' => array( + $indices = [ + 'UI_name' => [ 'name' => 'UI_name', - 'field' => array( + 'field' => [ 0 => 'name', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_price_set::1::name', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Price/DAO/PriceSetEntity.php b/CRM/Price/DAO/PriceSetEntity.php index 41da550b5546..4ce06aaef125 100644 --- a/CRM/Price/DAO/PriceSetEntity.php +++ b/CRM/Price/DAO/PriceSetEntity.php @@ -1,29 +1,5 @@ __table = 'civicrm_price_set_entity'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'price_set_id', 'civicrm_price_set', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'price_set_id', 'civicrm_price_set', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Price Set Entity ID') , + 'title' => ts('Price Set Entity ID'), 'description' => 'Price Set Entity', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_price_set_entity', 'entity' => 'PriceSetEntity', 'bao' => 'CRM_Price_DAO_PriceSetEntity', 'localizable' => 0, - ) , - 'entity_table' => array( + ], + 'entity_table' => [ 'name' => 'entity_table', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Entity Table') , + 'title' => ts('Entity Table'), 'description' => 'Table which uses this price set', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_price_set_entity', 'entity' => 'PriceSetEntity', 'bao' => 'CRM_Price_DAO_PriceSetEntity', 'localizable' => 0, - ) , - 'entity_id' => array( + ], + 'entity_id' => [ 'name' => 'entity_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Entity IF') , + 'title' => ts('Entity IF'), 'description' => 'Item in table', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_price_set_entity', 'entity' => 'PriceSetEntity', 'bao' => 'CRM_Price_DAO_PriceSetEntity', 'localizable' => 0, - ) , - 'price_set_id' => array( + ], + 'price_set_id' => [ 'name' => 'price_set_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Price Set') , + 'title' => ts('Price Set'), 'description' => 'price set being used', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_price_set_entity', 'entity' => 'PriceSetEntity', 'bao' => 'CRM_Price_DAO_PriceSetEntity', 'localizable' => 0, 'FKClassName' => 'CRM_Price_DAO_PriceSet', - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -191,10 +179,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_set_entity', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'price_set_entity', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -202,26 +191,32 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_set_entity', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'price_set_entity', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'UI_entity' => array( + $indices = [ + 'UI_entity' => [ 'name' => 'UI_entity', - 'field' => array( + 'field' => [ 0 => 'entity_table', 1 => 'entity_id', - ) , - 'localizable' => false, - 'unique' => true, + ], + 'localizable' => FALSE, + 'unique' => TRUE, 'sig' => 'civicrm_price_set_entity::1::entity_table::entity_id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Queue/DAO/QueueItem.php b/CRM/Queue/DAO/QueueItem.php index 90889d85e0b9..588b85df99e0 100644 --- a/CRM/Queue/DAO/QueueItem.php +++ b/CRM/Queue/DAO/QueueItem.php @@ -1,29 +1,5 @@ __table = 'civicrm_queue_item'; parent::__construct(); } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Queue ID') , - 'required' => true, + 'title' => ts('Queue ID'), + 'required' => TRUE, 'table_name' => 'civicrm_queue_item', 'entity' => 'QueueItem', 'bao' => 'CRM_Queue_BAO_QueueItem', 'localizable' => 0, - ) , - 'queue_name' => array( + ], + 'queue_name' => [ 'name' => 'queue_name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Queue Name') , + 'title' => ts('Queue Name'), 'description' => 'Name of the queue which includes this item', - 'required' => true, + 'required' => TRUE, 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, 'table_name' => 'civicrm_queue_item', 'entity' => 'QueueItem', 'bao' => 'CRM_Queue_BAO_QueueItem', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'weight' => array( + ], + ], + 'weight' => [ 'name' => 'weight', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Order') , - 'required' => true, + 'title' => ts('Order'), + 'required' => TRUE, 'table_name' => 'civicrm_queue_item', 'entity' => 'QueueItem', 'bao' => 'CRM_Queue_BAO_QueueItem', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'submit_time' => array( + ], + ], + 'submit_time' => [ 'name' => 'submit_time', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Submit Time') , + 'title' => ts('Submit Time'), 'description' => 'date on which this item was submitted to the queue', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_queue_item', 'entity' => 'QueueItem', 'bao' => 'CRM_Queue_BAO_QueueItem', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'release_time' => array( + ], + ], + 'release_time' => [ 'name' => 'release_time', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, - 'title' => ts('Release Time') , + 'title' => ts('Release Time'), 'description' => 'date on which this job becomes available; null if ASAP', 'table_name' => 'civicrm_queue_item', 'entity' => 'QueueItem', 'bao' => 'CRM_Queue_BAO_QueueItem', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select Date', - ) , - ) , - 'data' => array( + ], + ], + 'data' => [ 'name' => 'data', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Queue item data') , + 'title' => ts('Queue item data'), 'description' => 'Serialized queue data', 'table_name' => 'civicrm_queue_item', 'entity' => 'QueueItem', 'bao' => 'CRM_Queue_BAO_QueueItem', 'localizable' => 0, 'serialize' => self::SERIALIZE_PHP, - ) , - ); + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -216,10 +203,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'queue_item', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'queue_item', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -227,26 +215,32 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'queue_item', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'queue_item', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array( - 'index_queueids' => array( + $indices = [ + 'index_queueids' => [ 'name' => 'index_queueids', - 'field' => array( + 'field' => [ 0 => 'queue_name', 1 => 'weight', 2 => 'id', - ) , - 'localizable' => false, + ], + 'localizable' => FALSE, 'sig' => 'civicrm_queue_item::0::queue_name::weight::id', - ) , - ); + ], + ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/Report/DAO/ReportInstance.php b/CRM/Report/DAO/ReportInstance.php index 7ba08fad414a..4129b584ee51 100644 --- a/CRM/Report/DAO/ReportInstance.php +++ b/CRM/Report/DAO/ReportInstance.php @@ -1,29 +1,5 @@ __table = 'civicrm_report_instance'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'owner_id', 'civicrm_contact', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'navigation_id', 'civicrm_navigation', 'id'); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'drilldown_id', 'civicrm_report_instance', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'owner_id', 'civicrm_contact', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'navigation_id', 'civicrm_navigation', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'drilldown_id', 'civicrm_report_instance', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Report Instance ID') , + 'title' => ts('Report Instance ID'), 'description' => 'Report Instance ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_report_instance', 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, - ) , - 'domain_id' => array( + ], + 'domain_id' => [ 'name' => 'domain_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Report Instance Domain ID') , + 'title' => ts('Report Instance Domain ID'), 'description' => 'Which Domain is this instance for', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_report_instance', 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Domain', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - 'title' => array( + ] + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Report Instance Title') , + 'title' => ts('Report Instance Title'), 'description' => 'Report Instance Title.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -247,30 +247,30 @@ static function &fields() { 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'report_id' => array( + ], + ], + 'report_id' => [ 'name' => 'report_id', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Report template ID') , + 'title' => ts('Report template ID'), 'description' => 'FK to civicrm_option_value for the report template', - 'required' => true, + 'required' => TRUE, 'maxlength' => 512, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_report_instance', 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - ) , - 'name' => array( + ], + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Report instance Name') , + 'title' => ts('Report instance Name'), 'description' => 'when combined with report_id/template uniquely identifies the instance', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -278,14 +278,14 @@ static function &fields() { 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'args' => array( + ], + ], + 'args' => [ 'name' => 'args', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Report Instance Arguments') , + 'title' => ts('Report Instance Arguments'), 'description' => 'arguments that are passed in the url when invoking the instance', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -293,14 +293,14 @@ static function &fields() { 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'description' => array( + ], + ], + 'description' => [ 'name' => 'description', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Report Instance description') , + 'title' => ts('Report Instance description'), 'description' => 'Report Instance description.', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -308,14 +308,14 @@ static function &fields() { 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'permission' => array( + ], + ], + 'permission' => [ 'name' => 'permission', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Report Instance Permissions') , + 'title' => ts('Report Instance Permissions'), 'description' => 'permission required to be able to run this instance', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -323,14 +323,14 @@ static function &fields() { 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'grouprole' => array( + ], + ], + 'grouprole' => [ 'name' => 'grouprole', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Report Instance Assigned to Roles') , + 'title' => ts('Report Instance Assigned to Roles'), 'description' => 'role required to be able to run this instance', 'maxlength' => 1024, 'size' => CRM_Utils_Type::HUGE, @@ -338,65 +338,65 @@ static function &fields() { 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'form_values' => array( + ], + ], + 'form_values' => [ 'name' => 'form_values', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Submitted Form Values') , + 'title' => ts('Submitted Form Values'), 'description' => 'Submitted form values for this report', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_report_instance.form_values', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_report_instance', 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, 'serialize' => self::SERIALIZE_PHP, - ) , - 'is_active' => array( + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Report Instance is Active') , + 'title' => ts('Report Instance is Active'), 'description' => 'Is this entry active?', 'table_name' => 'civicrm_report_instance', 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'created_id' => array( + ], + ], + 'created_id' => [ 'name' => 'created_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Report Instance Created By') , + 'title' => ts('Report Instance Created By'), 'description' => 'FK to contact table.', 'table_name' => 'civicrm_report_instance', 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'owner_id' => array( + ], + 'owner_id' => [ 'name' => 'owner_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Report Instance Owned By') , + 'title' => ts('Report Instance Owned By'), 'description' => 'FK to contact table.', 'table_name' => 'civicrm_report_instance', 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', - ) , - 'email_subject' => array( + ], + 'email_subject' => [ 'name' => 'email_subject', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('Report Instance email Subject') , + 'title' => ts('Report Instance email Subject'), 'description' => 'Subject of email', 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, @@ -404,40 +404,40 @@ static function &fields() { 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'email_to' => array( + ], + ], + 'email_to' => [ 'name' => 'email_to', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Email Report Instance To') , + 'title' => ts('Email Report Instance To'), 'description' => 'comma-separated list of email addresses to send the report to', 'table_name' => 'civicrm_report_instance', 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'email_cc' => array( + ], + ], + 'email_cc' => [ 'name' => 'email_cc', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('cc Email Report Instance To') , + 'title' => ts('cc Email Report Instance To'), 'description' => 'comma-separated list of email addresses to send the report to', 'table_name' => 'civicrm_report_instance', 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'header' => array( + ], + ], + 'header' => [ 'name' => 'header', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Report Instance Header') , + 'title' => ts('Report Instance Header'), 'description' => 'comma-separated list of email addresses to send the report to', 'rows' => 4, 'cols' => 60, @@ -445,14 +445,14 @@ static function &fields() { 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'footer' => array( + ], + ], + 'footer' => [ 'name' => 'footer', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('Report Instance Footer') , + 'title' => ts('Report Instance Footer'), 'description' => 'comma-separated list of email addresses to send the report to', 'rows' => 4, 'cols' => 60, @@ -460,87 +460,91 @@ static function &fields() { 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'TextArea', - ) , - ) , - 'navigation_id' => array( + ], + ], + 'navigation_id' => [ 'name' => 'navigation_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Navigation ID') , + 'title' => ts('Navigation ID'), 'description' => 'FK to navigation ID', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_report_instance.navigation_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_report_instance', 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Navigation', - ) , - 'drilldown_id' => array( + ], + 'drilldown_id' => [ 'name' => 'drilldown_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Drilldown Report ID') , + 'title' => ts('Drilldown Report ID'), 'description' => 'FK to instance ID drilldown to', - 'import' => true, + 'import' => TRUE, 'where' => 'civicrm_report_instance.drilldown_id', 'headerPattern' => '', 'dataPattern' => '', - 'export' => true, + 'export' => TRUE, 'table_name' => 'civicrm_report_instance', 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, 'FKClassName' => 'CRM_Report_DAO_ReportInstance', - ) , - 'is_reserved' => array( + ], + 'is_reserved' => [ 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Instance is Reserved') , + 'title' => ts('Instance is Reserved'), 'table_name' => 'civicrm_report_instance', 'entity' => 'ReportInstance', 'bao' => 'CRM_Report_BAO_ReportInstance', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - ); + ], + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -548,10 +552,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'report_instance', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'report_instance', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -559,15 +564,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'report_instance', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'report_instance', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/CRM/SMS/DAO/Provider.php b/CRM/SMS/DAO/Provider.php index 732e619b0853..c2c7ebc368b5 100644 --- a/CRM/SMS/DAO/Provider.php +++ b/CRM/SMS/DAO/Provider.php @@ -1,29 +1,5 @@ __table = 'civicrm_sms_provider'; parent::__construct(); } + /** * Returns foreign keys and entity references. * * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() { + public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } return Civi::$statics[__CLASS__]['links']; } + /** * Returns all the column names of this table * * @return array */ - static function &fields() { + public static function &fields() { if (!isset(Civi::$statics[__CLASS__]['fields'])) { - Civi::$statics[__CLASS__]['fields'] = array( - 'id' => array( + Civi::$statics[__CLASS__]['fields'] = [ + 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('SMS Provider ID') , + 'title' => ts('SMS Provider ID'), 'description' => 'SMS Provider ID', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_sms_provider', 'entity' => 'Provider', 'bao' => 'CRM_SMS_BAO_Provider', 'localizable' => 0, - ) , - 'name' => array( + ], + 'name' => [ 'name' => 'name', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('SMS Provider Name') , + 'title' => ts('SMS Provider Name'), 'description' => 'Provider internal name points to option_value of option_group sms_provider_name', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -162,11 +148,11 @@ static function &fields() { 'entity' => 'Provider', 'bao' => 'CRM_SMS_BAO_Provider', 'localizable' => 0, - ) , - 'title' => array( + ], + 'title' => [ 'name' => 'title', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('SMS Provider Title') , + 'title' => ts('SMS Provider Title'), 'description' => 'Provider name visible to user', 'maxlength' => 64, 'size' => CRM_Utils_Type::BIG, @@ -174,152 +160,156 @@ static function &fields() { 'entity' => 'Provider', 'bao' => 'CRM_SMS_BAO_Provider', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'username' => array( + ], + ], + 'username' => [ 'name' => 'username', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('SMS Provider Username') , + 'title' => ts('SMS Provider Username'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_sms_provider', 'entity' => 'Provider', 'bao' => 'CRM_SMS_BAO_Provider', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'password' => array( + ], + ], + 'password' => [ 'name' => 'password', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('SMS Provider Password') , + 'title' => ts('SMS Provider Password'), 'maxlength' => 255, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_sms_provider', 'entity' => 'Provider', 'bao' => 'CRM_SMS_BAO_Provider', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'api_type' => array( + ], + ], + 'api_type' => [ 'name' => 'api_type', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('SMS Provider API') , + 'title' => ts('SMS Provider API'), 'description' => 'points to value in civicrm_option_value for group sms_api_type', - 'required' => true, + 'required' => TRUE, 'table_name' => 'civicrm_sms_provider', 'entity' => 'Provider', 'bao' => 'CRM_SMS_BAO_Provider', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Select', - ) , - ) , - 'api_url' => array( + ], + ], + 'api_url' => [ 'name' => 'api_url', 'type' => CRM_Utils_Type::T_STRING, - 'title' => ts('SMS Provider API URL') , + 'title' => ts('SMS Provider API URL'), 'maxlength' => 128, 'size' => CRM_Utils_Type::HUGE, 'table_name' => 'civicrm_sms_provider', 'entity' => 'Provider', 'bao' => 'CRM_SMS_BAO_Provider', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'api_params' => array( + ], + ], + 'api_params' => [ 'name' => 'api_params', 'type' => CRM_Utils_Type::T_TEXT, - 'title' => ts('SMS Provider API Params') , + 'title' => ts('SMS Provider API Params'), 'description' => 'the api params in xml, http or smtp format', 'table_name' => 'civicrm_sms_provider', 'entity' => 'Provider', 'bao' => 'CRM_SMS_BAO_Provider', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'Text', - ) , - ) , - 'is_default' => array( + ], + ], + 'is_default' => [ 'name' => 'is_default', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('SMS Provider is Default?') , + 'title' => ts('SMS Provider is Default?'), 'table_name' => 'civicrm_sms_provider', 'entity' => 'Provider', 'bao' => 'CRM_SMS_BAO_Provider', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'is_active' => array( + ], + ], + 'is_active' => [ 'name' => 'is_active', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('SMS Provider is Active?') , + 'title' => ts('SMS Provider is Active?'), 'table_name' => 'civicrm_sms_provider', 'entity' => 'Provider', 'bao' => 'CRM_SMS_BAO_Provider', 'localizable' => 0, - 'html' => array( + 'html' => [ 'type' => 'CheckBox', - ) , - ) , - 'domain_id' => array( + ], + ], + 'domain_id' => [ 'name' => 'domain_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('SMS Domain') , + 'title' => ts('SMS Domain'), 'description' => 'Which Domain is this sms provider for', 'table_name' => 'civicrm_sms_provider', 'entity' => 'Provider', 'bao' => 'CRM_SMS_BAO_Provider', 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Domain', - 'pseudoconstant' => array( + 'pseudoconstant' => [ 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ) - ) , - ); + ] + ], + ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); } return Civi::$statics[__CLASS__]['fields']; } + /** * Return a mapping from field-name to the corresponding key (as used in fields()). * * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys() { + public static function &fieldKeys() { if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); } return Civi::$statics[__CLASS__]['fieldKeys']; } + /** * Returns the names of this table * * @return string */ - static function getTableName() { + public static function getTableName() { return self::$_tableName; } + /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog() { + public function getLog() { return self::$_log; } + /** * Returns the list of fields that can be imported * @@ -327,10 +317,11 @@ function getLog() { * * @return array */ - static function &import($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'sms_provider', $prefix, array()); + public static function &import($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'sms_provider', $prefix, []); return $r; } + /** * Returns the list of fields that can be exported * @@ -338,15 +329,21 @@ static function &import($prefix = false) { * * @return array */ - static function &export($prefix = false) { - $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'sms_provider', $prefix, array()); + public static function &export($prefix = FALSE) { + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'sms_provider', $prefix, []); return $r; } + /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) { - $indices = array(); + $indices = []; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } + } diff --git a/xml/templates/dao.tpl b/xml/templates/dao.tpl index 4d7174d7ed40..d8e7b41dca1b 100644 --- a/xml/templates/dao.tpl +++ b/xml/templates/dao.tpl @@ -1,30 +1,4 @@ __table = '{$table.name}'; parent::__construct( ); @@ -84,7 +55,7 @@ class {$table.className} extends CRM_Core_DAO {ldelim} * @return array * [CRM_Core_Reference_Interface] */ - static function getReferenceColumns() {ldelim} + public static function getReferenceColumns() {ldelim} if (!isset(Civi::$statics[__CLASS__]['links'])) {ldelim} Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); {foreach from=$table.foreignKey item=foreign} @@ -105,9 +76,9 @@ class {$table.className} extends CRM_Core_DAO {ldelim} * * @return array */ - static function &fields( ) {ldelim} + public static function &fields( ) {ldelim} if ( ! isset(Civi::$statics[__CLASS__]['fields']) ) {ldelim} - Civi::$statics[__CLASS__]['fields'] = array ( + Civi::$statics[__CLASS__]['fields'] = array( {foreach from=$table.fields item=field} {if $field.uniqueName} @@ -125,7 +96,7 @@ class {$table.className} extends CRM_Core_DAO {ldelim} 'description' => '{$field.comment|replace:"'":"\'"}', {/if} {if $field.required} - 'required' => {$field.required}, + 'required' => {$field.required|strtoupper}, {/if} {* field.required *} {if $field.length} 'maxlength' => {$field.length}, @@ -144,13 +115,13 @@ class {$table.className} extends CRM_Core_DAO {ldelim} {/if} {* field.cols *} {if $field.import} - 'import' => {$field.import}, + 'import' => {$field.import|strtoupper}, 'where' => '{$table.name}.{$field.name}', 'headerPattern' => '{$field.headerPattern}', 'dataPattern' => '{$field.dataPattern}', {/if} {* field.import *} {if $field.export} - 'export' => {$field.export}, + 'export' => {$field.export|strtoupper}, {if ! $field.import} 'where' => '{$table.name}.{$field.name}', 'headerPattern' => '{$field.headerPattern}', @@ -175,22 +146,10 @@ class {$table.className} extends CRM_Core_DAO {ldelim} 'serialize' => self::SERIALIZE_{$field.serialize|strtoupper}, {/if} {if $field.html} - {assign var=htmlOptions value=$field.html} - 'html' => array( -{*{$htmlOptions|@print_array}*} - {foreach from=$htmlOptions key=optionKey item=optionValue} - '{$optionKey}' => '{$optionValue}', - {/foreach} - ), + 'html' => {$field.html|@print_array}, {/if} {* field.html *} {if $field.pseudoconstant} -{assign var=pseudoOptions value=$field.pseudoconstant} -'pseudoconstant' => array( -{*{$pseudoOptions|@print_array}*} -{foreach from=$pseudoOptions key=optionKey item=optionValue} - '{$optionKey}' => '{$optionValue}', -{/foreach} - ) + 'pseudoconstant' => {$field.pseudoconstant|@print_array} {/if} {* field.pseudoconstant *} ), {/foreach} {* table.fields *} ); @@ -205,7 +164,7 @@ class {$table.className} extends CRM_Core_DAO {ldelim} * @return array * Array(string $name => string $uniqueName). */ - static function &fieldKeys( ) {ldelim} + public static function &fieldKeys( ) {ldelim} if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {ldelim} Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); {rdelim} @@ -217,7 +176,7 @@ class {$table.className} extends CRM_Core_DAO {ldelim} * * @return string */ - static function getTableName( ) {ldelim} + public static function getTableName( ) {ldelim} {if $table.localizable} return CRM_Core_DAO::getLocaleTableName( self::$_tableName ); {else} @@ -228,9 +187,9 @@ class {$table.className} extends CRM_Core_DAO {ldelim} /** * Returns if this table needs to be logged * - * @return boolean + * @return bool */ - function getLog( ) {ldelim} + public function getLog( ) {ldelim} return self::$_log; {rdelim} @@ -241,7 +200,7 @@ class {$table.className} extends CRM_Core_DAO {ldelim} * * @return array */ - static function &import( $prefix = false ) {ldelim} + public static function &import( $prefix = FALSE ) {ldelim} $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, '{$table.labelName}', $prefix, array( {if $table.foreignKey}{foreach from=$table.foreignKey item=foreign} {if $foreign.import}'{$foreign.className}',{/if} @@ -257,7 +216,7 @@ class {$table.className} extends CRM_Core_DAO {ldelim} * * @return array */ - static function &export( $prefix = false ) {ldelim} + public static function &export( $prefix = FALSE ) {ldelim} $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, '{$table.labelName}', $prefix, array( {if $table.foreignKey}{foreach from=$table.foreignKey item=foreign} {if $foreign.export}'{$foreign.className}',{/if} @@ -268,9 +227,14 @@ class {$table.className} extends CRM_Core_DAO {ldelim} /** * Returns the list of indices + * + * @param bool $localize + * + * @return array */ public static function indices($localize = TRUE) {ldelim} $indices = {$indicesPhp}; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; {rdelim} + {rdelim}