/** * @param Channel $channel */ protected function validateIntegration(Channel $channel) { $errorLabel = 'orocrm.channel.form.integration_invalid.label'; $field = 'dataSource'; $integrationType = $this->provider->getIntegrationType($channel->getChannelType()); if (!empty($integrationType)) { $integration = $channel->getDataSource(); if (empty($integration)) { $this->context->addViolationAt($field, $errorLabel); } } }
/** * @param SettingsProvider $settingsProvider * @param string $integrationType * * @return bool|string */ protected function getChannelTypeForIntegration(SettingsProvider $settingsProvider, $integrationType) { $channelTypeConfigs = $settingsProvider->getSettings(SettingsProvider::CHANNEL_TYPE_PATH); foreach ($channelTypeConfigs as $channelTypeName => $config) { if ($settingsProvider->getIntegrationType($channelTypeName) == $integrationType) { return $channelTypeName; } } return false; }