toArray() public method

Returns an array of LdapObjects. To get the results in a simple array for you should change the hydration when executing the query.
public toArray ( ) : LdapObject[]
return LdapObject[]
 function it_should_sort_on_multiple_attributes_asc()
 {
     $this->beConstructedWith(['firstName' => 'ASC', 'lastName' => 'ASC']);
     $this->sort($this->toSort)->shouldHaveFirstValue('lastName', 'Feng');
     $this->sort($this->toSort)->shouldHaveFirstValue('firstName', 'Amy');
     $this->sort($this->collection->toArray())->shouldHaveFirstValue('lastName', 'Feng');
     $this->sort($this->collection->toArray())->shouldHaveFirstValue('firstName', 'Amy');
 }
 function it_should_transform_a_ldap_object_collection_to_its_id_values_specified_by_the_annotation($entity, $eventArgs, $reader, $metadata, \ReflectionProperty $rp, LdapObjectCollection $collection, \LdapTools\Object\LdapObject $ldapObject1, \LdapTools\Object\LdapObject $ldapObject2)
 {
     $annotation = new LdapObject();
     $collection->toArray()->shouldBeCalled()->willReturn([$ldapObject1, $ldapObject2]);
     $metadata->getReflectionProperties()->shouldBeCalled()->willReturn([$rp]);
     $reader->getPropertyAnnotation($rp, Argument::any())->shouldBeCalled()->willReturn($annotation);
     $rp->getValue($entity)->shouldBeCalled()->willReturn($collection);
     // This is the default attribute value to use...
     $ldapObject1->get('guid')->shouldBeCalled()->willReturn('foo');
     $ldapObject2->get('guid')->shouldBeCalled()->willReturn('bar');
     $rp->setValue($entity, ['foo', 'bar'])->shouldBeCalled();
     $this->prePersist($eventArgs);
 }
 function it_should_load_values_for_choices($qb, $query)
 {
     $collection = new LdapObjectCollection(new LdapObject(['name' => 'foo', 'guid' => '123'], ['user'], 'user', 'user'), new LdapObject(['name' => 'bar', 'guid' => '456'], ['user'], 'user', 'user'));
     $this->loadValuesForChoices($collection->toArray())->shouldBeEqualTo(['123', '456']);
     $qb->select(['guid', 'name'])->shouldBeCalled()->willReturn($qb);
     $qb->from("user")->shouldBeCalled()->willReturn($qb);
     $collection = new LdapObjectCollection(new LdapObject(['name' => 'foo', 'guid' => '123'], ['user'], 'user', 'user'), new LdapObject(['name' => 'bar', 'guid' => '456'], ['user'], 'user', 'user'));
     $query->getResult()->shouldBeCalled()->willReturn($collection);
     $this->loadChoiceList();
     $this->loadValuesForChoices($collection->toArray())->shouldBeEqualTo(['123', '456']);
 }