/** * {@inheritdoc} */ protected function getPermissionForAttribute($class, $identifier, $attribute) { if (is_a($this->object, $this->className, true) && ($this->object->getCustomer() && !$this->object->getCustomer()->getOriginId())) { return self::ACCESS_DENIED; } if (is_a($this->object, $this->className, true) && $this->object->getChannel() && !$this->settingsProvider->isChannelApplicable($this->object->getChannel()->getId())) { return self::ACCESS_DENIED; } if (!$this->settingsProvider->hasApplicableChannels()) { return self::ACCESS_DENIED; } return self::ACCESS_ABSTAIN; }
/** * @param NewsletterSubscriber $newsletterSubscriber * @param int $statusIdentifier * * @return array */ protected function doJob(NewsletterSubscriber $newsletterSubscriber, $statusIdentifier) { $jobResult = $this->get('oro_importexport.job_executor')->executeJob('export', 'magento_newsletter_subscriber_export', ['channel' => $newsletterSubscriber->getChannel()->getId(), 'entity' => $newsletterSubscriber, 'statusIdentifier' => $statusIdentifier, 'writer_skip_clear' => true, 'processorAlias' => 'orocrm_magento']); return ['successful' => $jobResult->isSuccessful(), 'error' => $jobResult->getFailureExceptions(), 'state' => $jobResult->isSuccessful() ? $statusIdentifier : $newsletterSubscriber->getStatus()->getId()]; }