/**
  * Retorna articulos segun tag
  * @return object
  */
 public function generar_paginacion_articulos_segun_tag()
 {
     $sEntrada = Input::get('sEntrada');
     $oArticuloCaracteristicaValorCategoria = new ArticuloCaracteristicaValorCategoria();
     $oElementosPaginacion = $oArticuloCaracteristicaValorCategoria->Obtener_todos_segun_tag($sEntrada);
     //dd($oElementosPaginacion);die;
     // Get pagination information and slice the results.
     $iElementpsPorPagina = 8;
     $iTotalElementosPaginacion = count($oElementosPaginacion);
     $start = (Paginator::getCurrentPage() - 1) * $iElementpsPorPagina;
     $sliced = array_slice($oElementosPaginacion, $start, $iElementpsPorPagina);
     // Eager load the relation.
     $oColeccion = Articulo::hydrate($sliced);
     // Create a paginator instance.
     return Paginator::make($oColeccion->all(), $iTotalElementosPaginacion, $iElementpsPorPagina);
 }
예제 #2
0
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     PropelPDO $con A connection object
  *
  * @return                 Articulo A model object, or null if the key is not found
  * @throws PropelException
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT `idarticulo`, `idtipo`, `articulo_nombre`, `articulo_descripcion` FROM `articulo` WHERE `idarticulo` = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $obj = new Articulo();
         $obj->hydrate($row);
         ArticuloPeer::addInstanceToPool($obj, (string) $key);
     }
     $stmt->closeCursor();
     return $obj;
 }