This commit is contained in:
Julio Cesar Laura Avendaño
2016-12-08 17:02:13 -05:00
parent a0f6329164
commit 0950649001
17 changed files with 1571 additions and 124 deletions

View File

@@ -10,7 +10,7 @@ class AppAssignSelfServiceValue extends BaseAppAssignSelfServiceValue
*
* return void
*/
public function create($applicationUid, $delIndex, array $arrayData)
public function create($applicationUid, $delIndex, array $arrayData, $dataVariable)
{
try {
$cnn = Propel::getConnection(AppAssignSelfServiceValuePeer::DATABASE_NAME);
@@ -25,10 +25,17 @@ class AppAssignSelfServiceValue extends BaseAppAssignSelfServiceValue
if ($appAssignSelfServiceValue->validate()) {
$cnn->begin();
$result = $appAssignSelfServiceValue->save();
$cnn->commit();
//SELECT LAST_INSERT_ID()
$stmt = $cnn->createStatement();
$rs = $stmt->executeQuery("SELECT LAST_INSERT_ID()", ResultSet::FETCHMODE_ASSOC);
$rs->next();
$row = $rs->getRow();
$appAssignSelfServiceValueId = $row['LAST_INSERT_ID()'];
$appAssignSelfServiceValueGroup = new AppAssignSelfServiceValueGroup();
$appAssignSelfServiceValueGroup->createRows($appAssignSelfServiceValueId, $dataVariable);
} else {
$msg = "";
@@ -68,6 +75,17 @@ class AppAssignSelfServiceValue extends BaseAppAssignSelfServiceValue
}
$result = AppAssignSelfServiceValuePeer::doDelete($criteria);
// Delete related rows and missing relations, criteria don't execute delete with joins
$cnn = Propel::getConnection(AppAssignSelfServiceValueGroupPeer::DATABASE_NAME);
$cnn->begin();
$stmt = $cnn->createStatement();
$rs = $stmt->executeQuery("DELETE " . AppAssignSelfServiceValueGroupPeer::TABLE_NAME . "
FROM " . AppAssignSelfServiceValueGroupPeer::TABLE_NAME . "
LEFT JOIN " . AppAssignSelfServiceValuePeer::TABLE_NAME . "
ON (" . AppAssignSelfServiceValueGroupPeer::ID . " = " . AppAssignSelfServiceValuePeer::ID . ")
WHERE " . AppAssignSelfServiceValuePeer::ID . " IS NULL");
$cnn->commit();
} catch (Exception $e) {
throw $e;
}