code: protected function translateRows($rows)
      {
          $metaModel      = $this->getMetaModel();
          $activeLegend   = $this->translateLegend(
              array('legendtitle' => $metaModel->getName(), 'legendhide' => false),
              $metaModel
          );
          $activeLegendId = null;
  
          // First pass, fetch all attribute names.
          $columnNames = array();
          foreach ($rows as $row) {
              if ($row['dcatype'] != 'attribute') {
                  continue;
              }
  
              $attribute = $metaModel->getAttributeById($row['attr_id']);
              if ($attribute) {
                  $columnNames[$row['id']] = $attribute->getColName();
              }
          }
  
          $this->propertyMap  = $columnNames;
          $this->propertyMap2 = array_flip($columnNames);
  
          // Second pass, translate all information into local properties.
          foreach ($rows as $row) {
              switch ($row['dcatype']) {
                  case 'legend':
                      $activeLegend   = $this->translateLegend($row, $metaModel);
                      $activeLegendId = $row['id'];
                      break;
  
                  case 'attribute':
                      $exists = $this->translateProperty($row, $metaModel, $activeLegend);
  
                      if ($exists && $activeLegendId) {
                          $this->applyLegendConditions($row['id'], $activeLegendId);
                      }
  
                      break;
  
                  default:
                      throw new \RuntimeException('Unknown palette rendering mode ' . $row['dcatype']);
              }
          }
      }
docs: Translate database rows into legend and property information.
  
  @param array $rows The database rows.
  
  @return void
  
  @throws \RuntimeException When an unknown palette rendering mode is encountered
  (neither 'legend' nor 'attribute').