function libCorpBiomaByPais($sqPais)
{
    try {
        $voPais = PaisValueObject::factory()->setSqPais($sqPais);
        $tmpResult = BiomaBusiness::factory()->findByPais($voPais);
        $tmpTxt = '<result>';
        foreach ($tmpResult as $result) {
            $tmpTxt .= $result->toXml();
        }
        $tmpTxt .= '</result>';
        return $tmpTxt;
    } catch (\Exception $excp) {
        throw new IOException($excp->getMessage());
    }
}
Example #2
0
 /**
  * Efetua pesquisa de bioma por Pais
  *
  * @param PaisValueObject
  * @return ResultSet
  * */
 public function findByPais(PaisValueObject $pais)
 {
     try {
         $query = 'SELECT bio.sq_bioma,
                          bio.no_bioma
                   FROM corporativo.pais p
                   INNER JOIN corporativo.bioma bio ON bio.the_geom && p.the_geom AND st_intersects(bio.the_geom, p.the_geom)
                   WHERE p.sq_pais = :sqPais';
         $params['sqPais'] = new \stdClass();
         $params['sqPais']->type = 'integer';
         $params['sqPais']->value = (int) $pais->getSqPais();
         # executa query
         return $this->execute($query, $params);
     } catch (IllegalArgumentException $iae) {
         throw new PersistException(self::EXP_ILLEGALARGUMENT);
     } catch (\exception $exp) {
         throw new PersistException(self::EXP_PERSIST);
     }
 }