Exemplo n.º 1
0
 public static function init($row, $id = null)
 {
     $objMaestroBase = new MaestroBase();
     try {
         if (is_null($id)) {
             $objMaestroBase->setId($row->ma_ba_id);
         } else {
             $objMaestroBase->setId($row->{$id});
             throw new \Exception();
         }
         $objMaestroBase->setNombre($row->ma_ba_nombre);
         $objMaestroBase->setActivo($row->ma_ba_activo);
         $objMaestroBase->setCodigo($row->ma_ba_codigo);
         $objMaestroBase->setCodigoAlternativo($row->ma_ba_codigo_alternativo);
         $objMaestroBase->setCodigoAlternativo1($row->ma_ba_codigo_alternativo1);
         $objMaestroBase->setCodigoArbol($row->ma_ba_codigo_arbol);
         $objMaestroBase->setLook($row->ma_ba_look);
         $objMaestroBase->setNumeroDocumento($row->ma_ba_numero_documento);
         $objMaestroBase->setUnidadMedida($row->ma_ba_unidad_medida);
         $objMaestroBase->isFromDb(true);
     } catch (\Exception $e) {
         return $objMaestroBase;
     }
     $maestroPadre = MaestroBaseDao::init($row, "ma_ba_padre");
     $objMaestroBase->setPadre($maestroPadre);
     $maestroTipoDocumento = MaestroBaseDao::init($row, "ma_ba_tipo_documento");
     $objMaestroBase->setTipoDocumento($maestroTipoDocumento);
     return $objMaestroBase;
 }