Example #1
0
 /**
  * Returns built channel
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  *
  * @return Channel
  */
 public function getChannel()
 {
     $type = $this->getDefaultType();
     $name = $this->getDefaultName($type);
     $identity = $this->settingsProvider->getCustomerIdentityFromConfig($type);
     if ($this->populateEntities) {
         $this->entities = $this->settingsProvider->getEntitiesByChannelType($type);
     }
     $this->addEntity($identity, true);
     $owner = $this->owner;
     if (!$owner) {
         $owner = $this->getDefaultOrganization();
     }
     $this->channel->setChannelType($type);
     $this->channel->setName($name);
     $this->channel->setOwner($owner);
     $this->channel->setCustomerIdentity($identity);
     $this->channel->setEntities($this->entities);
     $this->channel->setStatus($this->status);
     $this->channel->setDataSource($this->dataSource);
     if (null !== $this->createdAt) {
         // set created at only whn not nullable, otherwise update scenario will fail
         $this->channel->setCreatedAt($this->createdAt);
     }
     return $this->channel;
 }
Example #2
0
 /**
  * @param string  $key
  * @param Channel $entity
  */
 public function fillEntityData($key, $entity)
 {
     list($name, $type) = explode('|', $key);
     $entity->setName($name);
     $entity->setChannelType($type);
     $entity->setStatus(Channel::STATUS_ACTIVE);
     $entity->setCreatedAt(new \DateTime());
     $entity->setUpdatedAt(new \DateTime());
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $this->em = $manager;
     $date = new \DateTime('now');
     $channel = new Channel();
     $channel->setName('some name')->setOwner($this->loadOwner())->setChannelType('testType')->setCreatedAt($date)->setUpdatedAt($date)->setCustomerIdentity('test1')->setEntities(['test1', 'test2']);
     $manager->persist($channel);
     $this->setReference('default_channel', $channel);
     $manager->flush();
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $this->em = $manager;
     $date = new \DateTime('now');
     $channel = new Channel();
     $channel->setName('first channel')->setStatus(true)->setOwner($this->loadOwner())->setChannelType('testType')->setCreatedAt($date)->setUpdatedAt($date)->setCustomerIdentity('test1')->setEntities(['test1', 'test2']);
     $manager->persist($channel);
     $this->setReference('channel_1', $channel);
     $channel2 = new Channel();
     $channel2->setName('second channel')->setOwner($this->loadOwner())->setChannelType('testType')->setCreatedAt($date)->setUpdatedAt($date)->setCustomerIdentity('test1')->setEntities(['OroCRM\\Bundle\\ChannelBundle\\Entity\\CustomerIdentity']);
     $manager->persist($channel2);
     $this->setReference('channel_2', $channel2);
     $manager->flush();
 }
Example #5
0
 /**
  * Returns built channel
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  *
  * @return Channel
  */
 public function getChannel()
 {
     $type = $this->getDefaultType();
     $name = $this->getDefaultName($type);
     $identity = $this->settingsProvider->getCustomerIdentityFromConfig($type);
     if ($this->populateEntities) {
         $this->entities = $this->settingsProvider->getEntitiesByChannelType($type);
     }
     $this->addEntity($identity, true);
     $owner = $this->owner;
     if (!$owner) {
         $owner = $this->getDefaultOrganization();
     }
     $this->channel->setChannelType($type);
     $this->channel->setName($name);
     $this->channel->setOwner($owner);
     $this->channel->setCustomerIdentity($identity);
     $this->channel->setEntities($this->entities);
     $this->channel->setStatus($this->status);
     $this->channel->setDataSource($this->dataSource);
     return $this->channel;
 }