Пример #1
0
 /**
  * @return array
  */
 public function defaultIntegrationOwnerProvider()
 {
     $integrationEmptyOwner = new Integration();
     $user = $this->getMock('Oro\\Bundle\\UserBundle\\Entity\\User');
     $organization = $this->getMock('Oro\\Bundle\\OrganizationBundle\\Entity\\Organization');
     $integrationWithOwner = new Integration();
     $integrationWithOwner->setDefaultUserOwner($user);
     $integrationWithOrganization = new Integration();
     $integrationWithOrganization->setOrganization($organization);
     return ['should set, user given and user owned entity' => [$integrationWithOwner, 'USER', false, true], 'should set with reload' => [$integrationWithOwner, 'USER', true, true], 'should not set, user not given even if user owned entity' => [$integrationEmptyOwner, 'USER', false, false], 'should not set, user given and BU owned entity' => [$integrationWithOwner, 'BUSINESS_UNIT', false, false], 'set organization' => [$integrationWithOrganization, 'BUSINESS_UNIT', false, false, true]];
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $userManager = $this->container->get('oro_user.manager');
     $admin = $userManager->findUserByEmail(LoadAdminUserData::DEFAULT_ADMIN_EMAIL);
     foreach ($this->data as $data) {
         $integration = new Integration();
         $integration->setName($data['name']);
         $integration->setType($data['type']);
         $integration->setEnabled($data['enabled']);
         $integration->setDefaultUserOwner($admin);
         $integration->setOrganization($admin->getOrganization());
         $this->setReference($data['reference'], $integration);
         $manager->persist($integration);
     }
     $manager->flush();
 }
Пример #3
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $om)
 {
     $this->organization = $this->getReference('default_organization');
     $this->users = $om->getRepository('OroUserBundle:User')->findAll();
     $website = new Website();
     $website->setCode('admin')->setName('Admin');
     $om->persist($website);
     $store = new Store();
     $store->setCode('admin')->setName('Admin')->setWebsite($website);
     $om->persist($store);
     $transport = new MagentoSoapTransport();
     $transport->setApiUser('api_user');
     $transport->setApiKey('api_key');
     $transport->setExtensionVersion(SoapTransport::REQUIRED_EXTENSION_VERSION);
     $transport->setIsExtensionInstalled(true);
     $transport->setMagentoVersion('1.9.1.0');
     $transport->setWsdlUrl('http://magento.domain');
     $om->persist($transport);
     $integration = new Integration();
     $integration->setType('magento');
     $integration->setConnectors(['customer', 'cart', 'order', 'newsletter_subscriber']);
     $integration->setName(self::INTEGRATION_NAME);
     $integration->setTransport($transport);
     $integration->setOrganization($this->organization);
     $om->persist($integration);
     $builder = $this->factory->createBuilderForIntegration($integration);
     $builder->setOwner($integration->getOrganization());
     $builder->setDataSource($integration);
     $builder->setStatus($integration->isEnabled() ? Channel::STATUS_ACTIVE : Channel::STATUS_INACTIVE);
     $this->dataChannel = $builder->getChannel();
     $om->persist($this->dataChannel);
     $group = new CustomerGroup();
     $group->setName('General');
     $group->setOriginId(15000);
     $group->setChannel($integration);
     $om->persist($group);
     $om->flush();
     $this->persistDemoCustomers($om, $website, $store, $group, $integration);
     $om->flush();
     $this->persistDemoCarts($om, $store, $integration);
     $om->flush();
     $this->persistDemoOrders($om, $store, $integration);
     $om->flush();
     $this->persistDemoRFM($om);
     $om->flush();
 }
 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $userManager = $this->container->get('oro_user.manager');
     $admin = $userManager->findUserByEmail(LoadAdminUserData::DEFAULT_ADMIN_EMAIL);
     $organization = $manager->getRepository('OroOrganizationBundle:Organization')->getFirst();
     foreach ($this->channelData as $data) {
         $entity = new Channel();
         $data['transport'] = $this->getReference($data['transport']);
         $entity->setDefaultUserOwner($admin);
         $entity->setOrganization($organization);
         $this->setEntityPropertyValues($entity, $data, ['reference', 'synchronizationSettings']);
         $this->setReference($data['reference'], $entity);
         if (isset($data['synchronizationSettings'])) {
             foreach ($data['synchronizationSettings'] as $key => $value) {
                 $entity->getSynchronizationSettingsReference()->offsetSet($key, $value);
             }
         }
         $manager->persist($entity);
     }
     $manager->flush();
 }
Пример #5
0
 /**
  * @return $this
  */
 protected function createIntegration()
 {
     $integration = new Integration();
     $integration->setName('Demo Web store');
     $integration->setType('magento');
     $integration->setConnectors(["customer", "order", "cart", "region"]);
     $integration->setTransport($this->transport);
     $integration->setOrganization($this->organization);
     $this->em->persist($integration);
     $this->integration = $integration;
     return $this;
 }
Пример #6
0
 /**
  * @return $this
  */
 protected function createIntegration()
 {
     $integration = new Integration();
     $integration->setName('Demo Web store');
     $integration->setType('magento');
     $integration->setConnectors(['customer', 'order', 'cart']);
     $integration->setTransport($this->transport);
     $integration->setOrganization($this->organization);
     $synchronizationSettings = Object::create(['isTwoWaySyncEnabled' => true]);
     $integration->setSynchronizationSettings($synchronizationSettings);
     $this->em->persist($integration);
     $this->integration = $integration;
     return $this;
 }