class ShippingRatesEvent in Commerce Shipping 8.2
Defines the event for reacting to shipping rate calculation.
Hierarchy
- class \Drupal\commerce_shipping\Event\ShippingRatesEvent extends \Symfony\Component\EventDispatcher\Event
Expanded class hierarchy of ShippingRatesEvent
See also
\Drupal\commerce_shipping\Event\ShippingEvents
4 files declare their use of ShippingRatesEvent
- PromotionSubscriber.php in src/
EventSubscriber/ PromotionSubscriber.php - PromotionSubscriberTest.php in tests/
src/ Kernel/ EventSubscriber/ PromotionSubscriberTest.php - ShipmentManager.php in src/
ShipmentManager.php - ShippingRatesSubscriber.php in tests/
modules/ commerce_shipping_test/ src/ EventSubscriber/ ShippingRatesSubscriber.php
File
- src/
Event/ ShippingRatesEvent.php, line 14
Namespace
Drupal\commerce_shipping\EventView source
class ShippingRatesEvent extends Event {
/**
* The shipping rates.
*
* @var \Drupal\commerce_shipping\ShippingRate[]
*/
protected $rates;
/**
* The shipping method.
*
* @var \Drupal\commerce_shipping\Entity\ShippingMethodInterface
*/
protected $shippingMethod;
/**
* The shipment.
*
* @var \Drupal\commerce_shipping\Entity\ShipmentInterface
*/
protected $shipment;
/**
* Constructs a new ShippingRatesEvent.
*
* @param \Drupal\commerce_shipping\ShippingRate[] $rates
* The shipping rates.
* @param \Drupal\commerce_shipping\Entity\ShippingMethodInterface $shipping_method
* The shipping method calculating the rates.
* @param \Drupal\commerce_shipping\Entity\ShipmentInterface $shipment
* The shipment.
*/
public function __construct(array $rates, ShippingMethodInterface $shipping_method, ShipmentInterface $shipment) {
$this->rates = $rates;
$this->shippingMethod = $shipping_method;
$this->shipment = $shipment;
}
/**
* Gets the shipping rates.
*
* @return \Drupal\commerce_shipping\ShippingRate[]
* The shipping rates.
*/
public function getRates() {
return $this->rates;
}
/**
* Sets the shipping rates.
*
* @param \Drupal\commerce_shipping\ShippingRate[] $rates
* The shipping rates.
*/
public function setRates(array $rates) {
$this->rates = $rates;
}
/**
* Gets the shipping method.
*
* @return \Drupal\commerce_shipping\Entity\ShippingMethodInterface
* The shipping method.
*/
public function getShippingMethod() {
return $this->shippingMethod;
}
/**
* Gets the shipment.
*
* @return \Drupal\commerce_shipping\Entity\ShipmentInterface
* The shipment.
*/
public function getShipment() {
return $this->shipment;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ShippingRatesEvent:: |
protected | property | The shipping rates. | |
ShippingRatesEvent:: |
protected | property | The shipment. | |
ShippingRatesEvent:: |
protected | property | The shipping method. | |
ShippingRatesEvent:: |
public | function | Gets the shipping rates. | |
ShippingRatesEvent:: |
public | function | Gets the shipment. | |
ShippingRatesEvent:: |
public | function | Gets the shipping method. | |
ShippingRatesEvent:: |
public | function | Sets the shipping rates. | |
ShippingRatesEvent:: |
public | function | Constructs a new ShippingRatesEvent. |