コード例 #1
0
ファイル: actions.class.php プロジェクト: mediasadc/alba
 function save($aAlumno, $aDivision)
 {
     //         $aAlumno = $this->getRequest()->getParameterHolder()->get('alumno');
     //         $aDivision = $this->getRequest()->getParameterHolder()->get('division');
     if (count($aAlumno) > 0) {
         if (count($aDivision) > 0) {
             foreach ($aAlumno as $alumno_id) {
                 foreach ($aDivision as $division_id) {
                     //Borro si existe la relacion esta entre esta division y este alumno (Editar)
                     $c = new Criteria();
                     $c->add(RelAlumnoDivisionPeer::FK_ALUMNO_ID, $alumno_id);
                     $c->add(RelAlumnoDivisionPeer::FK_DIVISION_ID, $division_id);
                     RelAlumnoDivisionPeer::doDelete($c);
                     // Doy de alta la nueva relacion entre alumno y division
                     $ad = new RelAlumnoDivision();
                     $ad->setFkAlumnoId($alumno_id);
                     $ad->setFkDivisionId($division_id);
                     $ad->save();
                     unset($ad);
                 }
             }
         }
     }
     //         return $this->redirect('relAlumnoDivision/edit?id='.$usuarioId);
 }
コード例 #2
0
 public function delete(PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getConnection(RelAlumnoDivisionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         RelAlumnoDivisionPeer::doDelete($this, $con);
         $this->setDeleted(true);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
 }