The following code was returning empty CertificateMapping objects when iterated.
// snippet roughly from the documentation...
$mappingsIterator = $loadBalancer->certificateMappingList();
while ($mappingsIterator->valid()) {
$mapping = $mappingsIterator->current();
echo $mapping->id; // EMPTY ID
$mappingsIterator->next();
}
// the foreach syntax has the same problem...
Inspecting the $elements property on $mappingsIterator was showing the elements in the following structure with correct values:
However, looping the iterator was returning CertificateMapping objects without the id and hostName properties set. This was caused because of the second level in the $elements array being passed into populate, recognizing that there is no property called "certificateMapping" and issuing a warning "Attempted to set certificateMapping with value {id...hostname...}, but the property has not been defined. Please define first."
Adding this method allows populate to recognize that certificateMapping structure and repopulate with the actual values.
It now returns valid CertificateMapping objects with the id and hostname set, making it actually useful.
There were no tests to this portion of the platform so I did not add any to check this behavior.
Coverage decreased (-0.05%) to 88.771% when pulling 3bf08b23054609370669de133a8d28d18d89ff5a on Darunada:fix-load-balancer-certificateMappingList into cce4c2c8d58d9d7726c7eb542730c349c16dcf82 on rackspace:working.
The following code was returning empty CertificateMapping objects when iterated.
Inspecting the $elements property on $mappingsIterator was showing the elements in the following structure with correct values:
However, looping the iterator was returning CertificateMapping objects without the id and hostName properties set. This was caused because of the second level in the $elements array being passed into
populate
, recognizing that there is no property called "certificateMapping" and issuing a warning "Attempted to set certificateMapping with value {id...hostname...}, but the property has not been defined. Please define first."Adding this method allows
populate
to recognize that certificateMapping structure and repopulate with the actual values.It now returns valid CertificateMapping objects with the id and hostname set, making it actually useful.
There were no tests to this portion of the platform so I did not add any to check this behavior.