/** * Filter the query by a related Expedienteservicio object * * @param Expedienteservicio|PropelObjectCollection $expedienteservicio the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ExpedienteQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByExpedienteservicio($expedienteservicio, $comparison = null) { if ($expedienteservicio instanceof Expedienteservicio) { return $this->addUsingAlias(ExpedientePeer::IDEXPEDIENTE, $expedienteservicio->getIdexpediente(), $comparison); } elseif ($expedienteservicio instanceof PropelObjectCollection) { return $this->useExpedienteservicioQuery()->filterByPrimaryKeys($expedienteservicio->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByExpedienteservicio() only accepts arguments of type Expedienteservicio or PropelCollection'); } }
public function nuevoservicioAction() { $request = $this->getRequest(); if ($request->isPost()) { $post_data = $request->getPost(); $entity = new \Expedienteservicio(); foreach ($post_data as $key => $value) { if (\ExpedienteservicioPeer::getTableMap()->hasColumn($key) && !empty($value) && $key != 'expedienteservicio_fecha') { $entity->setByName($key, $value, \BasePeer::TYPE_FIELDNAME); } } //LA FECHA $expedienteservicio_fecha = \DateTime::createFromFormat('d/m/Y', $post_data['expedienteservicio_fecha']); $entity->setExpedienteservicioFecha($expedienteservicio_fecha); $entity->save(); $this->flashMessenger()->addSuccessMessage('Registro guardado exitosamente!'); //REDIRECCIONAMOS A LA ENTIDAD QUE ACABAMOS DE CREAR return $this->redirect()->toUrl('/clientes/ver/' . $entity->getExpediente()->getIdcliente() . '/expedientes/ver/' . $entity->getIdexpediente()); } $idexpediente = $this->params()->fromQuery('idexpediente'); $expediente = \ExpedienteQuery::create()->findPk($idexpediente); $servicios_array = array(); if ($expediente->getExpedienteTipo() == 'importacion') { $servicios = \ServicioQuery::create()->filterByServicioTipo('importacion')->find(); } else { $servicios = \ServicioQuery::create()->filterByServicioTipo('exportacion')->find(); } $servicio = new \Servicio(); foreach ($servicios as $servicio) { $idservicio = $servicio->getIdservicio(); $servicios_array[$idservicio] = $servicio->getServicioNombre(); } //Instanciamos nuestro formulario $form = new \Admin\Clientes\Form\ServicioForm($idexpediente); //Enviamos a la vista $view_model = new ViewModel(); $view_model->setTerminal(true)->setVariable('form', $form)->setVariable('entity', $expediente)->setTemplate('/clientes/expedientes/modal/nuevoservicio'); return $view_model; }