Exemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $this->em = $manager;
     $organization = $manager->getRepository('OroOrganizationBundle:Organization')->getFirst();
     $this->createChannel();
     $contactUsRequest = new ContactRequest();
     $contactUsRequest->setFirstName('fname');
     $contactUsRequest->setLastName('lname');
     $contactUsRequest->setPhone('123123123');
     $contactUsRequest->setEmailAddress('*****@*****.**');
     $contactUsRequest->setComment('some comment');
     $contactUsRequest->setDataChannel($this->getReference('default_channel'));
     $contactUsRequest->setOwner($organization);
     $this->em->persist($contactUsRequest);
     $this->em->flush();
     $this->setReference('default_contact_us_request', $contactUsRequest);
 }
Exemplo n.º 2
0
 /**
  * @param ObjectManager $om
  */
 protected function persistDemoContactUsForm(ObjectManager $om)
 {
     foreach ($this->contactRequests as $contactRequest) {
         $request = new ContactRequest();
         $contactRequest['contactReason'] = $om->getRepository('OroCRMContactUsBundle:ContactReason')->findOneBy(array('label' => $contactRequest['contactReason']));
         foreach ($contactRequest as $property => $value) {
             call_user_func_array(array($request, 'set' . ucfirst($property)), array($value));
         }
         $request->setPreferredContactMethod(ContactRequest::CONTACT_METHOD_BOTH);
         $request->setCreatedAt(new \DateTime('now', new \DateTimeZone('UTC')));
         $request->setOwner($this->organization);
         $request->setDataChannel($this->dataChannel);
         $om->persist($request);
     }
 }