public function nuevoAction() { $request = $this->getRequest(); $idcliente = $this->params()->fromRoute('id'); $cliente = \ClienteQuery::create()->findPk($idcliente); if ($request->isPost()) { $post_data = $request->getPost(); $entity = new \Proveedorcliente(); foreach ($post_data as $key => $value) { if (\ProveedorclientePeer::getTableMap()->hasColumn($key) && !empty($value) && $key != 'cliente_cumpleanios') { $entity->setByName($key, $value, \BasePeer::TYPE_FIELDNAME); } } $entity->setIdcliente($idcliente); $entity->setProveedorclienteTipo('cliente'); $entity->save(); $this->flashMessenger()->addSuccessMessage('Registro guardado exitosamente!'); //REDIRECCIONAMOS A LA ENTIDAD QUE ACABAMOS DE CREAR return $this->redirect()->toUrl('/clientes/ver/' . $idcliente . '?active=clientes'); } $form = new \Admin\Clientes\Form\ProveedorForm($idcliente); $view_model = new ViewModel(); $view_model->setTemplate('admin/clientes/clientesclientes/nuevo'); $view_model->setVariable('form', $form); $view_model->setVariable('cliente', $cliente); return $view_model; }
/** * Filter the query by a related Proveedorcliente object * * @param Proveedorcliente|PropelObjectCollection $proveedorcliente The related object(s) 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 filterByProveedorcliente($proveedorcliente, $comparison = null) { if ($proveedorcliente instanceof Proveedorcliente) { return $this->addUsingAlias(ExpedientePeer::IDCONSIGNATARIOEMBARCADOR, $proveedorcliente->getIdproveedorcliente(), $comparison); } elseif ($proveedorcliente instanceof PropelObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(ExpedientePeer::IDCONSIGNATARIOEMBARCADOR, $proveedorcliente->toKeyValue('PrimaryKey', 'Idproveedorcliente'), $comparison); } else { throw new PropelException('filterByProveedorcliente() only accepts arguments of type Proveedorcliente or PropelCollection'); } }
/** * 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 Proveedorcliente $obj A Proveedorcliente 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->getIdproveedorcliente(); } // if key === null ProveedorclientePeer::$instances[$key] = $obj; } }
/** * Filter the query by a related Proveedorcliente object * * @param Proveedorcliente|PropelObjectCollection $proveedorcliente the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ClienteQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByProveedorcliente($proveedorcliente, $comparison = null) { if ($proveedorcliente instanceof Proveedorcliente) { return $this->addUsingAlias(ClientePeer::IDCLIENTE, $proveedorcliente->getIdcliente(), $comparison); } elseif ($proveedorcliente instanceof PropelObjectCollection) { return $this->useProveedorclienteQuery()->filterByPrimaryKeys($proveedorcliente->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByProveedorcliente() only accepts arguments of type Proveedorcliente or PropelCollection'); } }
/** * Exclude object from result * * @param Proveedorcliente $proveedorcliente Object to remove from the list of results * * @return ProveedorclienteQuery The current query, for fluid interface */ public function prune($proveedorcliente = null) { if ($proveedorcliente) { $this->addUsingAlias(ProveedorclientePeer::IDPROVEEDORCLIENTE, $proveedorcliente->getIdproveedorcliente(), Criteria::NOT_EQUAL); } return $this; }
/** * @param Proveedorcliente $proveedorcliente The proveedorcliente object to add. */ protected function doAddProveedorcliente($proveedorcliente) { $this->collProveedorclientes[] = $proveedorcliente; $proveedorcliente->setCliente($this); }
/** * Resets all references to other model objects or collections of model objects. * * This method is a user-space workaround for PHP's inability to garbage collect * objects with circular references (even in PHP 5.3). This is currently necessary * when using Propel in certain daemon or large-volume/high-memory operations. * * @param boolean $deep Whether to also clear the references on all referrer objects. */ public function clearAllReferences($deep = false) { if ($deep && !$this->alreadyInClearAllReferencesDeep) { $this->alreadyInClearAllReferencesDeep = true; if ($this->collExpedienteanticipos) { foreach ($this->collExpedienteanticipos as $o) { $o->clearAllReferences($deep); } } if ($this->collExpedientearchivos) { foreach ($this->collExpedientearchivos as $o) { $o->clearAllReferences($deep); } } if ($this->collExpedientegastos) { foreach ($this->collExpedientegastos as $o) { $o->clearAllReferences($deep); } } if ($this->collExpedienteservicios) { foreach ($this->collExpedienteservicios as $o) { $o->clearAllReferences($deep); } } if ($this->aCliente instanceof Persistent) { $this->aCliente->clearAllReferences($deep); } if ($this->aProveedorcliente instanceof Persistent) { $this->aProveedorcliente->clearAllReferences($deep); } $this->alreadyInClearAllReferencesDeep = false; } // if ($deep) if ($this->collExpedienteanticipos instanceof PropelCollection) { $this->collExpedienteanticipos->clearIterator(); } $this->collExpedienteanticipos = null; if ($this->collExpedientearchivos instanceof PropelCollection) { $this->collExpedientearchivos->clearIterator(); } $this->collExpedientearchivos = null; if ($this->collExpedientegastos instanceof PropelCollection) { $this->collExpedientegastos->clearIterator(); } $this->collExpedientegastos = null; if ($this->collExpedienteservicios instanceof PropelCollection) { $this->collExpedienteservicios->clearIterator(); } $this->collExpedienteservicios = null; $this->aCliente = null; $this->aProveedorcliente = null; }