CODE STYLE class.ArrayPeer.php
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* class.ArrayPeer.php
|
||||
*
|
||||
* @package workflow.engine.classes
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
@@ -34,70 +35,113 @@ include_once 'classes/model/Application.php';
|
||||
*
|
||||
* @package workflow.engine.classes
|
||||
*/
|
||||
abstract class ArrayBasePeer {
|
||||
abstract class ArrayBasePeer
|
||||
{
|
||||
|
||||
/** The default database name for this class */
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'dbarray';
|
||||
|
||||
/** The table name for this class */
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
//const TABLE_NAME = 'APPLICATION';
|
||||
|
||||
/** A class that can be returned by this peer. */
|
||||
|
||||
/**
|
||||
* A class that can be returned by this peer.
|
||||
*/
|
||||
const CLASS_DEFAULT = 'classes.model.Application';
|
||||
|
||||
/** The total number of columns. */
|
||||
/**
|
||||
* The total number of columns.
|
||||
*/
|
||||
const NUM_COLUMNS = 15;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
/**
|
||||
* The number of lazy-loaded columns.
|
||||
*/
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
|
||||
/** The column name for the APP_UID field */
|
||||
/**
|
||||
* The column name for the APP_UID field
|
||||
*/
|
||||
const APP_UID = 'APPLICATION.APP_UID';
|
||||
|
||||
/** The column name for the APP_NUMBER field */
|
||||
/**
|
||||
* The column name for the APP_NUMBER field
|
||||
*/
|
||||
const APP_NUMBER = 'APPLICATION.APP_NUMBER';
|
||||
|
||||
/** The column name for the APP_PARENT field */
|
||||
/**
|
||||
* The column name for the APP_PARENT field
|
||||
*/
|
||||
const APP_PARENT = 'APPLICATION.APP_PARENT';
|
||||
|
||||
/** The column name for the APP_STATUS field */
|
||||
/**
|
||||
* The column name for the APP_STATUS field
|
||||
*/
|
||||
const APP_STATUS = 'APPLICATION.APP_STATUS';
|
||||
|
||||
/** The column name for the PRO_UID field */
|
||||
/**
|
||||
* The column name for the PRO_UID field
|
||||
*/
|
||||
const PRO_UID = 'APPLICATION.PRO_UID';
|
||||
|
||||
/** The column name for the APP_PROC_STATUS field */
|
||||
/**
|
||||
* The column name for the APP_PROC_STATUS field
|
||||
*/
|
||||
const APP_PROC_STATUS = 'APPLICATION.APP_PROC_STATUS';
|
||||
|
||||
/** The column name for the APP_PROC_CODE field */
|
||||
/**
|
||||
* The column name for the APP_PROC_CODE field
|
||||
*/
|
||||
const APP_PROC_CODE = 'APPLICATION.APP_PROC_CODE';
|
||||
|
||||
/** The column name for the APP_PARALLEL field */
|
||||
/**
|
||||
* The column name for the APP_PARALLEL field
|
||||
*/
|
||||
const APP_PARALLEL = 'APPLICATION.APP_PARALLEL';
|
||||
|
||||
/** The column name for the APP_INIT_USER field */
|
||||
/**
|
||||
* The column name for the APP_INIT_USER field
|
||||
*/
|
||||
const APP_INIT_USER = 'APPLICATION.APP_INIT_USER';
|
||||
|
||||
/** The column name for the APP_CUR_USER field */
|
||||
/**
|
||||
* The column name for the APP_CUR_USER field
|
||||
*/
|
||||
const APP_CUR_USER = 'APPLICATION.APP_CUR_USER';
|
||||
|
||||
/** The column name for the APP_CREATE_DATE field */
|
||||
/**
|
||||
* The column name for the APP_CREATE_DATE field
|
||||
*/
|
||||
const APP_CREATE_DATE = 'APPLICATION.APP_CREATE_DATE';
|
||||
|
||||
/** The column name for the APP_INIT_DATE field */
|
||||
/**
|
||||
* The column name for the APP_INIT_DATE field
|
||||
*/
|
||||
const APP_INIT_DATE = 'APPLICATION.APP_INIT_DATE';
|
||||
|
||||
/** The column name for the APP_FINISH_DATE field */
|
||||
/**
|
||||
* The column name for the APP_FINISH_DATE field
|
||||
*/
|
||||
const APP_FINISH_DATE = 'APPLICATION.APP_FINISH_DATE';
|
||||
|
||||
/** The column name for the APP_UPDATE_DATE field */
|
||||
/**
|
||||
* The column name for the APP_UPDATE_DATE field
|
||||
*/
|
||||
const APP_UPDATE_DATE = 'APPLICATION.APP_UPDATE_DATE';
|
||||
|
||||
/** The column name for the APP_DATA field */
|
||||
/**
|
||||
* The column name for the APP_DATA field
|
||||
*/
|
||||
const APP_DATA = 'APPLICATION.APP_DATA';
|
||||
|
||||
/** The PHP to DB Name Mapping */
|
||||
/**
|
||||
* The PHP to DB Name Mapping
|
||||
*/
|
||||
private static $phpNameMap = null;
|
||||
|
||||
/**
|
||||
@@ -106,11 +150,11 @@ abstract class ArrayBasePeer {
|
||||
* First dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
private static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('AppUid', 'AppNumber', 'AppParent', 'AppStatus', 'ProUid', 'AppProcStatus', 'AppProcCode', 'AppParallel', 'AppInitUser', 'AppCurUser', 'AppCreateDate', 'AppInitDate', 'AppFinishDate', 'AppUpdateDate', 'AppData', ),
|
||||
BasePeer::TYPE_COLNAME => array (ApplicationPeer::APP_UID, ApplicationPeer::APP_NUMBER, ApplicationPeer::APP_PARENT, ApplicationPeer::APP_STATUS, ApplicationPeer::PRO_UID, ApplicationPeer::APP_PROC_STATUS, ApplicationPeer::APP_PROC_CODE, ApplicationPeer::APP_PARALLEL, ApplicationPeer::APP_INIT_USER, ApplicationPeer::APP_CUR_USER, ApplicationPeer::APP_CREATE_DATE, ApplicationPeer::APP_INIT_DATE, ApplicationPeer::APP_FINISH_DATE, ApplicationPeer::APP_UPDATE_DATE, ApplicationPeer::APP_DATA, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('APP_UID', 'APP_NUMBER', 'APP_PARENT', 'APP_STATUS', 'PRO_UID', 'APP_PROC_STATUS', 'APP_PROC_CODE', 'APP_PARALLEL', 'APP_INIT_USER', 'APP_CUR_USER', 'APP_CREATE_DATE', 'APP_INIT_DATE', 'APP_FINISH_DATE', 'APP_UPDATE_DATE', 'APP_DATA', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
|
||||
private static $fieldNames = array (BasePeer::TYPE_PHPNAME => array ('AppUid','AppNumber','AppParent','AppStatus','ProUid','AppProcStatus','AppProcCode','AppParallel','AppInitUser','AppCurUser','AppCreateDate','AppInitDate','AppFinishDate','AppUpdateDate','AppData'
|
||||
),BasePeer::TYPE_COLNAME => array (ApplicationPeer::APP_UID,ApplicationPeer::APP_NUMBER,ApplicationPeer::APP_PARENT,ApplicationPeer::APP_STATUS,ApplicationPeer::PRO_UID,ApplicationPeer::APP_PROC_STATUS,ApplicationPeer::APP_PROC_CODE,ApplicationPeer::APP_PARALLEL,ApplicationPeer::APP_INIT_USER,ApplicationPeer::APP_CUR_USER,ApplicationPeer::APP_CREATE_DATE,ApplicationPeer::APP_INIT_DATE,ApplicationPeer::APP_FINISH_DATE,ApplicationPeer::APP_UPDATE_DATE,ApplicationPeer::APP_DATA
|
||||
),BasePeer::TYPE_FIELDNAME => array ('APP_UID','APP_NUMBER','APP_PARENT','APP_STATUS','PRO_UID','APP_PROC_STATUS','APP_PROC_CODE','APP_PARALLEL','APP_INIT_USER','APP_CUR_USER','APP_CREATE_DATE','APP_INIT_DATE','APP_FINISH_DATE','APP_UPDATE_DATE','APP_DATA'
|
||||
),BasePeer::TYPE_NUM => array (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -119,14 +163,15 @@ abstract class ArrayBasePeer {
|
||||
* First dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
private static $fieldKeys = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'AppNumber' => 1, 'AppParent' => 2, 'AppStatus' => 3, 'ProUid' => 4, 'AppProcStatus' => 5, 'AppProcCode' => 6, 'AppParallel' => 7, 'AppInitUser' => 8, 'AppCurUser' => 9, 'AppCreateDate' => 10, 'AppInitDate' => 11, 'AppFinishDate' => 12, 'AppUpdateDate' => 13, 'AppData' => 14, ),
|
||||
BasePeer::TYPE_COLNAME => array (ApplicationPeer::APP_UID => 0, ApplicationPeer::APP_NUMBER => 1, ApplicationPeer::APP_PARENT => 2, ApplicationPeer::APP_STATUS => 3, ApplicationPeer::PRO_UID => 4, ApplicationPeer::APP_PROC_STATUS => 5, ApplicationPeer::APP_PROC_CODE => 6, ApplicationPeer::APP_PARALLEL => 7, ApplicationPeer::APP_INIT_USER => 8, ApplicationPeer::APP_CUR_USER => 9, ApplicationPeer::APP_CREATE_DATE => 10, ApplicationPeer::APP_INIT_DATE => 11, ApplicationPeer::APP_FINISH_DATE => 12, ApplicationPeer::APP_UPDATE_DATE => 13, ApplicationPeer::APP_DATA => 14, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0, 'APP_NUMBER' => 1, 'APP_PARENT' => 2, 'APP_STATUS' => 3, 'PRO_UID' => 4, 'APP_PROC_STATUS' => 5, 'APP_PROC_CODE' => 6, 'APP_PARALLEL' => 7, 'APP_INIT_USER' => 8, 'APP_CUR_USER' => 9, 'APP_CREATE_DATE' => 10, 'APP_INIT_DATE' => 11, 'APP_FINISH_DATE' => 12, 'APP_UPDATE_DATE' => 13, 'APP_DATA' => 14, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
|
||||
private static $fieldKeys = array (BasePeer::TYPE_PHPNAME => array ('AppUid' => 0,'AppNumber' => 1,'AppParent' => 2,'AppStatus' => 3,'ProUid' => 4,'AppProcStatus' => 5,'AppProcCode' => 6,'AppParallel' => 7,'AppInitUser' => 8,'AppCurUser' => 9,'AppCreateDate' => 10,'AppInitDate' => 11,'AppFinishDate' => 12,'AppUpdateDate' => 13,'AppData' => 14
|
||||
),BasePeer::TYPE_COLNAME => array (ApplicationPeer::APP_UID => 0,ApplicationPeer::APP_NUMBER => 1,ApplicationPeer::APP_PARENT => 2,ApplicationPeer::APP_STATUS => 3,ApplicationPeer::PRO_UID => 4,ApplicationPeer::APP_PROC_STATUS => 5,ApplicationPeer::APP_PROC_CODE => 6,ApplicationPeer::APP_PARALLEL => 7,ApplicationPeer::APP_INIT_USER => 8,ApplicationPeer::APP_CUR_USER => 9,ApplicationPeer::APP_CREATE_DATE => 10,ApplicationPeer::APP_INIT_DATE => 11,ApplicationPeer::APP_FINISH_DATE => 12,ApplicationPeer::APP_UPDATE_DATE => 13,ApplicationPeer::APP_DATA => 14
|
||||
),BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0,'APP_NUMBER' => 1,'APP_PARENT' => 2,'APP_STATUS' => 3,'PRO_UID' => 4,'APP_PROC_STATUS' => 5,'APP_PROC_CODE' => 6,'APP_PARALLEL' => 7,'APP_INIT_USER' => 8,'APP_CUR_USER' => 9,'APP_CREATE_DATE' => 10,'APP_INIT_DATE' => 11,'APP_FINISH_DATE' => 12,'APP_UPDATE_DATE' => 13,'APP_DATA' => 14
|
||||
),BasePeer::TYPE_NUM => array (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return MapBuilder the map builder for this peer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
@@ -136,6 +181,7 @@ abstract class ArrayBasePeer {
|
||||
include_once 'classes/model/map/ApplicationMapBuilder.php';
|
||||
return BasePeer::getMapBuilder( 'classes.model.map.ApplicationMapBuilder' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a map (hash) of PHP names to DB column names.
|
||||
*
|
||||
@@ -157,6 +203,7 @@ abstract class ArrayBasePeer {
|
||||
}
|
||||
return self::$phpNameMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a fieldname to another type
|
||||
*
|
||||
@@ -201,6 +248,7 @@ abstract class ArrayBasePeer {
|
||||
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
|
||||
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
|
||||
* </code>
|
||||
*
|
||||
* @param string $alias The alias for the current table.
|
||||
* @param string $column The column name for current table. (i.e. ApplicationPeer::COLUMN_NAME).
|
||||
* @return string
|
||||
@@ -226,7 +274,6 @@ abstract class ArrayBasePeer {
|
||||
|
||||
}
|
||||
|
||||
|
||||
const COUNT = 'COUNT(APPLICATION.APP_UID)';
|
||||
const COUNT_DISTINCT = 'COUNT(DISTINCT APPLICATION.APP_UID)';
|
||||
|
||||
@@ -270,6 +317,7 @@ abstract class ArrayBasePeer {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to select one object from the DB.
|
||||
*
|
||||
@@ -327,6 +375,7 @@ abstract class ArrayBasePeer {
|
||||
$tableName = null;
|
||||
$selectClause[] = $columnName; // the full column name: e.g. MAX(books.price)
|
||||
|
||||
|
||||
$parenPos = strpos( $columnName, '(' );
|
||||
$dotPos = strpos( $columnName, '.' );
|
||||
|
||||
@@ -380,11 +429,7 @@ abstract class ArrayBasePeer {
|
||||
$table = $tableName;
|
||||
}
|
||||
|
||||
$ignoreCase =
|
||||
(($criteria->isIgnoreCase()
|
||||
|| $someCriteria[$i]->isIgnoreCase())
|
||||
&& ($dbMap->getTable($table)->getColumn($someCriteria[$i]->getColumn())->getType() == "string" )
|
||||
);
|
||||
$ignoreCase = (($criteria->isIgnoreCase() || $someCriteria[$i]->isIgnoreCase()) && ($dbMap->getTable( $table )->getColumn( $someCriteria[$i]->getColumn() )->getType() == "string"));
|
||||
|
||||
$someCriteria[$i]->setIgnoreCase( $ignoreCase );
|
||||
}
|
||||
@@ -399,6 +444,7 @@ abstract class ArrayBasePeer {
|
||||
$params[] = $cri;
|
||||
//$criterion->appendPsTo($sb, $params);
|
||||
|
||||
|
||||
$whereClause[] = $sb;
|
||||
|
||||
}
|
||||
@@ -419,8 +465,7 @@ abstract class ArrayBasePeer {
|
||||
if ($dotPos !== false) {
|
||||
$tableName = substr( $orderByColumn, 0, $dotPos );
|
||||
$columnName = substr( $orderByColumn, $dotPos + 1 );
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$tableName = '';
|
||||
$columnName = $orderByColumn;
|
||||
}
|
||||
@@ -429,21 +474,16 @@ abstract class ArrayBasePeer {
|
||||
if ($spacePos !== false) {
|
||||
$direction = substr( $columnName, $spacePos );
|
||||
$columnName = substr( $columnName, 0, $spacePos );
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$direction = '';
|
||||
}
|
||||
$orderByClause[] = array ( 'columnName' => $columnName, 'direction' => $direction );
|
||||
$orderByClause[] = array ('columnName' => $columnName,'direction' => $direction
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Build the SQL from the arrays we compiled
|
||||
$sql = "SELECT "
|
||||
.($selectModifiers ? implode(" ", $selectModifiers) . " " : "")
|
||||
.implode(", ", $selectClause)
|
||||
." FROM ". $fromClause[0]
|
||||
.($whereClause ? " WHERE ".implode(" AND ", $whereClause) : "")
|
||||
.($groupByClause ? " GROUP BY ".implode(",", $groupByClause) : "");
|
||||
$sql = "SELECT " . ($selectModifiers ? implode( " ", $selectModifiers ) . " " : "") . implode( ", ", $selectClause ) . " FROM " . $fromClause[0] . ($whereClause ? " WHERE " . implode( " AND ", $whereClause ) : "") . ($groupByClause ? " GROUP BY " . implode( ",", $groupByClause ) : "");
|
||||
|
||||
$dataSql['selectClause'] = $selectClause;
|
||||
$dataSql['fromClause'] = $fromClause;
|
||||
@@ -481,12 +521,14 @@ abstract class ArrayBasePeer {
|
||||
//$rs = $stmt->executeQuery(ResultSet::FETCHMODE_NUM);
|
||||
$rs = $con->executeQuery( $sql, ResultSet::FETCHMODE_NUM );
|
||||
} catch (Exception $e) {
|
||||
if ($stmt) $stmt->close();
|
||||
if ($stmt)
|
||||
$stmt->close();
|
||||
throw new PropelException( $e );
|
||||
}
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the Criteria object and uses the parent doSelect()
|
||||
* method to get a ResultSet.
|
||||
@@ -553,9 +595,11 @@ abstract class ArrayBasePeer {
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TableMap related to this peer.
|
||||
* This method is not needed for general use but a specific application could have a need.
|
||||
*
|
||||
* @return TableMap
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
@@ -600,7 +644,6 @@ abstract class ArrayBasePeer {
|
||||
$criteria = $values->buildCriteria(); // build Criteria from Application object
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName( self::DATABASE_NAME );
|
||||
|
||||
@@ -638,6 +681,7 @@ abstract class ArrayBasePeer {
|
||||
if ($values instanceof Criteria) {
|
||||
$criteria = clone $values; // rename for clarity
|
||||
|
||||
|
||||
$comparison = $criteria->getComparison( ApplicationPeer::APP_UID );
|
||||
$selectCriteria->add( ApplicationPeer::APP_UID, $criteria->remove( ApplicationPeer::APP_UID ), $comparison );
|
||||
|
||||
@@ -654,6 +698,7 @@ abstract class ArrayBasePeer {
|
||||
|
||||
/**
|
||||
* Method to DELETE all rows from the APPLICATION table.
|
||||
*
|
||||
* @param Connection $con The connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
@@ -709,6 +754,7 @@ abstract class ArrayBasePeer {
|
||||
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
@@ -744,7 +790,8 @@ abstract class ArrayBasePeer {
|
||||
$tableMap = $dbMap->getTable( ApplicationPeer::TABLE_NAME );
|
||||
|
||||
if (! is_array( $cols )) {
|
||||
$cols = array($cols);
|
||||
$cols = array ($cols
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($cols as $colName) {
|
||||
@@ -780,7 +827,6 @@ abstract class ArrayBasePeer {
|
||||
|
||||
$criteria->add( ApplicationPeer::APP_UID, $pk );
|
||||
|
||||
|
||||
$v = ApplicationPeer::doSelect( $criteria, $con );
|
||||
|
||||
return ! empty( $v ) > 0 ? $v[0] : null;
|
||||
|
||||
Reference in New Issue
Block a user