Sulu\Bundle\ContactBundle\Entity\PhoneType::getId PHP Method

getId() public method

Get id.
public getId ( ) : integer
return integer
    public function getId()
    {
        return $this->id;
    }

Usage Example

Exemplo n.º 1
0
 public function testPutRemovedAccount()
 {
     $client = $this->createTestClient();
     $client->request('PUT', '/api/contacts/' . $this->contact->getId(), ['firstName' => 'John', 'lastName' => 'Doe', 'title' => $this->contactTitle->getId(), 'position' => ['id' => $this->contactPosition->getId(), 'position' => $this->contactPosition->getPosition()], 'account' => ['id' => $this->account1->getId()], 'emails' => [['id' => $this->email->getId(), 'email' => '*****@*****.**', 'emailType' => ['id' => $this->emailType->getId(), 'name' => 'Private']], ['email' => '*****@*****.**', 'emailType' => ['id' => $this->emailType->getId(), 'name' => 'Private']]], 'phones' => [['id' => $this->phone->getId(), 'phone' => '321654987', 'phoneType' => ['id' => $this->phoneType->getId(), 'name' => 'Private']], ['phone' => '789456123', 'phoneType' => ['id' => $this->phoneType->getId(), 'name' => 'Private']], ['phone' => '147258369', 'phoneType' => ['id' => $this->phoneType->getId(), 'name' => 'Private']]], 'addresses' => [['id' => $this->address->getId(), 'street' => 'Street', 'number' => '2', 'zip' => '9999', 'city' => 'Springfield', 'state' => 'Colorado', 'country' => ['id' => $this->country->getId(), 'name' => 'Musterland', 'code' => 'ML'], 'addressType' => ['id' => $this->addressType->getId(), 'name' => 'Private'], 'note' => 'note']], 'notes' => [['id' => $this->note->getId(), 'value' => 'Note 1_1']], 'salutation' => 'Sehr geehrter John', 'formOfAddress' => ['id' => 0]]);
     $response = json_decode($client->getResponse()->getContent());
     $this->assertEquals('John', $response->firstName);
     $this->assertEquals('Doe', $response->lastName);
     $this->assertEquals('MSc', $response->title->title);
     $this->assertEquals($this->account1->getId(), $response->account->id);
     $this->assertEquals('*****@*****.**', $response->emails[0]->email);
     $this->assertEquals('*****@*****.**', $response->emails[1]->email);
     $this->assertEquals('321654987', $response->phones[0]->phone);
     $this->assertEquals('789456123', $response->phones[1]->phone);
     $this->assertEquals('147258369', $response->phones[2]->phone);
     $this->assertEquals('Street', $response->addresses[0]->street);
     $this->assertEquals('note', $response->addresses[0]->note);
     $this->assertEquals('2', $response->addresses[0]->number);
     $this->assertEquals('9999', $response->addresses[0]->zip);
     $this->assertEquals('Springfield', $response->addresses[0]->city);
     $this->assertEquals('Colorado', $response->addresses[0]->state);
     $this->assertEquals('Note 1_1', $response->notes[0]->value);
     $this->assertEquals(1, count($response->notes));
     $this->assertEquals(0, $response->formOfAddress);
     $this->assertEquals('Sehr geehrter John', $response->salutation);
     $client->request('PUT', '/api/contacts/' . $this->contact->getId(), ['firstName' => 'John', 'lastName' => 'Doe', 'title' => $this->contactTitle->getId(), 'position' => ['id' => $this->contactPosition->getId(), 'position' => $this->contactPosition->getPosition()], 'account' => ['id' => null], 'emails' => [['id' => $this->email->getId(), 'email' => '*****@*****.**', 'emailType' => ['id' => $this->emailType->getId(), 'name' => 'Private']], ['id' => $response->emails[1]->id, 'email' => '*****@*****.**', 'emailType' => ['id' => $this->emailType->getId(), 'name' => 'Private']]], 'phones' => [['id' => $response->phones[0]->id, 'phone' => '321654987', 'phoneType' => ['id' => $this->phoneType->getId(), 'name' => 'Private']], ['id' => $response->phones[1]->id, 'phone' => '789456123', 'phoneType' => ['id' => $this->phoneType->getId(), 'name' => 'Private']], ['id' => $response->phones[2]->id, 'phone' => '147258369', 'phoneType' => ['id' => $this->phoneType->getId(), 'name' => 'Private']]], 'addresses' => [['id' => $this->address->getId(), 'street' => 'Street', 'number' => '2', 'zip' => '9999', 'city' => 'Springfield', 'state' => 'Colorado', 'country' => ['id' => $this->country->getId(), 'name' => 'Musterland', 'code' => 'ML'], 'addressType' => ['id' => $this->addressType->getId(), 'name' => 'Private'], 'note' => 'note1']], 'notes' => [['id' => $this->note->getId(), 'value' => 'Note 1_1']]]);
     $response = json_decode($client->getResponse()->getContent());
     $this->assertEquals('John', $response->firstName);
     $this->assertEquals('Doe', $response->lastName);
     $this->assertEquals('MSc', $response->title->title);
     $this->assertObjectNotHasAttribute('account', $response);
     $this->assertEquals('*****@*****.**', $response->emails[0]->email);
     $this->assertEquals('*****@*****.**', $response->emails[1]->email);
     $this->assertEquals('321654987', $response->phones[0]->phone);
     $this->assertEquals('789456123', $response->phones[1]->phone);
     $this->assertEquals('Street', $response->addresses[0]->street);
     $this->assertEquals('note1', $response->addresses[0]->note);
     $this->assertEquals('2', $response->addresses[0]->number);
     $this->assertEquals('9999', $response->addresses[0]->zip);
     $this->assertEquals('Springfield', $response->addresses[0]->city);
     $this->assertEquals('Colorado', $response->addresses[0]->state);
     $this->assertEquals('Note 1_1', $response->notes[0]->value);
     $this->assertEquals(1, count($response->notes));
     $this->assertEquals(0, $response->formOfAddress);
     $this->assertEquals('Sehr geehrter John', $response->salutation);
     $client->request('GET', '/api/contacts/' . $response->id);
     $response = json_decode($client->getResponse()->getContent());
     $this->assertEquals('John', $response->firstName);
     $this->assertEquals('Doe', $response->lastName);
     $this->assertEquals('MSc', $response->title->title);
     $this->assertObjectNotHasAttribute('account', $response);
     $this->assertEquals('*****@*****.**', $response->emails[0]->email);
     $this->assertEquals('*****@*****.**', $response->emails[1]->email);
     $this->assertEquals('321654987', $response->phones[0]->phone);
     $this->assertEquals('789456123', $response->phones[1]->phone);
     $this->assertEquals('147258369', $response->phones[2]->phone);
     $this->assertEquals('Street', $response->addresses[0]->street);
     $this->assertEquals('2', $response->addresses[0]->number);
     $this->assertEquals('9999', $response->addresses[0]->zip);
     $this->assertEquals('Springfield', $response->addresses[0]->city);
     $this->assertEquals('Colorado', $response->addresses[0]->state);
     $this->assertEquals('Note 1_1', $response->notes[0]->value);
     $this->assertEquals(1, count($response->notes));
     $this->assertEquals(0, $response->formOfAddress);
     $this->assertEquals('Sehr geehrter John', $response->salutation);
 }