Ubiquity  2.0.3
php rapid development framework
DbGenerator Class Reference

Public Member Functions

 isInt ($fieldType)
 
 __construct ()
 
 createDatabase ($name)
 
 selectDatabase ($name)
 
 createTable ($name, $fieldsAttributes, $attributes=["ENGINE=InnoDB","DEFAULT CHARSET=utf8"])
 
 addKey ($tableName, $fieldNames, $type="PRIMARY")
 
 addForeignKey ($tableName, $fkFieldName, $referencesTableName, $referencesFieldName, $fkName=null, $onDelete="CASCADE", $onUpdate="NO ACTION")
 
 addAutoInc ($tableName, $fieldName, $value=1)
 
 generateField ($fieldAttributes)
 
 getSqlScript ()
 
 addManyToMany ($jointable, $targetEntity)
 
 generateManyToManys ()
 
 __toString ()
 

Protected Member Functions

 addScript ($key, $script)
 
 checkConstraintName ($name)
 
 checkFieldAttributes ($fieldAttributes)
 
 generateFields ($fieldsAttributes)
 
 replaceMask ($key, $value, $mask)
 
 replaceArrayMask ($keyValues, $mask)
 
 generateManyToMany ($joinTable, $targetEntities)
 

Protected Attributes

 $nameProtection
 
 $createDatabaseMask
 
 $createTableMask
 
 $fieldMask
 
 $foreignKeyMask
 
 $alterTableMask
 
 $alterTableAddKey
 
 $autoIncMask
 
 $selectDbMask
 
 $constraintNames =[]
 
 $sqlScript =[]
 
 $fieldTypes
 
 $defaultType
 
 $typeMatch ='@([\s\S]*?)((?:\((?:\d)+\))*?)$@'
 
 $intMatch ='@^.*?int.*?((?:\((?:\d)+\))*?)$@'
 
 $manyToManys =[]
 

Detailed Description

Definition at line 9 of file DbGenerator.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Definition at line 31 of file DbGenerator.php.

Member Function Documentation

◆ __toString()

__toString ( )

Definition at line 205 of file DbGenerator.php.

◆ addAutoInc()

addAutoInc (   $tableName,
  $fieldName,
  $value = 1 
)

Definition at line 85 of file DbGenerator.php.

◆ addForeignKey()

addForeignKey (   $tableName,
  $fkFieldName,
  $referencesTableName,
  $referencesFieldName,
  $fkName = null,
  $onDelete = "CASCADE",
  $onUpdate = "NO ACTION" 
)

Definition at line 77 of file DbGenerator.php.

◆ addKey()

addKey (   $tableName,
  $fieldNames,
  $type = "PRIMARY" 
)

Definition at line 68 of file DbGenerator.php.

◆ addManyToMany()

addManyToMany (   $jointable,
  $targetEntity 
)

Definition at line 166 of file DbGenerator.php.

◆ addScript()

addScript (   $key,
  $script 
)
protected

Definition at line 90 of file DbGenerator.php.

◆ checkConstraintName()

checkConstraintName (   $name)
protected

Definition at line 98 of file DbGenerator.php.

◆ checkFieldAttributes()

checkFieldAttributes (   $fieldAttributes)
protected

Definition at line 119 of file DbGenerator.php.

◆ createDatabase()

createDatabase (   $name)

Definition at line 51 of file DbGenerator.php.

◆ createTable()

createTable (   $name,
  $fieldsAttributes,
  $attributes = ["ENGINE=InnoDB" 
)

Definition at line 61 of file DbGenerator.php.

◆ generateField()

generateField (   $fieldAttributes)

Definition at line 114 of file DbGenerator.php.

◆ generateFields()

generateFields (   $fieldsAttributes)
protected

Definition at line 141 of file DbGenerator.php.

◆ generateManyToMany()

generateManyToMany (   $joinTable,
  $targetEntities 
)
protected

Definition at line 179 of file DbGenerator.php.

◆ generateManyToManys()

generateManyToManys ( )

Definition at line 173 of file DbGenerator.php.

◆ getSqlScript()

getSqlScript ( )

Definition at line 162 of file DbGenerator.php.

◆ isInt()

isInt (   $fieldType)

Definition at line 28 of file DbGenerator.php.

◆ replaceArrayMask()

replaceArrayMask (   $keyValues,
  $mask 
)
protected

Definition at line 155 of file DbGenerator.php.

◆ replaceMask()

replaceMask (   $key,
  $value,
  $mask 
)
protected

Definition at line 149 of file DbGenerator.php.

◆ selectDatabase()

selectDatabase (   $name)

Definition at line 56 of file DbGenerator.php.

Field Documentation

◆ $alterTableAddKey

$alterTableAddKey
protected

Definition at line 16 of file DbGenerator.php.

◆ $alterTableMask

$alterTableMask
protected

Definition at line 15 of file DbGenerator.php.

◆ $autoIncMask

$autoIncMask
protected

Definition at line 17 of file DbGenerator.php.

◆ $constraintNames

$constraintNames =[]
protected

Definition at line 19 of file DbGenerator.php.

◆ $createDatabaseMask

$createDatabaseMask
protected

Definition at line 11 of file DbGenerator.php.

◆ $createTableMask

$createTableMask
protected

Definition at line 12 of file DbGenerator.php.

◆ $defaultType

$defaultType
protected

Definition at line 22 of file DbGenerator.php.

◆ $fieldMask

$fieldMask
protected

Definition at line 13 of file DbGenerator.php.

◆ $fieldTypes

$fieldTypes
protected

Definition at line 21 of file DbGenerator.php.

◆ $foreignKeyMask

$foreignKeyMask
protected

Definition at line 14 of file DbGenerator.php.

◆ $intMatch

$intMatch ='@^.*?int.*?((?:\((?:\d)+\))*?)$@'
protected

Definition at line 24 of file DbGenerator.php.

◆ $manyToManys

$manyToManys =[]
protected

Definition at line 25 of file DbGenerator.php.

◆ $nameProtection

$nameProtection
protected

Definition at line 10 of file DbGenerator.php.

◆ $selectDbMask

$selectDbMask
protected

Definition at line 18 of file DbGenerator.php.

◆ $sqlScript

$sqlScript =[]
protected

Definition at line 20 of file DbGenerator.php.

◆ $typeMatch

$typeMatch ='@([\s\S]*?)((?:\((?:\d)+\))*?)$@'
protected

Definition at line 23 of file DbGenerator.php.


The documentation for this class was generated from the following file: