/**
  * @param Schema $schema
  */
 public function up(Schema $schema)
 {
     // this up() migration is auto-generated, please modify it to your needs
     $em = $this->container->get('doctrine')->getManager();
     $customer = $em->getRepository('CoreBundle:Customer')->findOneBy(['abbr' => 'PAN']);
     $customerContact1 = new Entity\CustomerContact();
     $customerContact1->setFirstName('Nikita');
     $customerContact1->setLastName('Kozlov');
     $customerContact1->setPosition('Programmer');
     $customerContact1->setEmail('*****@*****.**');
     $customerContact1->setCustomer($customer);
     $customerContact1->setPhone('394');
     $customerContact2 = new Entity\CustomerContact();
     $customerContact2->setFirstName('MOW');
     $customerContact2->setLastName('Developers');
     $customerContact2->setPosition('usg-developers');
     $customerContact2->setEmail('*****@*****.**');
     $customerContact2->setCustomer($customer);
     $customerContact2->setPhone('+7(495)9612553');
     $em->persist($customerContact1);
     $em->persist($customerContact2);
     $em->flush();
     $subscriptionTemplate1 = new Entity\EmailSubscriptionTemplate();
     $subscriptionTemplate1->setBody('Внимание! Произошла исключительная ситуация в файле:#FILE#, строке: #LINE_NUM#, код ошибки: #ERROR_CODE#, описание ошибки: #ERROR_MESSAGE#');
     $subscriptionTemplate1->setName('ERROR_OCCURED');
     $em->persist($subscriptionTemplate1);
     $em->flush();
     $subscription1 = new Entity\EmailSubscription();
     $subscription1->setName('ERROR_OCCURED');
     $subscription1->setDescription('PATOOLS сообщение об ошибке');
     $subscription1->setEmailFrom('*****@*****.**');
     $subscription1->setCode('ERROR');
     $subscription1->setCustomer($customer);
     $subscription1->setTemplate($subscriptionTemplate1);
     $em->persist($subscription1);
     $em->flush();
     $subscriber1 = new Entity\EmailSubscriber();
     $subscriber1->setContact($customerContact2);
     $subscriber1->setSubscription($subscription1);
     $subscriber1->setField('to');
     $em->persist($subscriber1);
     $em->flush();
 }
 /**
  * @param Schema $schema
  */
 public function up(Schema $schema)
 {
     $em = $this->container->get('doctrine')->getManager();
     $customer = $em->getRepository('CoreBundle:Customer')->findOneBy(['abbr' => 'PAN']);
     $customerContact1 = new Entity\CustomerContact();
     $customerContact1->setFirstName('Ivan');
     $customerContact1->setLastName('Popov');
     $customerContact1->setPosition('Programmer');
     $customerContact1->setEmail('*****@*****.**');
     $customerContact1->setCustomer($customer);
     $customerContact1->setPhone('366');
     $customerContact2 = new Entity\CustomerContact();
     $customerContact2->setFirstName('Stanislav');
     $customerContact2->setLastName('Biryukov');
     $customerContact2->setPosition('CAPCO');
     $customerContact2->setEmail('*****@*****.**');
     $customerContact2->setCustomer($customer);
     $customerContact2->setPhone('369');
     $em->persist($customerContact1);
     $em->persist($customerContact2);
     $em->flush();
     $subscriptionTemplate1 = new Entity\EmailSubscriptionTemplate();
     $subscriptionTemplate1->setBody('Внимание! CUSRES по ГТД:#DOCUMENT_NUM# не был отправлен во время. Просьба проверить корректность отправки CUSRES');
     $subscriptionTemplate1->setName('CUSRES_NOT_SENT');
     $em->persist($subscriptionTemplate1);
     $em->flush();
     $subscriptionTemplate2 = new Entity\EmailSubscriptionTemplate();
     $subscriptionTemplate2->setBody('Внимание! В ГТД:#DOCUMENT_NUM# не найдены следующие иновойсы: #INVOICE#');
     $subscriptionTemplate2->setName('INVOICE_NOT_FOUND');
     $em->persist($subscriptionTemplate2);
     $em->flush();
     $client = $em->getRepository('CoreBundle:Customer')->findOneBy(['abbr' => 'HP']);
     $subscription1 = new Entity\EmailSubscription();
     $subscription1->setName('CUSRES_NOT_SEND');
     $subscription1->setDescription('CUSRES не отправлен');
     $subscription1->setEmailFrom('*****@*****.**');
     $subscription1->setCode('HPCUSRES');
     $subscription1->setCustomer($client);
     $subscription1->setTemplate($subscriptionTemplate1);
     $em->persist($subscription1);
     $em->flush();
     $subscription2 = new Entity\EmailSubscription();
     $subscription2->setName('INVOICE_NOT_FOUND');
     $subscription2->setDescription('В ГТД не найдены инвойсы');
     $subscription2->setEmailFrom('*****@*****.**');
     $subscription2->setCode('HPINVOICE');
     $subscription2->setCustomer($client);
     $subscription2->setTemplate($subscriptionTemplate2);
     $em->persist($subscription2);
     $em->flush();
     $subscriber1 = new Entity\EmailSubscriber();
     $subscriber1->setContact($customerContact1);
     $subscriber1->setSubscription($subscription1);
     $subscriber1->setField('to');
     $em->persist($subscriber1);
     $subscriber2 = new Entity\EmailSubscriber();
     $subscriber2->setContact($customerContact2);
     $subscriber2->setSubscription($subscription1);
     $subscriber2->setField('to');
     $em->persist($subscriber2);
     $subscriber3 = new Entity\EmailSubscriber();
     $subscriber3->setContact($customerContact1);
     $subscriber3->setSubscription($subscription2);
     $subscriber3->setField('to');
     $em->persist($subscriber3);
     $subscriber4 = new Entity\EmailSubscriber();
     $subscriber4->setContact($customerContact2);
     $subscriber4->setSubscription($subscription2);
     $subscriber4->setField('to');
     $em->persist($subscriber4);
     $em->flush();
 }