* @var string
*/
static $_tableName = 'civicrm_navigation';
- /**
- * static instance to hold the field values
- *
- * @var array
- */
- static $_fields = null;
- /**
- * static instance to hold the keys used in $_fields for each field.
- *
- * @var array
- */
- static $_fieldKeys = null;
- /**
- * static instance to hold the FK relationships
- *
- * @var string
- */
- static $_links = null;
/**
* static value to see if we should log any modifications to
* this table in the civicrm_log table
* [CRM_Core_Reference_Interface]
*/
static function getReferenceColumns() {
- if (!self::$_links) {
- self::$_links = static ::createReferenceColumns(__CLASS__);
- self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
- self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_navigation', 'id');
+ 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');
+ CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
}
- return self::$_links;
+ return Civi::$statics[__CLASS__]['links'];
}
/**
* Returns all the column names of this table
* @return array
*/
static function &fields() {
- if (!(self::$_fields)) {
- self::$_fields = array(
+ if (!isset(Civi::$statics[__CLASS__]['fields'])) {
+ Civi::$statics[__CLASS__]['fields'] = array(
'id' => array(
'name' => 'id',
'type' => CRM_Utils_Type::T_INT,
'description' => 'Ordering of the navigation items in various blocks.',
) ,
);
+ CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
}
- return self::$_fields;
+ return Civi::$statics[__CLASS__]['fields'];
}
/**
- * Returns an array containing, for each field, the arary key used for that
- * field in self::$_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() {
- if (!(self::$_fieldKeys)) {
- self::$_fieldKeys = array(
- 'id' => 'id',
- 'domain_id' => 'domain_id',
- 'label' => 'label',
- 'name' => 'name',
- 'url' => 'url',
- 'permission' => 'permission',
- 'permission_operator' => 'permission_operator',
- 'parent_id' => 'parent_id',
- 'is_active' => 'is_active',
- 'has_separator' => 'has_separator',
- 'weight' => 'weight',
- );
+ if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
+ Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
}
- return self::$_fieldKeys;
+ return Civi::$statics[__CLASS__]['fieldKeys'];
}
/**
* Returns the names of this table