public function saveDocenteHorarioList($con = null) { if (!$this->isValid()) { throw $this->getErrorSchema(); } if (!isset($this->widgetSchema['docente_horario_list'])) { // somebody has unset this widget return; } if (is_null($con)) { $con = $this->getConnection(); } $c = new Criteria(); $c->add(DocenteHorarioPeer::FK_DOCENTE_ID, $this->object->getPrimaryKey()); DocenteHorarioPeer::doDelete($c, $con); $values = $this->getValue('docente_horario_list'); if (is_array($values)) { foreach ($values as $value) { $obj = new DocenteHorario(); $obj->setFkDocenteId($this->object->getPrimaryKey()); $obj->setFkEventoId($value); $obj->save(); } } }
public function delete(PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); } if ($con === null) { $con = Propel::getConnection(DocenteHorarioPeer::DATABASE_NAME); } try { $con->beginTransaction(); $evento = EventoPeer::retrieveByPk($this->getFkEventoId()); $evento->delete(); DocenteHorarioPeer::doDelete($this, $con); $this->setDeleted(true); $con->commit(); } catch (PropelException $e) { $con->rollBack(); throw $e; } }
public static function doDelete($values, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(EventoPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } if ($values instanceof Criteria) { EventoPeer::clearInstancePool(); $criteria = clone $values; } elseif ($values instanceof Evento) { EventoPeer::removeInstanceFromPool($values); $criteria = $values->buildPkeyCriteria(); } else { $criteria = new Criteria(self::DATABASE_NAME); $criteria->add(EventoPeer::ID, (array) $values, Criteria::IN); foreach ((array) $values as $singleval) { EventoPeer::removeInstanceFromPool($singleval); } } $criteria->setDbName(self::DATABASE_NAME); $affectedRows = 0; try { $con->beginTransaction(); $affectedRows += BasePeer::doDelete($criteria, $con); RelDivisionActividadDocentePeer::clearInstancePool(); DocenteHorarioPeer::clearInstancePool(); HorarioescolarPeer::clearInstancePool(); $con->commit(); return $affectedRows; } catch (PropelException $e) { $con->rollBack(); throw $e; } }
protected function getDocenteHorarioOrCreate($id = 'idDocente', $id2 = 'idEvento') { if (!$this->getRequestParameter($id2)) { $docenteHorario = new DocenteHorario(); } else { $c = new Criteria(); $c->add(DocenteHorarioPeer::FK_DOCENTE_ID, $this->getRequestParameter($id)); $c->add(DocenteHorarioPeer::FK_EVENTO_ID, $this->getRequestParameter($id2)); $docenteHorario = DocenteHorarioPeer::doSelectOne($c); // Esta linea de aca abajo deberia funcionar pero da un error no se si es del propel o que // $docenteHorario = DocenteHorarioPeer::retrieveByPK(array($this->getRequestParameter($id2), $this->getRequestParameter($id)) ); $this->forward404Unless($docenteHorario); } return $docenteHorario; }
public function getDocenteHorariosJoinEvento($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { if ($criteria === null) { $criteria = new Criteria(DocentePeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collDocenteHorarios === null) { if ($this->isNew()) { $this->collDocenteHorarios = array(); } else { $criteria->add(DocenteHorarioPeer::FK_DOCENTE_ID, $this->id); $this->collDocenteHorarios = DocenteHorarioPeer::doSelectJoinEvento($criteria, $con, $join_behavior); } } else { $criteria->add(DocenteHorarioPeer::FK_DOCENTE_ID, $this->id); if (!isset($this->lastDocenteHorarioCriteria) || !$this->lastDocenteHorarioCriteria->equals($criteria)) { $this->collDocenteHorarios = DocenteHorarioPeer::doSelectJoinEvento($criteria, $con, $join_behavior); } } $this->lastDocenteHorarioCriteria = $criteria; return $this->collDocenteHorarios; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = DocenteHorarioPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setFkDocenteId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setFkEventoId($arr[$keys[1]]); } }
public static function retrieveByPK($fk_docente_id, $fk_evento_id, PropelPDO $con = null) { $key = serialize(array((string) $fk_docente_id, (string) $fk_evento_id)); if (null !== ($obj = DocenteHorarioPeer::getInstanceFromPool($key))) { return $obj; } if ($con === null) { $con = Propel::getConnection(DocenteHorarioPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $criteria = new Criteria(DocenteHorarioPeer::DATABASE_NAME); $criteria->add(DocenteHorarioPeer::FK_DOCENTE_ID, $fk_docente_id); $criteria->add(DocenteHorarioPeer::FK_EVENTO_ID, $fk_evento_id); $v = DocenteHorarioPeer::doSelect($criteria, $con); return !empty($v) ? $v[0] : null; }