public function saveAttributesData(int $categoryId, array $data)
    {
        $rows = [];
        $this->deleteByCategoryId($categoryId);

        $fields = $this->getConnection()->describeTable($this->getMainTable());
        foreach ($data as $item) {
            $item[$this->getIdFieldName()] = $categoryId;
            $row                           = $this->buildRow($item, $fields);
            if ($this->isValid($row)) {
                $rows[] = $row;
            }
        }

        $result = true;
        if (!empty($rows)) {
            $result = (bool) $this->getConnection()->insertArray($this->getMainTable(), array_keys($fields), $rows);
        }

        return $result;
    }
public function saveAttributesData(int $categoryId, array $data)
    {
        $rows = [];
        $this->deleteByCategoryId($categoryId);

        $fields = $this->getConnection()->describeTable($this->getMainTable());
        foreach ($data as $item) {
            $item[$this->getIdFieldName()] = $categoryId;
            $row                           = $this->buildRow($item, $fields);
            if ($this->isValid($row)) {
                $rows[] = $row;
            }
        }

        $result = true;
        if (!empty($rows)) {
            $result = (bool) $this->getConnection()->insertArray($this->getMainTable(), array_keys($fields), $rows);
        }

        return $result;
    }
public function saveAttributesData ( int $ categoryId , array $ data ) { $ rows = [ ] ; $ this -> deleteByCategoryId ( $ categoryId ) ; $ fields = $ this -> getConnection ( ) -> describeTable ( $ this -> getMainTable ( ) ) ; foreach ( $ data as $ item ) { $ item [ $ this -> getIdFieldName ( ) ] = $ categoryId ; $ row = $ this -> buildRow ( $ item , $ fields ) ; if ( $ this -> isValid ( $ row ) ) { $ rows [ ] = $ row ; } } $ result = true ; if ( ! empty ( $ rows ) ) { $ result = ( bool ) $ this -> getConnection ( ) -> insertArray ( $ this -> getMainTable ( ) , array_keys ( $ fields ) , $ rows ) ; } return $ result ; }
Save Layered Navigation Filters configuration for a given category.

@param int   $categoryId The category Id
@param array $data       layered navigation filters configuration data.

@return array
@throws \Magento\Framework\Exception\LocalizedException
Save Layered Navigation Filters configuration for a given category .