Пример #1
0
 /**
  * @return Channel
  */
 protected function createChannel()
 {
     $channel = $this->factory->createBuilder()->setName(self::CHANNEL_NAME)->setChannelType(self::CHANNEL_TYPE)->setStatus(Channel::STATUS_ACTIVE)->setOwner($this->em->getRepository('OroOrganizationBundle:Organization')->getFirst())->getChannel();
     $this->em->persist($channel);
     $this->em->flush();
     $this->setReference('default_channel', $channel);
 }
Пример #2
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $om)
 {
     $channel = $this->factory->createBuilder()->setStatus(Channel::STATUS_ACTIVE)->setEntities()->setChannelType(DefaultChannelData::B2B_CHANNEL_TYPE)->setName('B2B channel')->getChannel();
     $om->persist($channel);
     $om->flush();
     $this->addReference('default_channel', $channel);
 }
Пример #3
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $om)
 {
     $builder = $this->factory->createBuilder();
     $builder->setStatus(Channel::STATUS_ACTIVE);
     $builder->setEntities();
     $builder->setChannelType('b2b');
     $channel = $builder->getChannel();
     $om->persist($channel);
     $om->flush();
     $this->addReference('default_channel', $channel);
 }
Пример #4
0
 protected function initSupportingEntities(ObjectManager $manager = null)
 {
     if ($manager) {
         $this->em = $manager;
     }
     $this->users = $this->em->getRepository('OroUserBundle:User')->findAll();
     $this->countries = $this->em->getRepository('OroAddressBundle:Country')->findAll();
     $className = ExtendHelper::buildEnumValueClassName('lead_source');
     $enumRepo = $manager->getRepository($className);
     $this->sources = $enumRepo->findAll();
     $this->channel = $this->channelBuilderFactory->createBuilder()->setChannelType(DefaultChannelData::B2B_CHANNEL_TYPE)->setStatus(Channel::STATUS_ACTIVE)->setEntities()->getChannel();
     $manager->persist($this->channel);
     $manager->flush($this->channel);
 }
Пример #5
0
 /**
  * @param EntityManager $em
  * @param string        $name
  * @param \DateTime     $created
  *
  * @return mixed
  */
 protected function ensureChannelCreated(EntityManager $em, $name, \DateTime $created)
 {
     if (!isset($this->channels[$name])) {
         $builder = $this->factory->createBuilder();
         $builder->setChannelType('custom');
         $builder->setName($name);
         $builder->setCreatedAt($created);
         $channel = $builder->getChannel();
         $em->persist($channel);
         $em->flush($channel);
         $this->channels[$name] = $channel;
     }
     return $this->channels[$name];
 }
Пример #6
0
 /**
  * @return Channel
  */
 protected function createChannel()
 {
     $channel = $this->factory->createBuilder()->setName(self::CHANNEL_NAME)->setChannelType(self::CHANNEL_TYPE)->setStatus(Channel::STATUS_ACTIVE)->setOwner($this->organization)->setEntities()->getChannel();
     $this->em->persist($channel);
     $this->em->flush();
     $this->setReference('default_channel', $channel);
     return $this;
 }