public function executeBorrarAdjunto() { $id = $this->getRequestParameter('id'); $this->forward404Unless($id); $informe = InformePeer::retrieveByPk($id); $informe->setFkAdjuntoId(); $informe->save(); $adjunto = AdjuntoPeer::retrieveByPk($informe->getFkAdjuntoId()); unlink(sfConfig::get('sf_informe_dir') . DIRECTORY_SEPARATOR . $adjunto->getRuta()); $adjunto->delete(); return $this->redirect("informes?action=edit&id=" . $id); }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = AdjuntoPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setDescripcion($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setTitulo($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setNombreArchivo($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setTipoArchivo($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setRuta($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setFecha($arr[$keys[6]]); } }
public function getAdjunto(PropelPDO $con = null) { if ($this->aAdjunto === null && $this->fk_adjunto_id !== null) { $c = new Criteria(AdjuntoPeer::DATABASE_NAME); $c->add(AdjuntoPeer::ID, $this->fk_adjunto_id); $this->aAdjunto = AdjuntoPeer::doSelectOne($c, $con); } return $this->aAdjunto; }
public static function doSelectJoinAllExceptTipoinforme(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } InformePeer::addSelectColumns($c); $startcol2 = InformePeer::NUM_COLUMNS - InformePeer::NUM_LAZY_LOAD_COLUMNS; AdjuntoPeer::addSelectColumns($c); $startcol3 = $startcol2 + (AdjuntoPeer::NUM_COLUMNS - AdjuntoPeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(InformePeer::FK_ADJUNTO_ID), array(AdjuntoPeer::ID), $join_behavior); $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = InformePeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = InformePeer::getInstanceFromPool($key1))) { } else { $omClass = InformePeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); InformePeer::addInstanceToPool($obj1, $key1); } $key2 = AdjuntoPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = AdjuntoPeer::getInstanceFromPool($key2); if (!$obj2) { $omClass = AdjuntoPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); AdjuntoPeer::addInstanceToPool($obj2, $key2); } $obj2->addInforme($obj1); } $results[] = $obj1; } $stmt->closeCursor(); return $results; }
public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(AdjuntoPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(AdjuntoPeer::DATABASE_NAME); $criteria->add(AdjuntoPeer::ID, $pks, Criteria::IN); $objs = AdjuntoPeer::doSelect($criteria, $con); } return $objs; }