64
workflow/engine/classes/model/AppSequence.php
Normal file
64
workflow/engine/classes/model/AppSequence.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
require_once 'classes/model/om/BaseAppSequence.php';
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'APP_SEQUENCE' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
*/
|
||||
class AppSequence extends BaseAppSequence {
|
||||
|
||||
/**
|
||||
* Get an Set new sequence number
|
||||
*
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function sequenceNumber()
|
||||
{
|
||||
try {
|
||||
$con = Propel::getConnection('workflow');
|
||||
$stmt = $con->createStatement();
|
||||
//UPDATE SEQUENCES SET SEQ_VALUE = LAST_INSERT_ID(SEQ_VALUE + 1);
|
||||
$sql = "UPDATE APP_SEQUENCE SET ID=LAST_INSERT_ID(ID+1)";
|
||||
$stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
//SELECT LAST_INSERT_ID()
|
||||
$sql = "SELECT LAST_INSERT_ID()";
|
||||
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
$result = $row['LAST_INSERT_ID()'];
|
||||
} catch (\Exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update sequence number
|
||||
*
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function updateSequenceNumber($number)
|
||||
{
|
||||
try {
|
||||
$con = Propel::getConnection('workflow');
|
||||
$stmt = $con->createStatement();
|
||||
$sql = "UPDATE APP_SEQUENCE SET ID=LAST_INSERT_ID('$number')";
|
||||
$stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
} catch (\Exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
}
|
||||
|
||||
} // AppSequence
|
||||
23
workflow/engine/classes/model/AppSequencePeer.php
Normal file
23
workflow/engine/classes/model/AppSequencePeer.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
// include base peer class
|
||||
require_once 'classes/model/om/BaseAppSequencePeer.php';
|
||||
|
||||
// include object class
|
||||
include_once 'classes/model/AppSequence.php';
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'APP_SEQUENCE' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
*/
|
||||
class AppSequencePeer extends BaseAppSequencePeer {
|
||||
|
||||
} // AppSequencePeer
|
||||
@@ -354,7 +354,7 @@ class Application extends BaseApplication
|
||||
*/
|
||||
public function create($sProUid, $sUsrUid)
|
||||
{
|
||||
require_once ("classes/model/Sequences.php");
|
||||
require_once ("classes/model/AppSequence.php");
|
||||
$con = Propel::getConnection('workflow');
|
||||
|
||||
try {
|
||||
@@ -378,17 +378,12 @@ class Application extends BaseApplication
|
||||
$c = new Criteria();
|
||||
$c->clearSelectColumns();
|
||||
|
||||
$oSequences = new Sequences();
|
||||
$oSequences->lockSequenceTable();
|
||||
|
||||
$maxNumber = $oSequences->getSequeceNumber("APP_NUMBER");
|
||||
$oAppSequence = new AppSequence();
|
||||
$maxNumber = $oAppSequence->sequenceNumber();
|
||||
|
||||
$this->setAppNumber($maxNumber);
|
||||
$this->setAppData(serialize(['APP_NUMBER' => $maxNumber, 'PIN' => $pin]));
|
||||
|
||||
$oSequences->changeSequence('APP_NUMBER', $maxNumber);
|
||||
$oSequences->unlockSequenceTable();
|
||||
|
||||
if ($this->validate()) {
|
||||
$con->begin();
|
||||
$res = $this->save();
|
||||
|
||||
72
workflow/engine/classes/model/map/AppSequenceMapBuilder.php
Normal file
72
workflow/engine/classes/model/map/AppSequenceMapBuilder.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
require_once 'propel/map/MapBuilder.php';
|
||||
include_once 'creole/CreoleTypes.php';
|
||||
|
||||
|
||||
/**
|
||||
* This class adds structure of 'APP_SEQUENCE' table to 'workflow' DatabaseMap object.
|
||||
*
|
||||
*
|
||||
*
|
||||
* These statically-built map classes are used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
* @package workflow.classes.model.map
|
||||
*/
|
||||
class AppSequenceMapBuilder
|
||||
{
|
||||
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'classes.model.map.AppSequenceMapBuilder';
|
||||
|
||||
/**
|
||||
* The database map.
|
||||
*/
|
||||
private $dbMap;
|
||||
|
||||
/**
|
||||
* Tells us if this DatabaseMapBuilder is built so that we
|
||||
* don't have to re-build it every time.
|
||||
*
|
||||
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
|
||||
*/
|
||||
public function isBuilt()
|
||||
{
|
||||
return ($this->dbMap !== null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the databasemap this map builder built.
|
||||
*
|
||||
* @return the databasemap
|
||||
*/
|
||||
public function getDatabaseMap()
|
||||
{
|
||||
return $this->dbMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* The doBuild() method builds the DatabaseMap
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function doBuild()
|
||||
{
|
||||
$this->dbMap = Propel::getDatabaseMap('workflow');
|
||||
|
||||
$tMap = $this->dbMap->addTable('APP_SEQUENCE');
|
||||
$tMap->setPhpName('AppSequence');
|
||||
|
||||
$tMap->setUseIdGenerator(true);
|
||||
|
||||
$tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
|
||||
|
||||
} // doBuild()
|
||||
|
||||
} // AppSequenceMapBuilder
|
||||
512
workflow/engine/classes/model/om/BaseAppSequence.php
Normal file
512
workflow/engine/classes/model/om/BaseAppSequence.php
Normal file
File diff suppressed because it is too large
Load Diff
569
workflow/engine/classes/model/om/BaseAppSequencePeer.php
Normal file
569
workflow/engine/classes/model/om/BaseAppSequencePeer.php
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user