예제 #1
0
 /**
  * @param EntityManager    $em
  * @param SettingsProvider $settingsProvider
  * @param Channel          $channel
  */
 public function __construct(EntityManager $em, SettingsProvider $settingsProvider, Channel $channel)
 {
     $this->em = $em;
     $this->settingsProvider = $settingsProvider;
     $this->channel = $channel;
     $this->channelType = $channel->getChannelType();
     $this->dataSource = $channel->getDataSource();
     $this->name = $channel->getName();
     $this->owner = $channel->getOwner();
     $this->entities = $channel->getEntities();
     $this->status = (bool) $channel->getStatus();
 }
 /**
  * @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);
         }
     }
 }