Sulu\Bundle\ContactBundle\Contact\ContactManagerInterface::getByIds PHP Method

getByIds() public method

Returns api entities.
public getByIds ( $ids, $locale ) : mixed
$ids
$locale
return mixed
    public function getByIds($ids, $locale);

Usage Example

 public function testGetContentDataOrderOnlyContact()
 {
     $type = new ContactSelectionContentType($this->template, $this->contactManager->reveal(), $this->accountManager->reveal(), $this->serializer->reveal(), new CustomerIdConverter(), new IndexComparator());
     $contact1 = $this->prophesize(Contact::class);
     $contact2 = $this->prophesize(Contact::class);
     $contact3 = $this->prophesize(Contact::class);
     $contact1->getId()->willReturn(1);
     $contact2->getId()->willReturn(2);
     $contact3->getId()->willReturn(3);
     $dataUnsorted = [$contact1->reveal(), $contact2->reveal(), $contact3->reveal()];
     $data = [$contact2->reveal(), $contact1->reveal(), $contact3->reveal()];
     $this->property->getValue()->willReturn(['c2', 'c1', 'c3']);
     $this->contactManager->getByIds([2, 1, 3], $this->locale)->willReturn($dataUnsorted);
     $this->accountManager->getByIds([], $this->locale)->willReturn([]);
     $this->serializer->serialize($data[0], 'array', Argument::type(SerializationContext::class))->willReturn($data[0]);
     $this->serializer->serialize($data[1], 'array', Argument::type(SerializationContext::class))->willReturn($data[1]);
     $this->serializer->serialize($data[2], 'array', Argument::type(SerializationContext::class))->willReturn($data[2]);
     $contacts = $type->getContentData($this->property->reveal());
     $this->assertCount(3, $contacts);
     $this->assertEquals($contact2->reveal(), $contacts[0]);
     $this->assertEquals($contact1->reveal(), $contacts[1]);
     $this->assertEquals($contact3->reveal(), $contacts[2]);
 }
All Usage Examples Of Sulu\Bundle\ContactBundle\Contact\ContactManagerInterface::getByIds