/**
  * @param Channel $channel
  */
 protected function validateCustomerIdentity(Channel $channel)
 {
     $errorLabel = 'orocrm.channel.form.customer_identity_selected_not_correctly.label';
     $fieldName = 'customerIdentity';
     $entities = $channel->getEntities();
     if (!in_array($channel->getCustomerIdentity(), $entities)) {
         $this->context->addViolationAt($fieldName, $errorLabel);
     }
 }
Exemple #2
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
  * @param array   $entitiesToAdd
  */
 protected function addEntitiesToChannel(Channel $channel, array $entitiesToAdd)
 {
     $entities = $channel->getEntities();
     $entities = is_array($entities) ? $entities : [];
     $combinedEntities = array_unique(array_merge($entities, $entitiesToAdd));
     $channel->setEntities($combinedEntities);
 }