public function saveLimitation($optimizer, $limitationData)
    {
        $rows        = [];
        $optimizerId = (int) $optimizer->getId();

        $this->getConnection()->delete(
            $this->getMainTable(),
            $this->getConnection()->quoteInto(OptimizerInterface::OPTIMIZER_ID . " = ?", $optimizerId)
        );

        $fields = $this->getConnection()->describeTable($this->getMainTable());
        foreach ($limitationData as $item) {
            $item[$this->getIdFieldName()] = $optimizerId;
            $rows[] = array_replace(array_fill_keys(array_keys($fields), null), array_intersect_key($item, $fields));
        }

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

        return $result;
    }
public function saveLimitation($optimizer, $limitationData)
    {
        $rows        = [];
        $optimizerId = (int) $optimizer->getId();

        $this->getConnection()->delete(
            $this->getMainTable(),
            $this->getConnection()->quoteInto(OptimizerInterface::OPTIMIZER_ID . " = ?", $optimizerId)
        );

        $fields = $this->getConnection()->describeTable($this->getMainTable());
        foreach ($limitationData as $item) {
            $item[$this->getIdFieldName()] = $optimizerId;
            $rows[] = array_replace(array_fill_keys(array_keys($fields), null), array_intersect_key($item, $fields));
        }

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

        return $result;
    }
public function saveLimitation ( $ optimizer , $ limitationData ) { $ rows = [ ] ; $ optimizerId = ( int ) $ optimizer -> getId ( ) ; $ this -> getConnection ( ) -> delete ( $ this -> getMainTable ( ) , $ this -> getConnection ( ) -> quoteInto ( OptimizerInterface :: OPTIMIZER_ID . " = ?" , $ optimizerId ) ) ; $ fields = $ this -> getConnection ( ) -> describeTable ( $ this -> getMainTable ( ) ) ; foreach ( $ limitationData as $ item ) { $ item [ $ this -> getIdFieldName ( ) ] = $ optimizerId ; $ rows [ ] = array_replace ( array_fill_keys ( array_keys ( $ fields ) , null ) , array_intersect_key ( $ item , $ fields ) ) ; } $ result = true ; if ( ! empty ( $ rows ) ) { $ result = ( bool ) $ this -> getConnection ( ) -> insertArray ( $ this -> getMainTable ( ) , array_keys ( $ fields ) , $ rows ) ; } return $ result ; }
Save limitation data for a given optimizer.

@param OptimizerInterface $optimizer      The optimizer.
@param array              $limitationData An array containing limitation data to save.

@return bool
@throws \Magento\Framework\Exception\LocalizedException
Save limitation data for a given optimizer .