/**
  * @param string $entityType
  * @param array $entityData
  * @return array
  * @throws \Exception
  */
 public function execute($entityType, $entityData)
 {
     $linkField = $this->metadataPool->getMetadata($entityType)->getLinkField();
     if (isset($entityData['website_ids'])) {
         $websiteIds = $entityData['website_ids'];
         if (!is_array($websiteIds)) {
             $websiteIds = explode(',', (string) $websiteIds);
         }
         $this->ruleResource->bindRuleToEntity($entityData[$linkField], $websiteIds, 'website');
     }
     if (isset($entityData['customer_group_ids'])) {
         $customerGroupIds = $entityData['customer_group_ids'];
         if (!is_array($customerGroupIds)) {
             $customerGroupIds = explode(',', (string) $customerGroupIds);
         }
         $this->ruleResource->bindRuleToEntity($entityData[$linkField], $customerGroupIds, 'customer_group');
     }
     return $entityData;
 }
 /**
  * {@inheritdoc}
  */
 public function bindRuleToEntity($ruleIds, $entityIds, $entityType)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'bindRuleToEntity');
     if (!$pluginInfo) {
         return parent::bindRuleToEntity($ruleIds, $entityIds, $entityType);
     } else {
         return $this->___callPlugins('bindRuleToEntity', func_get_args(), $pluginInfo);
     }
 }