public function uploadcomprobanteAction() { $request = $this->getRequest(); if ($request->isPost()) { $post_data = $request->getPost(); $referencia = new \Referenciaabono(); $referencia->setIdbanco($post_data['idbanco']); $date = new \DateTime(); $upload_folder = '/img/comprobantes-bancos/'; $tipo_archivo = $_FILES['myfile']['type']; $tipo_archivo = explode('/', $tipo_archivo); $tipo_archivo = $tipo_archivo[1]; $nombre_archivo = 'comprbante-banco-' . $post_data['idbanco'] . '-' . microtime() . '.' . $tipo_archivo; $tmp_archivo = $_FILES['myfile']['tmp_name']; $archivador = $upload_folder . $nombre_archivo; if (!move_uploaded_file($tmp_archivo, $_SERVER["DOCUMENT_ROOT"] . $archivador)) { return $this->getResponse()->setContent(\Zend\Json\Json::encode(array('response' => false, 'msg' => 'Ocurrio un error al subir el archivo. No pudo guardarse.', 'status' => 'error'))); } $referencia->setReferenciaabonoArchivo($archivador); $referencia->save(); return true; } $this->getResponse()->setStatusCode(404); return; }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param Referenciaabono $obj A Referenciaabono object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool($obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getIdreferenciaabono(); } // if key === null ReferenciaabonoPeer::$instances[$key] = $obj; } }
/** * Filter the query by a related Referenciaabono object * * @param Referenciaabono|PropelObjectCollection $referenciaabono the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return BancoQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByReferenciaabono($referenciaabono, $comparison = null) { if ($referenciaabono instanceof Referenciaabono) { return $this->addUsingAlias(BancoPeer::IDBANCO, $referenciaabono->getIdbanco(), $comparison); } elseif ($referenciaabono instanceof PropelObjectCollection) { return $this->useReferenciaabonoQuery()->filterByPrimaryKeys($referenciaabono->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByReferenciaabono() only accepts arguments of type Referenciaabono or PropelCollection'); } }
/** * @param Referenciaabono $referenciaabono The referenciaabono object to add. */ protected function doAddReferenciaabono($referenciaabono) { $this->collReferenciaabonos[] = $referenciaabono; $referenciaabono->setBanco($this); }
/** * Exclude object from result * * @param Referenciaabono $referenciaabono Object to remove from the list of results * * @return ReferenciaabonoQuery The current query, for fluid interface */ public function prune($referenciaabono = null) { if ($referenciaabono) { $this->addUsingAlias(ReferenciaabonoPeer::IDREFERENCIAABONO, $referenciaabono->getIdreferenciaabono(), Criteria::NOT_EQUAL); } return $this; }