/**
  * {@inheritdoc}
  */
 public function sort(array $columns, array $context = [])
 {
     $identifier = $this->productRepository->getIdentifierProperties()[0];
     if (isset($context['filters']['structure']['attributes']) && !empty($context['filters']['structure']['attributes'])) {
         $rawColumns = array_merge([$identifier], $this->firstDefaultColumns, array_map(function ($associationType) {
             return $associationType->getCode();
         }, $this->associationTypeRepository->findAll()), $context['filters']['structure']['attributes']);
         $sortedColumns = [];
         foreach ($rawColumns as $columnCode) {
             $sortedColumns = array_merge($sortedColumns, array_filter($columns, function ($columnCandidate) use($columnCode) {
                 return 0 !== preg_match(sprintf('/^%s(-.*)*/', $columnCode), $columnCandidate);
             }));
         }
         return $sortedColumns;
     }
     array_unshift($this->firstDefaultColumns, $identifier);
     return parent::sort($columns);
 }
 /**
  * {@inheritdoc}
  */
 public function sort(array $columns)
 {
     $identifier = $this->productRepository->getIdentifierProperties()[0];
     array_unshift($this->firstDefaultColumns, $identifier);
     return parent::sort($columns);
 }