/** * Exclude object from result * * @param Gastofacturacion $gastofacturacion Object to remove from the list of results * * @return GastofacturacionQuery The current query, for fluid interface */ public function prune($gastofacturacion = null) { if ($gastofacturacion) { $this->addUsingAlias(GastofacturacionPeer::IDGASTOFACTURACION, $gastofacturacion->getIdgastofacturacion(), Criteria::NOT_EQUAL); } return $this; }
/** * Filter the query by a related Gastofacturacion object * * @param Gastofacturacion|PropelObjectCollection $gastofacturacion The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ExpedientegastoQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByGastofacturacion($gastofacturacion, $comparison = null) { if ($gastofacturacion instanceof Gastofacturacion) { return $this->addUsingAlias(ExpedientegastoPeer::IDGASTOFACTURACION, $gastofacturacion->getIdgastofacturacion(), $comparison); } elseif ($gastofacturacion instanceof PropelObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(ExpedientegastoPeer::IDGASTOFACTURACION, $gastofacturacion->toKeyValue('PrimaryKey', 'Idgastofacturacion'), $comparison); } else { throw new PropelException('filterByGastofacturacion() only accepts arguments of type Gastofacturacion or PropelCollection'); } }
public function serversideAction() { $request = $this->getRequest(); if ($request->isPost()) { //EL MAPEO DE NUESTRA TABALA $table_map = array(0 => 'gastofacturacion_nombre', 1 => 'categoriagasto_nombre', 2 => 'gastofacturacion_descripcion', 3 => 'gastofacturacion_iva'); $post_data = $request->getPost(); //NUESTRA QUERY $query = new \GastofacturacionQuery(); //JOIN $query->joinCategoriagasto()->withColumn('categoriagasto_nombre'); //ORDER if (isset($post_data['order'])) { $order = $table_map[$post_data['order'][0]['column']]; $dir = $post_data['order'][0]['dir']; $query->orderBy($order, $dir); } else { $query->orderByIdgastofacturacion(\Criteria::DESC); } if (!empty($post_data['search']['value'])) { $search = $post_data['search']['value']; $c = new \Criteria(); $c1 = $c->getNewCriterion('gastofacturacion.gastofacturacion_nombre', '%' . $search . '%', \Criteria::LIKE); $c2 = $c->getNewCriterion('gastofacturacion.gastofacturacion_descripcion', '%' . $search . '%', \Criteria::LIKE); $c2 = $c->getNewCriterion('categoriagasto.categoriagasto_nombre', '%' . $search . '%', \Criteria::LIKE); $c3 = $c->getNewCriterion('gastofacturacion.gastofacturacion_iva', '%' . $search . '%', \Criteria::LIKE); $c1->addOr($c2)->addOr($c3); $query->addAnd($c1); } //EL TOTAL DE LA BUSQUEDA $recordsFiltered = $query->count(); //SUSTITUIMOS VARIABLES SI NOS LAS ENVIAN POR LA URL if (isset($post_data['url_params']['limit']) && isset($post_data['url_params']['page'])) { $post_data['length'] = (int) $post_data['url_params']['limit']; $post_data['start'] = 0; if ((int) $post_data['url_params']['page'] > 1) { $post_data['start'] = $post_data['url_params']['limit'] * ((int) $post_data['url_params']['page'] - 1); } } //LIMIT $query->setOffset((int) $post_data['start']); $query->setLimit((int) $post_data['length']); //DAMOS EL FORMATO CORRECTO $data = array(); $value = new \Gastofacturacion(); foreach ($query->find() as $value) { $tmp['DT_RowId'] = $value->getIdgastofacturacion(); $tmp['gastofacturacion_nombre'] = $value->getGastofacturacionNombre(); $tmp['categoriagasto_nombre'] = $value->getCategoriagasto()->getCategoriagastoNombre(); $tmp['gastofacturacion_descripcion'] = $value->getGastofacturacionDescripcion(); $tmp['gastofacturacion_iva'] = ucfirst($value->getGastofacturacionIva()) . ' %'; $tmp['gastofacturacion_options'] = '<a data-toggle="tooltip" data-placement="left" title="Editar" href="/catalogo/gastos/editar/' . $value->getIdgastofacturacion() . '"><i class="fa fa-pencil"></i></a><a class="delete" data-toggle="tooltip" data-placement="left" title="Eliminar" href="javascript:void(0)"><i class="fa fa-trash-o"></i></a>'; $data[] = $tmp; } //El arreglo que regresamos $json_data = array("draw" => (int) $post_data['draw'], "recordsFiltered" => $recordsFiltered, "data" => $data, "page" => $post_data['url_params']['page']); return $this->getResponse()->setContent(json_encode($json_data)); } }
/** * 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 Gastofacturacion $obj A Gastofacturacion 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->getIdgastofacturacion(); } // if key === null GastofacturacionPeer::$instances[$key] = $obj; } }
/** * Declares an association between this object and a Gastofacturacion object. * * @param Gastofacturacion $v * @return Expedientegasto The current object (for fluent API support) * @throws PropelException */ public function setGastofacturacion(Gastofacturacion $v = null) { if ($v === null) { $this->setIdgastofacturacion(NULL); } else { $this->setIdgastofacturacion($v->getIdgastofacturacion()); } $this->aGastofacturacion = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Gastofacturacion object, it will not be re-added. if ($v !== null) { $v->addExpedientegasto($this); } return $this; }