コード例 #1
0
    /**
     * Removes this object from datastore and sets delete attribute.
     *
     * @param      Connection $con
     * @return     void
     * @throws     PropelException
     * @see        BaseObject::setDeleted()
     * @see        BaseObject::isDeleted()
     */
    public function delete($con = null)
    {
        if ($this->isDeleted()) {
            throw new PropelException("This object has already been deleted.");
        }

        if ($con === null) {
            $con = Propel::getConnection(ProcessVariablesPeer::DATABASE_NAME);
        }

        try {
            $con->begin();
            ProcessVariablesPeer::doDelete($this, $con);
            $this->setDeleted(true);
            $con->commit();
        } catch (PropelException $e) {
            $con->rollback();
            throw $e;
        }
    }
コード例 #2
0
ファイル: Variable.php プロジェクト: emildev35/processmaker
 /**
  * Delete Variable
  *
  * @param string $processUid Unique id of Process
  * @param string $variableUid Unique id of Variable
  *
  * return void
  */
 public function delete($processUid, $variableUid)
 {
     try {
         //Verify data
         Validator::proUid($processUid, '$prj_uid');
         $this->throwExceptionIfNotExistsVariable($variableUid);
         $variable = $this->getVariable($processUid, $variableUid);
         \G::LoadClass('pmDynaform');
         $pmDynaform = new \pmDynaform();
         $isUsed = $pmDynaform->isUsed($processUid, $variable);
         if ($isUsed !== false) {
             $titleDynaform = $pmDynaform->getDynaformTitle($isUsed);
             throw new \Exception(\G::LoadTranslation("ID_VARIABLE_IN_USE", array($titleDynaform)));
         }
         //Delete
         $criteria = new \Criteria("workflow");
         $criteria->add(\ProcessVariablesPeer::VAR_UID, $variableUid);
         \ProcessVariablesPeer::doDelete($criteria);
     } catch (\Exception $e) {
         throw $e;
     }
 }