public static function retrieveWithoutNP($nota_pedido_id) { $sql = 'SELECT %s '; $sql .= 'FROM %s '; $sql .= 'WHERE %s = %s'; $sql = sprintf($sql, CompraPeer::PRODUCTO_ID, CompraPeer::TABLE_NAME, CompraPeer::NOTA_PEDIDO_ID, $nota_pedido_id); $conexion = Propel::getConnection(); $sentencia = $conexion->prepare($sql); $sentencia->execute(); $idExcluidos = array(); while ($resultSet = $sentencia->fetch(PDO::FETCH_ASSOC)) { array_push($idExcluidos, $resultSet['PRODUCTO_ID']); } $c = new Criteria(); $c->add(ProductoPeer::ID, $idExcluidos, Criteria::NOT_IN); $c->addAscendingOrderByColumn(ProductoPeer::NOMBRE); $productos = ProductoPeer::doSelect($c); return $productos; }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(ProductoPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(ProductoPeer::DATABASE_NAME); $criteria->add(ProductoPeer::IDPRODUCTO, $pks, Criteria::IN); $objs = ProductoPeer::doSelect($criteria, $con); } return $objs; }