BUG-14636 New Functionality - To allow set index in tables SOLVED

- It don't have the functionality.
- A functionality was added in pmtables and reportTables index.
- A field was added in table fields FLD_TABLE_INDEX.
This commit is contained in:
Marco Antonio Nina
2014-09-10 13:34:39 -04:00
parent 2f5cbaaea9
commit d5babe7774
10 changed files with 505 additions and 230 deletions

View File

@@ -182,7 +182,7 @@ class PmTable
* Build the pmTable with all dependencies
*/
public function build ()
{
{
$this->prepare();
$this->preparePropelIniFile();
$this->buildSchema();
@@ -273,6 +273,10 @@ class PmTable
break;
}
$indexNode = $this->dom->createElement( 'index' );
$indexNode->setAttribute( 'name', 'indexTable' );
$flag = false;
foreach ($this->columns as $column) {
// create the column node
@@ -296,9 +300,20 @@ class PmTable
if ($column->field_autoincrement) {
$columnNode->setAttribute( 'autoIncrement', "true" );
}
// define the Index attribute if it is defined
if ($column->field_index) {
$columnNode->setAttribute( 'index', "true" );
$indexColumnNode = $this->dom->createElement( 'index-column' );
$indexColumnNode->setAttribute( 'name', $column->field_name );
$indexNode->appendChild( $indexColumnNode );
$flag = true;
}
$tableNode->appendChild( $columnNode );
}
if ($flag) {
$tableNode->appendChild( $indexNode );
}
$xpath = new DOMXPath( $this->dom );
$xtable = $xpath->query( '/database/table[@name="' . $this->tableName . '"]' );
@@ -377,7 +392,7 @@ class PmTable
* Save the xml schema for propel
*/
public function saveSchema ()
{
{
$this->dom->save( $this->configDir . $this->schemaFilename );
}