2013-12-02 17:36:37 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
require_once 'classes/model/om/BaseBpmnFlow.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Skeleton subclass for representing a row from the 'BPMN_FLOW' 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
|
|
|
|
|
*/
|
2014-02-06 20:30:27 -04:00
|
|
|
class BpmnFlow extends BaseBpmnFlow
|
|
|
|
|
{
|
2014-02-24 19:58:32 -04:00
|
|
|
public static function removeAllRelated($elementUid)
|
|
|
|
|
{
|
|
|
|
|
$c = new Criteria('workflow');
|
|
|
|
|
|
|
|
|
|
$c1 = $c->getNewCriterion(BpmnFlowPeer::FLO_ELEMENT_ORIGIN, $elementUid);
|
|
|
|
|
$c2 = $c->getNewCriterion(BpmnFlowPeer::FLO_ELEMENT_DEST, $elementUid);
|
|
|
|
|
|
|
|
|
|
$c1->addOr($c2);
|
|
|
|
|
$c->add($c1);
|
|
|
|
|
|
|
|
|
|
$flows = BpmnFlowPeer::doSelect($c);
|
|
|
|
|
|
|
|
|
|
foreach ($flows as $flow) {
|
|
|
|
|
$flow->delete();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-02-12 17:01:19 -04:00
|
|
|
/**
|
|
|
|
|
* @param $field string coming from \BpmnFlowPeer::<FIELD_NAME>
|
|
|
|
|
* @param $value string
|
|
|
|
|
* @return \BpmnFlow|null
|
|
|
|
|
*/
|
2014-02-24 19:10:45 -04:00
|
|
|
public static function findOneBy($field, $value = null)
|
2014-02-07 08:41:11 -04:00
|
|
|
{
|
|
|
|
|
$rows = self::findAllBy($field, $value);
|
|
|
|
|
|
|
|
|
|
return empty($rows) ? null : $rows[0];
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-24 19:10:45 -04:00
|
|
|
/**
|
|
|
|
|
* @param $field
|
|
|
|
|
* @param null $value
|
|
|
|
|
* @return \BpmnFlow[]
|
|
|
|
|
*/
|
|
|
|
|
public static function findAllBy($field, $value = null)
|
2014-02-07 08:41:11 -04:00
|
|
|
{
|
2014-02-24 19:10:45 -04:00
|
|
|
$field = is_array($field) ? $field : array($field => $value);
|
|
|
|
|
|
2014-02-07 08:41:11 -04:00
|
|
|
$c = new Criteria('workflow');
|
2014-02-24 19:10:45 -04:00
|
|
|
|
|
|
|
|
foreach ($field as $key => $value) {
|
|
|
|
|
$c->add($key, $value, Criteria::EQUAL);
|
|
|
|
|
}
|
2014-02-07 08:41:11 -04:00
|
|
|
|
|
|
|
|
return BpmnFlowPeer::doSelect($c);
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-06 20:30:27 -04:00
|
|
|
public static function getAll($prjUid = null, $start = null, $limit = null, $filter = '', $changeCaseTo = CASE_UPPER)
|
|
|
|
|
{
|
|
|
|
|
//TODO implement $start, $limit and $filter
|
|
|
|
|
$c = new Criteria('workflow');
|
|
|
|
|
|
|
|
|
|
if (! is_null($prjUid)) {
|
|
|
|
|
$c->add(BpmnFlowPeer::PRJ_UID, $prjUid, Criteria::EQUAL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$rs = BpmnFlowPeer::doSelectRS($c);
|
|
|
|
|
$rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
|
|
|
|
|
|
|
|
|
$flows = array();
|
|
|
|
|
|
|
|
|
|
while ($rs->next()) {
|
|
|
|
|
$flow = $rs->getRow();
|
2014-02-18 17:41:45 -04:00
|
|
|
$flow["FLO_STATE"] = @json_decode($flow["FLO_STATE"], true);
|
2014-02-06 21:26:06 -04:00
|
|
|
//$flow["FLO_IS_INMEDIATE"] = $flow["FLO_IS_INMEDIATE"] == 1 ? true : false;
|
2014-02-06 20:30:27 -04:00
|
|
|
$flow = $changeCaseTo !== CASE_UPPER ? array_change_key_case($flow, CASE_LOWER) : $flow;
|
|
|
|
|
|
|
|
|
|
$flows[] = $flow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $flows;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-07 15:42:24 -04:00
|
|
|
public static function exists($floUid)
|
|
|
|
|
{
|
|
|
|
|
$c = new Criteria('workflow');
|
|
|
|
|
$c->add(BpmnFlowPeer::FLO_UID, $floUid);
|
|
|
|
|
|
|
|
|
|
return BpmnFlowPeer::doCount($c) > 0 ? true : false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function fromArray($data, $type = BasePeer::TYPE_FIELDNAME)
|
|
|
|
|
{
|
|
|
|
|
parent::fromArray($data, $type);
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-06 20:30:27 -04:00
|
|
|
public function toArray($type = BasePeer::TYPE_FIELDNAME)
|
|
|
|
|
{
|
2014-02-18 17:41:45 -04:00
|
|
|
$flow = parent::toArray($type);
|
|
|
|
|
$flow["FLO_STATE"] = @json_decode($flow["FLO_STATE"], true);
|
|
|
|
|
|
|
|
|
|
return $flow;
|
2014-02-06 20:30:27 -04:00
|
|
|
}
|
2013-12-02 17:36:37 -04:00
|
|
|
|
2014-02-24 19:10:45 -04:00
|
|
|
/*public static function select($select, $where = array())
|
|
|
|
|
{
|
|
|
|
|
$data = array();
|
|
|
|
|
|
|
|
|
|
$c = new Criteria('workflow');
|
|
|
|
|
if ($select !== '*') {
|
|
|
|
|
if (is_array($select)) {
|
|
|
|
|
foreach ($select as $column) {
|
|
|
|
|
$c->addSelectColumn($column);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$c->addSelectColumn($select);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! empty($where)) {
|
|
|
|
|
foreach ($where as $column => $value) {
|
|
|
|
|
$c->add($column, $value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$rs = BpmnFlowPeer::doSelectRS($c);
|
|
|
|
|
$rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
|
|
|
|
|
|
|
|
|
while ($rs->next()) {
|
|
|
|
|
$data[] = $rs->getRow();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $data;
|
|
|
|
|
}*/
|
|
|
|
|
|
2013-12-02 17:36:37 -04:00
|
|
|
} // BpmnFlow
|