Пример #1
0
 /**
  * Changes mailer configuration on runtime
  *
  * @param MailerConfiguration $mailerConfiguration
  *
  * @return \Swift_Mailer
  */
 protected function createMailer(MailerConfiguration $mailerConfiguration)
 {
     $transport = new \Swift_SmtpTransport();
     $transport->setHost($mailerConfiguration->getHost());
     $transport->setPort($mailerConfiguration->getPort());
     $transport->setUsername($mailerConfiguration->getUser());
     $transport->setPassword($mailerConfiguration->getPass());
     return \Swift_Mailer::newInstance($transport);
 }
Пример #2
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     /**
      * @var $theme       \WellCommerce\AppBundle\Entity\ThemeInterface
      * @var $company     \WellCommerce\AppBundle\Entity\CompanyInterface
      * @var $orderStatus \WellCommerce\AppBundle\Entity\OrderStatusInterface
      */
     $theme = $this->getReference('theme');
     $company = $this->getReference('company');
     $currency = $this->randomizeSamples('currency', LoadCurrencyData::$samples);
     $shop = $this->container->get('shop.factory')->create();
     $shop->setName('WellCommerce');
     $shop->setCompany($company);
     $shop->setTheme($theme);
     $shop->setUrl($this->container->getParameter('fallback_hostname'));
     $shop->setDefaultCountry('US');
     $shop->setDefaultCurrency($currency->getCode());
     $mailerConfiguration = new MailerConfiguration();
     $mailerConfiguration->setFrom('');
     $mailerConfiguration->setHost('');
     $mailerConfiguration->setPort('');
     $mailerConfiguration->setUser('');
     $mailerConfiguration->setPass('');
     $shop->setMailerConfiguration($mailerConfiguration);
     $manager->persist($shop);
     $manager->flush();
     $this->setReference('shop', $shop);
 }