class Normalization

Set of functions used for normalization

Properties

Template $template

Methods

__construct(DatabaseInterface $dbi, Relation $relation, Transformations $transformations, Template $template)

Constructor

string
getHtmlForColumnsList(string $db, string $table, string $colTypeCategory = 'all', string $listType = 'dropdown')

build the html for columns of $colTypeCategory category in form of given $listType in a table

string
getHtmlForCreateNewColumn(integer $numFields, string $db, string $table, array $columnMeta = [])

get the html of the form to add the new column to given table

string
getHtmlFor1NFStep1(string $db, string $table, string $normalizedTo)

build the html for step 1.1 of normalization

string[]
getHtmlContentsFor1NFStep2(string $db, string $table)

build the html contents of various html elements in step 1.2

string[]
getHtmlContentsFor1NFStep4(string $db, string $table)

build the html contents of various html elements in step 1.4

string[]
getHtmlContentsFor1NFStep3(string $db, string $table)

build the html contents of various html elements in step 1.3

string[]
getHtmlFor2NFstep1(string $db, string $table)

build html contents for 2NF step 2.1

string
getHtmlForNewTables2NF(array $partialDependencies, string $table)

build the html for showing the tables to have in order to put current table in 2NF

array
createNewTablesFor2NF(array $partialDependencies, object $tablesName, string $table, string $db)

create/alter the tables needed for 2NF

array
getHtmlForNewTables3NF(object $dependencies, array $tables, string $db)

build the html for showing the new tables to have in order to put given tables in 3NF

array
createNewTablesFor3NF(array $newTables, string $db)

create new tables or alter existing to get 3NF

array
moveRepeatingGroup(string $repeatingColumns, string $primaryColumns, string $newTable, string $newColumn, string $table, string $db)

move the repeating group of columns to a new table

string[]
getHtmlFor3NFstep1(string $db, array $tables)

build html for 3NF step 1 to find the transitive dependencies

string
getHtmlForNormalizeTable()

get html for options to normalize table

string
findPartialDependencies(string $table, string $db)

find all the possible partial dependencies based on data in the table.

Details

at line 51
__construct(DatabaseInterface $dbi, Relation $relation, Transformations $transformations, Template $template)

Constructor

Parameters

DatabaseInterface $dbi DatabaseInterface instance
Relation $relation Relation instance
Transformations $transformations Transformations instance
Template $template Template instance

at line 71
string getHtmlForColumnsList(string $db, string $table, string $colTypeCategory = 'all', string $listType = 'dropdown')

build the html for columns of $colTypeCategory category in form of given $listType in a table

Parameters

string $db current database
string $table current table
string $colTypeCategory supported all|Numeric|String|Spatial |Date and time using the _pgettext() format
string $listType type of list to build, supported dropdown|checkbox

Return Value

string HTML for list of columns in form of given list types

at line 125
string getHtmlForCreateNewColumn(integer $numFields, string $db, string $table, array $columnMeta = [])

get the html of the form to add the new column to given table

Parameters

integer $numFields number of columns to add
string $db current database
string $table current table
array $columnMeta array containing default values for the fields

Return Value

string HTML

at line 210
string getHtmlFor1NFStep1(string $db, string $table, string $normalizedTo)

build the html for step 1.1 of normalization

Parameters

string $db current database
string $table current table
string $normalizedTo up to which step normalization will go, possible values 1nf|2nf|3nf

Return Value

string HTML for step 1.1

at line 263
string[] getHtmlContentsFor1NFStep2(string $db, string $table)

build the html contents of various html elements in step 1.2

Parameters

string $db current database
string $table current table

Return Value

string[] HTML contents for step 1.2

at line 313
string[] getHtmlContentsFor1NFStep4(string $db, string $table)

build the html contents of various html elements in step 1.4

Parameters

string $db current database
string $table current table

Return Value

string[] HTML contents for step 1.4

at line 349
string[] getHtmlContentsFor1NFStep3(string $db, string $table)

build the html contents of various html elements in step 1.3

Parameters

string $db current database
string $table current table

Return Value

string[] HTML contents for step 1.3

at line 394
string[] getHtmlFor2NFstep1(string $db, string $table)

build html contents for 2NF step 2.1

Parameters

string $db current database
string $table current table

Return Value

string[] HTML contents for 2NF step 2.1

at line 489
string getHtmlForNewTables2NF(array $partialDependencies, string $table)

build the html for showing the tables to have in order to put current table in 2NF

Parameters

array $partialDependencies array containing all the dependencies
string $table current table

Return Value

string HTML

at line 523
array createNewTablesFor2NF(array $partialDependencies, object $tablesName, string $table, string $db)

create/alter the tables needed for 2NF

Parameters

array $partialDependencies array containing all the partial dependencies
object $tablesName name of new tables
string $table current table
string $db current database

Return Value

array

at line 600
array getHtmlForNewTables3NF(object $dependencies, array $tables, string $db)

build the html for showing the new tables to have in order to put given tables in 3NF

Parameters

object $dependencies containing all the dependencies
array $tables tables formed after 2NF and need to convert to 3NF
string $db current database

Return Value

array containing html and the list of new tables

at line 664
array createNewTablesFor3NF(array $newTables, string $db)

create new tables or alter existing to get 3NF

Parameters

array $newTables list of new tables to be created
string $db current database

Return Value

array

at line 759
array moveRepeatingGroup(string $repeatingColumns, string $primaryColumns, string $newTable, string $newColumn, string $table, string $db)

move the repeating group of columns to a new table

Parameters

string $repeatingColumns comma separated list of repeating group columns
string $primaryColumns comma separated list of column in primary key of $table
string $newTable name of the new table to be created
string $newColumn name of the new column in the new table
string $table current table
string $db current database

Return Value

array

at line 827
string[] getHtmlFor3NFstep1(string $db, array $tables)

build html for 3NF step 1 to find the transitive dependencies

Parameters

string $db current database
array $tables tables formed after 2NF and need to process for 3NF

Return Value

string[]

at line 904
string getHtmlForNormalizeTable()

get html for options to normalize table

Return Value

string HTML

at line 950
string findPartialDependencies(string $table, string $db)

find all the possible partial dependencies based on data in the table.

Parameters

string $table current table
string $db current database

Return Value

string HTML containing the list of all the possible partial dependencies