/**
  * @return array|false
  */
 private function getUnusedProductAttribute()
 {
     $connection = $this->attributeResource->getConnection();
     $select = $connection->select();
     $select->from($this->attributeResource->getTable('catalog_product_entity_varchar'));
     $select->where('value = ?', 'Simple fixture store');
     return $connection->fetchRow($select);
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function delete(\Magento\Framework\Model\AbstractModel $object)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'delete');
     if (!$pluginInfo) {
         return parent::delete($object);
     } else {
         return $this->___callPlugins('delete', func_get_args(), $pluginInfo);
     }
 }
 /**
  * @param AdapterInterface $connection
  * @param string $attributeTableName
  * @return array
  * @throws \Zend_Db_Statement_Exception
  */
 private function getAffectedAttributeIds(AdapterInterface $connection, $attributeTableName)
 {
     $select = $connection->select()->reset();
     $select->from(['e' => $this->attributeResource->getTable('catalog_product_entity')], 'ei.value_id');
     $select->join(['ei' => $attributeTableName], 'ei.entity_id = e.entity_id AND ei.store_id != 0', '');
     $select->join(['s' => $this->attributeResource->getTable('store')], 's.store_id = ei.store_id', '');
     $select->join(['sg' => $this->attributeResource->getTable('store_group')], 'sg.group_id = s.group_id', '');
     $select->joinLeft(['pw' => $this->attributeResource->getTable('catalog_product_website')], 'pw.website_id = sg.website_id AND pw.product_id = e.entity_id', '');
     $select->where('pw.product_id is null');
     return $connection->fetchCol($select);
 }
 /**
  * {@inheritdoc}
  */
 public function delete(\Magento\Catalog\Api\Data\ProductAttributeInterface $attribute)
 {
     $this->attributeResource->delete($attribute);
     return true;
 }
 /**
  * {@inheritdoc}
  */
 public function getValidationRulesBeforeSave()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getValidationRulesBeforeSave');
     if (!$pluginInfo) {
         return parent::getValidationRulesBeforeSave();
     } else {
         return $this->___callPlugins('getValidationRulesBeforeSave', func_get_args(), $pluginInfo);
     }
 }