CODE STYLE class.pmTable.php
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
/**
|
||||
* class.case.php
|
||||
*
|
||||
* @package workflow.engine.classes
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
@@ -29,6 +30,7 @@ require_once 'classes/model/AdditionalTables.php';
|
||||
/**
|
||||
* PmTable Class
|
||||
* New class to handle pmTable in native form invoking to Phing & Propel
|
||||
*
|
||||
* @author Erik Amaru Ortiz <erik@colosa.com>
|
||||
*/
|
||||
class PmTable
|
||||
@@ -62,6 +64,7 @@ class PmTable
|
||||
|
||||
/**
|
||||
* Set columns to pmTable
|
||||
*
|
||||
* @param array $columns contains a array of abjects
|
||||
* array(StdClass->field_name, field_type, field_size, field_null, field_key, field_autoincrement,...)
|
||||
*/
|
||||
@@ -72,6 +75,7 @@ class PmTable
|
||||
|
||||
/**
|
||||
* Set a data source
|
||||
*
|
||||
* @param string $dbsUid DBS_UID to relate the pmTable to phisical table
|
||||
*/
|
||||
public function setDataSource ($dbsUid)
|
||||
@@ -125,6 +129,7 @@ class PmTable
|
||||
/**
|
||||
* Backward compatibility function
|
||||
* Resolve a propel data source
|
||||
*
|
||||
* @param string $dbsUid corresponding to DBS_UID key
|
||||
* @return string contains resolved DBS_UID
|
||||
*/
|
||||
@@ -154,6 +159,7 @@ class PmTable
|
||||
|
||||
/**
|
||||
* get Data base config object
|
||||
*
|
||||
* @return object containing dbConfig var
|
||||
*/
|
||||
public function getDbConfig ()
|
||||
@@ -261,7 +267,6 @@ class PmTable
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
foreach ($this->columns as $column) {
|
||||
|
||||
// create the column node
|
||||
@@ -385,8 +390,7 @@ class PmTable
|
||||
throw new Exception( "Invalid or not supported engine '$adapter'!" );
|
||||
}
|
||||
|
||||
@copy(PATH_CORE . PATH_SEP . 'config' . PATH_SEP . "propel.$adapter.ini",
|
||||
$this->configDir . "propel.$adapter.ini");
|
||||
@copy( PATH_CORE . PATH_SEP . 'config' . PATH_SEP . "propel.$adapter.ini", $this->configDir . "propel.$adapter.ini" );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -410,6 +414,7 @@ class PmTable
|
||||
case 'mysql':
|
||||
$line = trim( $line ); // Remove comments from the script
|
||||
|
||||
|
||||
if (strpos( $line, "--" ) === 0) {
|
||||
$line = substr( $line, 0, strpos( $line, "--" ) );
|
||||
}
|
||||
@@ -442,13 +447,11 @@ class PmTable
|
||||
$line = substr( $line, 0, strrpos( $line, ";" ) );
|
||||
// just execute the drop and create table for target table nad not for others
|
||||
if (stripos( $line, 'CREATE TABLE' ) !== false || stripos( $line, 'DROP TABLE' ) !== false) {
|
||||
$isCreateForCurrentTable = preg_match('/CREATE\sTABLE\s[\[\'\"\`]{1}' . $this->tableName
|
||||
. '[\]\'\"\`]{1}/i', $line, $match);
|
||||
$isCreateForCurrentTable = preg_match( '/CREATE\sTABLE\s[\[\'\"\`]{1}' . $this->tableName . '[\]\'\"\`]{1}/i', $line, $match );
|
||||
if ($isCreateForCurrentTable) {
|
||||
$queryStack['create'] = $line;
|
||||
} else {
|
||||
$isDropForCurrentTable = preg_match('/DROP TABLE.*[\[\'\"\`]{1}' . $this->tableName
|
||||
. '[\]\'\"\`]{1}/i', $line, $match);
|
||||
$isDropForCurrentTable = preg_match( '/DROP TABLE.*[\[\'\"\`]{1}' . $this->tableName . '[\]\'\"\`]{1}/i', $line, $match );
|
||||
if ($isDropForCurrentTable) {
|
||||
$queryStack['drop'] = $line;
|
||||
}
|
||||
@@ -458,6 +461,7 @@ class PmTable
|
||||
case 'mssql':
|
||||
$line = trim( $line ); // Remove comments from the script
|
||||
|
||||
|
||||
if (strpos( $line, "--" ) === 0) {
|
||||
$line = substr( $line, 0, strpos( $line, "--" ) );
|
||||
}
|
||||
@@ -601,6 +605,7 @@ class PmTable
|
||||
foreach ($lines as $j => $line) {
|
||||
$line = trim( $line ); // Remove comments from the script
|
||||
|
||||
|
||||
if (strpos( $line, "--" ) === 0) {
|
||||
$line = substr( $line, 0, strpos( $line, "--" ) );
|
||||
}
|
||||
@@ -656,6 +661,7 @@ class PmTable
|
||||
|
||||
/**
|
||||
* verify if on the columns list was set a column as primary key
|
||||
*
|
||||
* @return boolean to affirm if was defined a column as pk.
|
||||
*/
|
||||
public function hasAutoIncrementPKey ()
|
||||
@@ -700,10 +706,12 @@ class PmTable
|
||||
//$types['BLOB'] = 'BLOB'; <- disabled
|
||||
//$types['CLOB'] = 'CLOB'; <- disabled
|
||||
|
||||
|
||||
return $types;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $name any string witha name separated by underscore
|
||||
* @return string contains a camelcase expresion for $name
|
||||
*/
|
||||
@@ -734,22 +742,20 @@ class PmTable
|
||||
|
||||
/**
|
||||
* call phing to execute a determinated task
|
||||
*
|
||||
* @param string $taskName [om|sql]
|
||||
*/
|
||||
private function _callPhing ($taskName)
|
||||
{
|
||||
$options = array(
|
||||
'project.dir' => $this->configDir,
|
||||
'build.properties' => "propel.{$this->dbConfig->adapter}.ini",
|
||||
'propel.targetPackage' => 'classes',
|
||||
'propel.output.dir' => $this->targetDir,
|
||||
'propel.php.dir' => $this->baseDir
|
||||
$options = array ('project.dir' => $this->configDir,'build.properties' => "propel.{$this->dbConfig->adapter}.ini",'propel.targetPackage' => 'classes','propel.output.dir' => $this->targetDir,'propel.php.dir' => $this->baseDir
|
||||
);
|
||||
|
||||
self::callPhing(array($taskName), PATH_THIRDPARTY . 'propel-generator/build.xml', $options, false);
|
||||
self::callPhing( array ($taskName
|
||||
), PATH_THIRDPARTY . 'propel-generator/build.xml', $options, false );
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $target - task name to execute
|
||||
* @param string $buildFile - build file path
|
||||
* @param array $options - array options to override the options on .ini file
|
||||
|
||||
Reference in New Issue
Block a user