Example #1
0
 private function process($row)
 {
     // Departamento
     $key_d = "{d}{$row[self::D_COD]}";
     if (!isset($this->added[$key_d])) {
         $d = new Departamento();
         $d->setCodigoDane($row[self::D_COD]);
         $d->setNombre($this->clean($row[self::D_NOM]));
         $this->added[$key_d] = $d;
     }
     $key_m = "{m}{$row[self::M_COD]}";
     //Municipio
     if (!isset($this->added[$key_m])) {
         $m = new Municipio();
         $m->setCodigoDane($row[self::M_COD]);
         $m->setNombre($this->clean($row[self::M_NOM]));
         $m->setDepartamento($this->added[$key_d]);
         $this->added[$key_m] = $m;
     }
     //Centro poblado
     $key_c = "{c}{$row[self::C_COD]}";
     if (!isset($this->added[$key_c])) {
         $c = new CentroPoblado();
         $c->setCodigoDane($row[self::C_COD]);
         $c->setNombre($this->clean($row[self::C_NOM]));
         $c->setTipoDane($row[self::C_TYP]);
         $c->setMunicipio($this->added[$key_m]);
         $this->added[$key_c] = $c;
     }
 }
Example #2
0
 public function __toString()
 {
     if ($this->getNombre() === $this->municipio->getNombre()) {
         return "{$this->municipio->getNombre()}, {$this->municipio->getDepartamento()->getNombre()}";
     }
     return "{$this->nombre} - {$this->municipio->getNombre()}, {$this->municipio->getDepartamento()->getNombre()}";
 }