Skip to content

Instantly share code, notes, and snippets.

@bickart
Last active Oct 9, 2015
Embed
What would you like to do?
SugarCRM Extension to added a Custom Index
<?php
/*
* Created on Aug 27, 2012
*
* Jeff Bickart
* @bickart
* NEPO Systems, LLC
*
* custom/Extension/application/Ext/TableDictionary/custom_indexes.php
*/
include('custom/metadata/custom_indexes.php');
?>
<?php
/*
* Created on Aug 27, 2012
*
* Jeff Bickart
* @bickart
* NEPO Systems, LLC
*
* custom/metadata/custom_indexes.php
*/
/* $repairedTables is a variable that gets defined in the repairDatabase.php program */
if (isset($repairedTables)) {
/* We have to tell the repairDatabases.php that we have not yet repaired our custom table
so that it can find custom indexes */
if (isset($repairedTables['module_cstm'])) {
unset($repairedTables['module_cstm']);
}
}
/* Define the index */
$dictionary["module_cstm"] = array(
'table' => 'module_cstm',
'fields' => //We can added fields here, we must at least have the id_c field
array(
0 =>
array(
'name' => 'id_c',
'type' => 'id',
),
),
'indices' => // our custom indexes go here
array(
0 =>
array(
'name' => 'custom_index_idx',
'type' => 'index',
'fields' =>
array(
0 => 'field_c',
),
),
),
);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment