Пример #1
0
 protected static function doOnDeleteCascade(Criteria $criteria, Connection $con)
 {
     $affectedRows = 0;
     $objects = ReligionPeer::doSelect($criteria, $con);
     foreach ($objects as $obj) {
         include_once 'lib/model/EmployeeDetail.php';
         $c = new Criteria();
         $c->add(EmployeeDetailPeer::RELIGION_ID, $obj->getId());
         $affectedRows += EmployeeDetailPeer::doDelete($c, $con);
         include_once 'lib/model/EmployeeDetail.php';
         $c = new Criteria();
         $c->add(EmployeeDetailPeer::SPOUSE_RELIGION_ID, $obj->getId());
         $affectedRows += EmployeeDetailPeer::doDelete($c, $con);
     }
     return $affectedRows;
 }
Пример #2
0
 public function delete($con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getConnection(EmployeeDetailPeer::DATABASE_NAME);
     }
     try {
         $con->begin();
         EmployeeDetailPeer::doDelete($this, $con);
         $this->setDeleted(true);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollback();
         throw $e;
     }
 }