public function Order::collectProfiles in Commerce Core 8.2
Collects all profiles that belong to the order.
This includes the billing profile, plus other profiles added by modules through event subscribers (e.g. the shipping profile).
Return value
\Drupal\profile\Entity\ProfileInterface[] The order's profiles, keyed by scope (billing, shipping, etc).
Overrides OrderInterface::collectProfiles
File
- modules/
order/ src/ Entity/ Order.php, line 243
Class
- Order
- Defines the order entity class.
Namespace
Drupal\commerce_order\EntityCode
public function collectProfiles() {
$profiles = [];
if ($billing_profile = $this
->getBillingProfile()) {
$profiles['billing'] = $billing_profile;
}
// Allow other modules to register their own profiles (e.g. shipping).
$event = new OrderProfilesEvent($this, $profiles);
\Drupal::service('event_dispatcher')
->dispatch(OrderEvents::ORDER_PROFILES, $event);
$profiles = $event
->getProfiles();
return $profiles;
}