2014-11-07 17:19:35 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
require_once 'classes/model/om/BaseListUnassignedGroup.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Skeleton subclass for representing a row from the 'LIST_UNASSIGNED_GROUP' table.
|
|
|
|
|
*
|
2017-02-22 12:12:22 -04:00
|
|
|
*
|
2014-11-07 17:19:35 -04:00
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
*/
|
2017-02-22 12:12:22 -04:00
|
|
|
// @codingStandardsIgnoreStart
|
|
|
|
|
class ListUnassignedGroup extends BaseListUnassignedGroup
|
|
|
|
|
{
|
|
|
|
|
// @codingStandardsIgnoreEnd
|
2015-03-04 18:42:47 -04:00
|
|
|
/**
|
|
|
|
|
* Create List Unassigned Group Table
|
|
|
|
|
*
|
|
|
|
|
* @param type $data
|
|
|
|
|
* @return type
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
public function create($data)
|
2017-02-22 12:12:22 -04:00
|
|
|
{
|
|
|
|
|
if (!empty($data['USR_UID'])) {
|
2017-02-21 16:25:17 -04:00
|
|
|
$u = new Users();
|
|
|
|
|
$data['USR_ID'] = $u->load($data['USR_UID'])['USR_ID'];
|
2017-02-20 11:15:23 -04:00
|
|
|
}
|
2017-02-22 12:12:22 -04:00
|
|
|
$con = Propel::getConnection(ListUnassignedGroupPeer::DATABASE_NAME);
|
2015-03-04 18:42:47 -04:00
|
|
|
try {
|
2017-02-22 12:12:22 -04:00
|
|
|
$this->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
2015-03-04 18:42:47 -04:00
|
|
|
if ($this->validate()) {
|
|
|
|
|
$result = $this->save();
|
|
|
|
|
} else {
|
2017-02-22 12:12:22 -04:00
|
|
|
$e = new Exception("Failed Validation in class " . get_class($this) . ".");
|
2015-03-04 18:42:47 -04:00
|
|
|
$e->aValidationFailures = $this->getValidationFailures();
|
|
|
|
|
throw ($e);
|
|
|
|
|
}
|
|
|
|
|
$con->commit();
|
|
|
|
|
return $result;
|
2017-02-22 12:12:22 -04:00
|
|
|
} catch (Exception $e) {
|
2015-03-04 18:42:47 -04:00
|
|
|
$con->rollback();
|
|
|
|
|
throw ($e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Update List Unassigned Group Table
|
|
|
|
|
*
|
|
|
|
|
* @param type $data
|
|
|
|
|
* @return type
|
|
|
|
|
* @throws type
|
|
|
|
|
*/
|
|
|
|
|
public function update($data)
|
|
|
|
|
{
|
2017-02-22 12:12:22 -04:00
|
|
|
if (!empty($data['USR_UID'])) {
|
2017-02-21 16:25:17 -04:00
|
|
|
$u = new Users();
|
|
|
|
|
$data['USR_ID'] = $u->load($data['USR_UID'])['USR_ID'];
|
2017-02-20 11:15:23 -04:00
|
|
|
}
|
2017-02-22 12:12:22 -04:00
|
|
|
$con = Propel::getConnection(ListUnassignedGroupPeer::DATABASE_NAME);
|
2015-03-04 18:42:47 -04:00
|
|
|
try {
|
|
|
|
|
$con->begin();
|
2017-02-22 12:12:22 -04:00
|
|
|
$this->setNew(false);
|
|
|
|
|
$this->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
2015-03-04 18:42:47 -04:00
|
|
|
if ($this->validate()) {
|
|
|
|
|
$result = $this->save();
|
|
|
|
|
$con->commit();
|
|
|
|
|
return $result;
|
|
|
|
|
} else {
|
|
|
|
|
$con->rollback();
|
2017-02-22 12:12:22 -04:00
|
|
|
throw (new Exception("Failed Validation in class " . get_class($this) . "."));
|
2015-03-04 18:42:47 -04:00
|
|
|
}
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
$con->rollback();
|
|
|
|
|
throw ($e);
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-11-07 17:19:35 -04:00
|
|
|
|
2015-03-04 18:42:47 -04:00
|
|
|
/**
|
|
|
|
|
* Remove List Unassigned Group
|
|
|
|
|
*
|
|
|
|
|
* @param type $seqName
|
|
|
|
|
* @return type
|
|
|
|
|
* @throws type
|
|
|
|
|
*
|
|
|
|
|
*/
|
2017-02-22 12:12:22 -04:00
|
|
|
public function remove($app_uid, $una_uid)
|
2015-03-04 18:42:47 -04:00
|
|
|
{
|
2017-02-22 12:12:22 -04:00
|
|
|
$con = Propel::getConnection(ListUnassignedGroupPeer::DATABASE_NAME);
|
2015-03-04 18:42:47 -04:00
|
|
|
try {
|
|
|
|
|
$this->setAppUid($app_uid);
|
|
|
|
|
$this->setUnaUid($una_uid);
|
|
|
|
|
$con->begin();
|
|
|
|
|
$this->delete();
|
|
|
|
|
$con->commit();
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
$con->rollback();
|
|
|
|
|
throw ($e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* newRow List Unassigned Group
|
|
|
|
|
*
|
|
|
|
|
* @param type $seqName
|
|
|
|
|
* @return type
|
|
|
|
|
* @throws type
|
|
|
|
|
*
|
|
|
|
|
*/
|
2017-02-22 12:12:22 -04:00
|
|
|
public function newRow($unaUid, $usrUid, $type, $typeUid = '')
|
|
|
|
|
{
|
2015-03-04 18:42:47 -04:00
|
|
|
$data['UNA_UID'] = $unaUid;
|
|
|
|
|
$data['USR_UID'] = $usrUid;
|
|
|
|
|
$data['TYPE'] = $type;
|
|
|
|
|
$data['TYP_UID'] = $typeUid;
|
|
|
|
|
self::create($data);
|
|
|
|
|
}
|
2014-11-07 17:19:35 -04:00
|
|
|
} // ListUnassignedGroup
|