getEmails() 공개 메소드

public getEmails ( )
예제 #1
0
 public function testPostWithContactEmail()
 {
     $client = $this->createAuthenticatedClient();
     // no user-email passed, but a unique contact-email
     // so the controller should use the contact-email as the user-email as well
     $client->request('POST', '/api/users', ['username' => 'hikari', 'password' => 'verysecurepassword', 'locale' => 'en', 'contact' => ['id' => $this->contact1->getId(), 'emails' => [['email' => $this->contact1->getEmails()[0]->getEmail()]]], 'userRoles' => [['role' => ['id' => $this->role1->getId()], 'locales' => '["de"]']]]);
     $response = json_decode($client->getResponse()->getContent());
     $this->assertEquals(200, $client->getResponse()->getStatusCode());
     $this->assertEquals('hikari', $response->username);
     $this->assertEquals('*****@*****.**', $response->email);
     $this->assertEquals($this->contact1->getId(), $response->contact->id);
     $this->assertEquals($this->contact1->getEmails()[0]->getEmail(), $response->contact->emails[0]->email);
 }
예제 #2
0
 /**
  * sets Entity's Main-Email.
  *
  * @param Contact|AccountInterface $entity
  */
 public function setMainEmail($entity)
 {
     // set main to first entry or to null
     if ($entity->getEmails()->isEmpty()) {
         $entity->setMainEmail(null);
     } else {
         $entity->setMainEmail($entity->getEmails()->first()->getEmail());
     }
 }