You are here

class Order in Commerce Core 8.2

Defines the order entity class.

Plugin annotation


@ContentEntityType(
  id = "commerce_order",
  label = @Translation("Order", context = "Commerce"),
  label_collection = @Translation("Orders", context = "Commerce"),
  label_singular = @Translation("order", context = "Commerce"),
  label_plural = @Translation("orders", context = "Commerce"),
  label_count = @PluralTranslation(
    singular = "@count order",
    plural = "@count orders",
    context = "Commerce",
  ),
  bundle_label = @Translation("Order type", context = "Commerce"),
  handlers = {
    "event" = "Drupal\commerce_order\Event\OrderEvent",
    "storage" = "Drupal\commerce_order\OrderStorage",
    "storage_schema" = "Drupal\commerce\CommerceContentEntityStorageSchema",
    "access" = "Drupal\commerce_order\OrderAccessControlHandler",
    "query_access" = "Drupal\commerce_order\OrderQueryAccessHandler",
    "permission_provider" = "Drupal\commerce_order\OrderPermissionProvider",
    "list_builder" = "Drupal\commerce_order\OrderListBuilder",
    "views_data" = "Drupal\commerce\CommerceEntityViewsData",
    "form" = {
      "default" = "Drupal\commerce_order\Form\OrderForm",
      "add" = "Drupal\commerce_order\Form\OrderForm",
      "edit" = "Drupal\commerce_order\Form\OrderForm",
      "delete" = "Drupal\Core\Entity\ContentEntityDeleteForm",
      "unlock" = "Drupal\commerce_order\Form\OrderUnlockForm",
      "resend-receipt" = "Drupal\commerce_order\Form\OrderReceiptResendForm",
    },
    "local_task_provider" = {
      "default" = "Drupal\entity\Menu\DefaultEntityLocalTaskProvider",
    },
    "route_provider" = {
      "default" = "Drupal\commerce_order\OrderRouteProvider",
      "delete-multiple" = "Drupal\entity\Routing\DeleteMultipleRouteProvider",
    },
    "entity_print" = "Drupal\commerce_order\EntityPrint\OrderRenderer"
  },
  base_table = "commerce_order",
  admin_permission = "administer commerce_order",
  permission_granularity = "bundle",
  field_indexes = {
    "order_number",
    "state"
  },
  entity_keys = {
    "id" = "order_id",
    "label" = "order_number",
    "uuid" = "uuid",
    "bundle" = "type"
  },
  links = {
    "canonical" = "/admin/commerce/orders/{commerce_order}",
    "edit-form" = "/admin/commerce/orders/{commerce_order}/edit",
    "delete-form" = "/admin/commerce/orders/{commerce_order}/delete",
    "delete-multiple-form" = "/admin/commerce/orders/delete",
    "reassign-form" = "/admin/commerce/orders/{commerce_order}/reassign",
    "unlock-form" = "/admin/commerce/orders/{commerce_order}/unlock",
    "collection" = "/admin/commerce/orders",
    "resend-receipt-form" = "/admin/commerce/orders/{commerce_order}/resend-receipt",
    "state-transition-form" = "/admin/commerce/orders/{commerce_order}/{field_name}/{transition_id}"
  },
  bundle_entity_type = "commerce_order_type",
  field_ui_base_route = "entity.commerce_order_type.edit_form",
  allow_number_patterns = TRUE,
  log_version_mismatch = TRUE,
  constraints = {
    "OrderVersion" = {}
  }
)

Hierarchy

Expanded class hierarchy of Order

64 files declare their use of Order
AddToCartFormTest.php in modules/cart/tests/src/Functional/AddToCartFormTest.php
AddToCartMultiAttributeTest.php in modules/cart/tests/src/FunctionalJavascript/AddToCartMultiAttributeTest.php
AddToCartMultilingualTest.php in modules/cart/tests/src/FunctionalJavascript/AddToCartMultilingualTest.php
BuyXGetYTest.php in modules/promotion/tests/src/Kernel/Plugin/Commerce/PromotionOffer/BuyXGetYTest.php
CanadianSalesTaxTest.php in modules/tax/tests/src/Kernel/Plugin/Commerce/TaxType/CanadianSalesTaxTest.php

... See full list

2 string references to 'Order'
commerce_log.commerce_log_categories.yml in modules/log/commerce_log.commerce_log_categories.yml
modules/log/commerce_log.commerce_log_categories.yml
commerce_order.workflow_groups.yml in modules/order/commerce_order.workflow_groups.yml
modules/order/commerce_order.workflow_groups.yml

File

modules/order/src/Entity/Order.php, line 96

Namespace

Drupal\commerce_order\Entity
View source
class Order extends CommerceContentEntityBase implements OrderInterface {
  use EntityChangedTrait;

  /**
   * {@inheritdoc}
   */
  public function getOrderNumber() {
    return $this
      ->get('order_number')->value;
  }

  /**
   * {@inheritdoc}
   */
  public function setOrderNumber($order_number) {
    $this
      ->set('order_number', $order_number);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getVersion() {
    return $this
      ->get('version')->value;
  }

  /**
   * {@inheritdoc}
   */
  public function setVersion($version) {
    $this
      ->set('version', $version);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getStore() {
    return $this
      ->getTranslatedReferencedEntity('store_id');
  }

  /**
   * {@inheritdoc}
   */
  public function setStore(StoreInterface $store) {
    $this
      ->set('store_id', $store
      ->id());
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getStoreId() {
    return $this
      ->get('store_id')->target_id;
  }

  /**
   * {@inheritdoc}
   */
  public function setStoreId($store_id) {
    $this
      ->set('store_id', $store_id);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getCustomer() {
    $customer = $this
      ->get('uid')->entity;

    // Handle deleted customers.
    if (!$customer) {
      $customer = User::getAnonymousUser();
    }
    return $customer;
  }

  /**
   * {@inheritdoc}
   */
  public function setCustomer(UserInterface $account) {
    $this
      ->set('uid', $account
      ->id());
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getCustomerId() {
    return $this
      ->get('uid')->target_id;
  }

  /**
   * {@inheritdoc}
   */
  public function setCustomerId($uid) {
    $this
      ->set('uid', $uid);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getEmail() {
    return $this
      ->get('mail')->value;
  }

  /**
   * {@inheritdoc}
   */
  public function setEmail($mail) {
    $this
      ->set('mail', $mail);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getIpAddress() {
    return $this
      ->get('ip_address')->value;
  }

  /**
   * {@inheritdoc}
   */
  public function setIpAddress($ip_address) {
    $this
      ->set('ip_address', $ip_address);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getBillingProfile() {
    return $this
      ->get('billing_profile')->entity;
  }

  /**
   * {@inheritdoc}
   */
  public function setBillingProfile(ProfileInterface $profile) {
    $this
      ->set('billing_profile', $profile);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  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;
  }

  /**
   * {@inheritdoc}
   */
  public function getItems() {
    return $this
      ->get('order_items')
      ->referencedEntities();
  }

  /**
   * {@inheritdoc}
   */
  public function setItems(array $order_items) {
    $this
      ->set('order_items', $order_items);
    $this
      ->recalculateTotalPrice();
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function hasItems() {
    return !$this
      ->get('order_items')
      ->isEmpty();
  }

  /**
   * {@inheritdoc}
   */
  public function addItem(OrderItemInterface $order_item) {
    if (!$this
      ->hasItem($order_item)) {
      $this
        ->get('order_items')
        ->appendItem($order_item);
      $this
        ->recalculateTotalPrice();
    }
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function removeItem(OrderItemInterface $order_item) {
    $index = $this
      ->getItemIndex($order_item);
    if ($index !== FALSE) {
      $this
        ->get('order_items')
        ->offsetUnset($index);
      $this
        ->recalculateTotalPrice();
    }
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function hasItem(OrderItemInterface $order_item) {
    return $this
      ->getItemIndex($order_item) !== FALSE;
  }

  /**
   * Gets the index of the given order item.
   *
   * @param \Drupal\commerce_order\Entity\OrderItemInterface $order_item
   *   The order item.
   *
   * @return int|bool
   *   The index of the given order item, or FALSE if not found.
   */
  protected function getItemIndex(OrderItemInterface $order_item) {
    $values = $this
      ->get('order_items')
      ->getValue();
    $order_item_ids = array_map(function ($value) {
      return $value['target_id'];
    }, $values);
    return array_search($order_item
      ->id(), $order_item_ids);
  }

  /**
   * {@inheritdoc}
   */
  public function getAdjustments(array $adjustment_types = []) {

    /** @var \Drupal\commerce_order\Adjustment[] $adjustments */
    $adjustments = $this
      ->get('adjustments')
      ->getAdjustments();

    // Filter adjustments by type, if needed.
    if ($adjustment_types) {
      foreach ($adjustments as $index => $adjustment) {
        if (!in_array($adjustment
          ->getType(), $adjustment_types)) {
          unset($adjustments[$index]);
        }
      }
      $adjustments = array_values($adjustments);
    }
    return $adjustments;
  }

  /**
   * {@inheritdoc}
   */
  public function setAdjustments(array $adjustments) {
    $this
      ->set('adjustments', $adjustments);
    $this
      ->recalculateTotalPrice();
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function addAdjustment(Adjustment $adjustment) {
    $this
      ->get('adjustments')
      ->appendItem($adjustment);
    $this
      ->recalculateTotalPrice();
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function removeAdjustment(Adjustment $adjustment) {
    $this
      ->get('adjustments')
      ->removeAdjustment($adjustment);
    $this
      ->recalculateTotalPrice();
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function clearAdjustments() {
    $locked_callback = function ($adjustment) {

      /** @var \Drupal\commerce_order\Adjustment $adjustment */
      return $adjustment
        ->isLocked();
    };

    // Remove all unlocked adjustments.
    foreach ($this
      ->getItems() as $order_item) {

      /** @var \Drupal\commerce_order\Adjustment[] $adjustments */
      $adjustments = array_filter($order_item
        ->getAdjustments(), $locked_callback);

      // Convert legacy locked adjustments.
      if ($adjustments && $order_item
        ->usesLegacyAdjustments()) {
        foreach ($adjustments as $index => $adjustment) {
          $adjustments[$index] = $adjustment
            ->multiply($order_item
            ->getQuantity());
        }
      }
      $order_item
        ->set('uses_legacy_adjustments', FALSE);
      $order_item
        ->setAdjustments($adjustments);
    }
    $adjustments = array_filter($this
      ->getAdjustments(), $locked_callback);
    $this
      ->setAdjustments($adjustments);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function collectAdjustments(array $adjustment_types = []) {
    $adjustments = [];
    foreach ($this
      ->getItems() as $order_item) {
      foreach ($order_item
        ->getAdjustments($adjustment_types) as $adjustment) {
        if ($order_item
          ->usesLegacyAdjustments()) {
          $adjustment = $adjustment
            ->multiply($order_item
            ->getQuantity());
        }
        $adjustments[] = $adjustment;
      }
    }
    foreach ($this
      ->getAdjustments($adjustment_types) as $adjustment) {
      $adjustments[] = $adjustment;
    }
    return $adjustments;
  }

  /**
   * {@inheritdoc}
   */
  public function getSubtotalPrice() {

    /** @var \Drupal\commerce_price\Price $subtotal_price */
    $subtotal_price = NULL;
    foreach ($this
      ->getItems() as $order_item) {
      if ($order_item_total = $order_item
        ->getTotalPrice()) {
        $subtotal_price = $subtotal_price ? $subtotal_price
          ->add($order_item_total) : $order_item_total;
      }
    }
    return $subtotal_price;
  }

  /**
   * {@inheritdoc}
   */
  public function recalculateTotalPrice() {

    /** @var \Drupal\commerce_price\Price $total_price */
    $total_price = NULL;
    foreach ($this
      ->getItems() as $order_item) {
      if ($order_item_total = $order_item
        ->getTotalPrice()) {
        $total_price = $total_price ? $total_price
          ->add($order_item_total) : $order_item_total;
      }
    }
    if ($total_price) {
      $adjustments = $this
        ->collectAdjustments();
      if ($adjustments) {

        /** @var \Drupal\commerce_order\AdjustmentTransformerInterface $adjustment_transformer */
        $adjustment_transformer = \Drupal::service('commerce_order.adjustment_transformer');
        $adjustments = $adjustment_transformer
          ->combineAdjustments($adjustments);
        $adjustments = $adjustment_transformer
          ->roundAdjustments($adjustments);
        foreach ($adjustments as $adjustment) {
          if (!$adjustment
            ->isIncluded()) {
            $total_price = $total_price
              ->add($adjustment
              ->getAmount());
          }
        }
      }
    }
    $this->total_price = $total_price;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getTotalPrice() {
    if (!$this
      ->get('total_price')
      ->isEmpty()) {
      return $this
        ->get('total_price')
        ->first()
        ->toPrice();
    }
  }

  /**
   * {@inheritdoc}
   */
  public function getTotalPaid() {
    if (!$this
      ->get('total_paid')
      ->isEmpty()) {
      return $this
        ->get('total_paid')
        ->first()
        ->toPrice();
    }
    elseif ($total_price = $this
      ->getTotalPrice()) {

      // Provide a default without storing it, to avoid having to update
      // the field if the order currency changes before the order is placed.
      return new Price('0', $total_price
        ->getCurrencyCode());
    }
  }

  /**
   * {@inheritdoc}
   */
  public function setTotalPaid(Price $total_paid) {
    $this
      ->set('total_paid', $total_paid);
  }

  /**
   * {@inheritdoc}
   */
  public function getBalance() {
    if ($total_price = $this
      ->getTotalPrice()) {
      return $total_price
        ->subtract($this
        ->getTotalPaid());
    }
  }

  /**
   * {@inheritdoc}
   */
  public function isPaid() {
    $total_price = $this
      ->getTotalPrice();
    if (!$total_price) {
      return FALSE;
    }
    $balance = $this
      ->getBalance();

    // Free orders are considered fully paid once they have been placed.
    if ($total_price
      ->isZero()) {
      return $this
        ->getState()
        ->getId() != 'draft';
    }
    else {
      return $balance
        ->isNegative() || $balance
        ->isZero();
    }
  }

  /**
   * {@inheritdoc}
   */
  public function getState() {
    return $this
      ->get('state')
      ->first();
  }

  /**
   * {@inheritdoc}
   */
  public function getRefreshState() {
    return $this
      ->getData('refresh_state');
  }

  /**
   * {@inheritdoc}
   */
  public function setRefreshState($refresh_state) {
    return $this
      ->setData('refresh_state', $refresh_state);
  }

  /**
   * {@inheritdoc}
   */
  public function getData($key, $default = NULL) {
    $data = [];
    if (!$this
      ->get('data')
      ->isEmpty()) {
      $data = $this
        ->get('data')
        ->first()
        ->getValue();
    }
    return isset($data[$key]) ? $data[$key] : $default;
  }

  /**
   * {@inheritdoc}
   */
  public function setData($key, $value) {
    $this
      ->get('data')
      ->__set($key, $value);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function unsetData($key) {
    if (!$this
      ->get('data')
      ->isEmpty()) {
      $data = $this
        ->get('data')
        ->first()
        ->getValue();
      unset($data[$key]);
      $this
        ->set('data', $data);
    }
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function isLocked() {
    return (bool) $this
      ->get('locked')->value;
  }

  /**
   * {@inheritdoc}
   */
  public function lock() {
    $this
      ->set('locked', TRUE);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function unlock() {
    $this
      ->set('locked', FALSE);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getCreatedTime() {
    return $this
      ->get('created')->value;
  }

  /**
   * {@inheritdoc}
   */
  public function setCreatedTime($timestamp) {
    $this
      ->set('created', $timestamp);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getPlacedTime() {
    return $this
      ->get('placed')->value;
  }

  /**
   * {@inheritdoc}
   */
  public function setPlacedTime($timestamp) {
    $this
      ->set('placed', $timestamp);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getCompletedTime() {
    return $this
      ->get('completed')->value;
  }

  /**
   * {@inheritdoc}
   */
  public function setCompletedTime($timestamp) {
    $this
      ->set('completed', $timestamp);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getCalculationDate() {
    $timezone = $this
      ->getStore()
      ->getTimezone();
    $timestamp = $this
      ->getPlacedTime() ?: \Drupal::time()
      ->getRequestTime();
    $date = DrupalDateTime::createFromTimestamp($timestamp, $timezone);
    return $date;
  }

  /**
   * {@inheritdoc}
   */
  public function preSave(EntityStorageInterface $storage) {
    parent::preSave($storage);
    if (isset($this->original) && !$this
      ->isNew() && $this->original
      ->getVersion() > $this
      ->getVersion()) {
      $mismatch_exception = new OrderVersionMismatchException(sprintf('Attempted to save order %s with version %s. Current version is %s.', $this
        ->id(), $this
        ->getVersion(), $this->original
        ->getVersion()));
      $log_only = $this
        ->getEntityType()
        ->get('log_version_mismatch');
      if ($log_only) {
        watchdog_exception('commerce_order', $mismatch_exception);
      }
      else {
        throw $mismatch_exception;
      }
    }
    $this
      ->setVersion($this
      ->getVersion() + 1);
    if ($this
      ->isNew() && !$this
      ->getIpAddress()) {
      $this
        ->setIpAddress(\Drupal::request()
        ->getClientIp());
    }
    $customer = $this
      ->getCustomer();

    // The customer has been deleted, clear the reference.
    if ($this
      ->getCustomerId() && $customer
      ->isAnonymous()) {
      $this
        ->setCustomerId(0);
    }

    // Maintain the order email.
    if (!$this
      ->getEmail() && $customer
      ->isAuthenticated()) {
      $this
        ->setEmail($customer
        ->getEmail());
    }

    // Make sure the billing profile is owned by the order, not the customer.
    $billing_profile = $this
      ->getBillingProfile();
    if ($billing_profile && $billing_profile
      ->getOwnerId()) {
      $billing_profile
        ->setOwnerId(0);
      $billing_profile
        ->save();
    }
    if ($this
      ->getState()
      ->getId() == 'draft') {

      // Refresh draft orders on every save.
      if (empty($this
        ->getRefreshState())) {
        $this
          ->setRefreshState(self::REFRESH_ON_SAVE);
      }

      // Initialize the flag for OrderStorage::doOrderPreSave().
      if ($this
        ->getData('paid_event_dispatched') === NULL) {
        $this
          ->setData('paid_event_dispatched', FALSE);
      }
    }
  }

  /**
   * {@inheritdoc}
   */
  public function postSave(EntityStorageInterface $storage, $update = TRUE) {
    parent::postSave($storage, $update);

    // Ensure there's a back-reference on each order item.
    foreach ($this
      ->getItems() as $order_item) {
      if ($order_item->order_id
        ->isEmpty()) {
        $order_item->order_id = $this
          ->id();
        $order_item
          ->save();
      }
    }
  }

  /**
   * {@inheritdoc}
   */
  public static function postDelete(EntityStorageInterface $storage, array $entities) {
    parent::postDelete($storage, $entities);

    // Delete the order items of a deleted order.
    $order_items = [];

    /** @var \Drupal\commerce_order\Entity\OrderInterface $entity */
    foreach ($entities as $entity) {
      foreach ($entity
        ->getItems() as $order_item) {
        $order_items[$order_item
          ->id()] = $order_item;
      }
    }

    /** @var \Drupal\commerce_order\OrderItemStorageInterface $order_item_storage */
    $order_item_storage = \Drupal::service('entity_type.manager')
      ->getStorage('commerce_order_item');
    $order_item_storage
      ->delete($order_items);
  }

  /**
   * {@inheritdoc}
   */
  public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    $fields = parent::baseFieldDefinitions($entity_type);
    $fields['order_number'] = BaseFieldDefinition::create('string')
      ->setLabel(t('Order number'))
      ->setDescription(t('The order number displayed to the customer.'))
      ->setRequired(TRUE)
      ->setDefaultValue('')
      ->setSetting('max_length', 255)
      ->setDisplayConfigurable('form', TRUE)
      ->setDisplayConfigurable('view', TRUE);
    $fields['version'] = BaseFieldDefinition::create('integer')
      ->setLabel(t('Version'))
      ->setDescription(t('The order version number, it gets incremented on each save.'))
      ->setReadOnly(TRUE)
      ->setSetting('unsigned', TRUE)
      ->setDefaultValue(0);
    $fields['store_id'] = BaseFieldDefinition::create('entity_reference')
      ->setLabel(t('Store'))
      ->setDescription(t('The store to which the order belongs.'))
      ->setCardinality(1)
      ->setRequired(TRUE)
      ->setSetting('target_type', 'commerce_store')
      ->setSetting('handler', 'default')
      ->setTranslatable(TRUE)
      ->setDisplayConfigurable('form', TRUE)
      ->setDisplayConfigurable('view', TRUE);
    $fields['uid'] = BaseFieldDefinition::create('entity_reference')
      ->setLabel(t('Customer'))
      ->setDescription(t('The customer.'))
      ->setSetting('target_type', 'user')
      ->setSetting('handler', 'default')
      ->setDefaultValueCallback('Drupal\\commerce_order\\Entity\\Order::getCurrentUserId')
      ->setTranslatable(TRUE)
      ->setDisplayOptions('view', [
      'label' => 'above',
      'type' => 'author',
      'weight' => 0,
    ])
      ->setDisplayConfigurable('form', TRUE)
      ->setDisplayConfigurable('view', TRUE);
    $fields['mail'] = BaseFieldDefinition::create('email')
      ->setLabel(t('Contact email'))
      ->setDescription(t('The email address associated with the order.'))
      ->setDefaultValue('')
      ->setSetting('max_length', 255)
      ->setDisplayOptions('view', [
      'label' => 'above',
      'type' => 'string',
      'weight' => 0,
    ])
      ->setDisplayConfigurable('form', TRUE)
      ->setDisplayConfigurable('view', TRUE);
    $fields['ip_address'] = BaseFieldDefinition::create('string')
      ->setLabel(t('IP address'))
      ->setDescription(t('The IP address of the order.'))
      ->setDefaultValue('')
      ->setSetting('max_length', 128)
      ->setDisplayOptions('view', [
      'label' => 'above',
      'type' => 'string',
      'weight' => 0,
    ])
      ->setDisplayOptions('form', [
      'region' => 'hidden',
      'weight' => 0,
    ])
      ->setDisplayConfigurable('form', TRUE)
      ->setDisplayConfigurable('view', TRUE);
    $fields['billing_profile'] = BaseFieldDefinition::create('entity_reference_revisions')
      ->setLabel(t('Billing information'))
      ->setDescription(t('Billing profile'))
      ->setSetting('target_type', 'profile')
      ->setSetting('handler', 'default')
      ->setSetting('handler_settings', [
      'target_bundles' => [
        'customer' => 'customer',
      ],
    ])
      ->setTranslatable(TRUE)
      ->setDisplayOptions('form', [
      'type' => 'commerce_billing_profile',
      'weight' => 0,
      'settings' => [],
    ])
      ->setDisplayConfigurable('form', TRUE)
      ->setDisplayConfigurable('view', TRUE);
    $fields['order_items'] = BaseFieldDefinition::create('entity_reference')
      ->setLabel(t('Order items'))
      ->setDescription(t('The order items.'))
      ->setRequired(TRUE)
      ->setCardinality(BaseFieldDefinition::CARDINALITY_UNLIMITED)
      ->setSetting('target_type', 'commerce_order_item')
      ->setSetting('handler', 'default')
      ->setDisplayOptions('form', [
      'type' => 'inline_entity_form_complex',
      'weight' => 0,
      'settings' => [
        'override_labels' => TRUE,
        'label_singular' => t('order item'),
        'label_plural' => t('order items'),
      ],
    ])
      ->setDisplayOptions('view', [
      'type' => 'commerce_order_item_table',
      'weight' => 0,
    ])
      ->setDisplayConfigurable('form', TRUE)
      ->setDisplayConfigurable('view', TRUE);
    $fields['adjustments'] = BaseFieldDefinition::create('commerce_adjustment')
      ->setLabel(t('Adjustments'))
      ->setCardinality(BaseFieldDefinition::CARDINALITY_UNLIMITED)
      ->setDisplayOptions('form', [
      'type' => 'commerce_adjustment_default',
      'weight' => 0,
    ])
      ->setDisplayConfigurable('form', TRUE)
      ->setDisplayConfigurable('view', FALSE);
    $fields['total_price'] = BaseFieldDefinition::create('commerce_price')
      ->setLabel(t('Total price'))
      ->setDescription(t('The total price of the order.'))
      ->setReadOnly(TRUE)
      ->setDisplayOptions('view', [
      'label' => 'hidden',
      'type' => 'commerce_order_total_summary',
      'weight' => 0,
    ])
      ->setDisplayConfigurable('form', FALSE)
      ->setDisplayConfigurable('view', TRUE);
    $fields['total_paid'] = BaseFieldDefinition::create('commerce_price')
      ->setLabel(t('Total paid'))
      ->setDescription(t('The total paid price of the order.'))
      ->setDisplayConfigurable('form', FALSE)
      ->setDisplayConfigurable('view', TRUE);
    $fields['balance'] = BaseFieldDefinition::create('commerce_price')
      ->setLabel(t('Order balance'))
      ->setDescription(t('The order balance.'))
      ->setReadOnly(TRUE)
      ->setComputed(TRUE)
      ->setClass(OrderBalanceFieldItemList::class)
      ->setDisplayConfigurable('form', FALSE)
      ->setDisplayConfigurable('view', TRUE);
    $fields['state'] = BaseFieldDefinition::create('state')
      ->setLabel(t('State'))
      ->setDescription(t('The order state.'))
      ->setRequired(TRUE)
      ->setSetting('max_length', 255)
      ->setDisplayOptions('view', [
      'label' => 'hidden',
      'type' => 'state_transition_form',
      'settings' => [
        'require_confirmation' => TRUE,
        'use_modal' => TRUE,
      ],
      'weight' => 10,
    ])
      ->setDisplayConfigurable('form', TRUE)
      ->setDisplayConfigurable('view', TRUE)
      ->setSetting('workflow_callback', [
      '\\Drupal\\commerce_order\\Entity\\Order',
      'getWorkflowId',
    ]);
    $fields['data'] = BaseFieldDefinition::create('map')
      ->setLabel(t('Data'))
      ->setDescription(t('A serialized array of additional data.'));
    $fields['locked'] = BaseFieldDefinition::create('boolean')
      ->setLabel(t('Locked'))
      ->setSettings([
      'on_label' => t('Yes'),
      'off_label' => t('No'),
    ])
      ->setDefaultValue(FALSE);
    $fields['created'] = BaseFieldDefinition::create('created')
      ->setLabel(t('Created'))
      ->setDescription(t('The time when the order was created.'));
    $fields['changed'] = BaseFieldDefinition::create('changed')
      ->setLabel(t('Changed'))
      ->setDescription(t('The time when the order was last edited.'))
      ->setDisplayConfigurable('view', TRUE);
    $fields['placed'] = BaseFieldDefinition::create('timestamp')
      ->setLabel(t('Placed'))
      ->setDescription(t('The time when the order was placed.'))
      ->setDisplayOptions('view', [
      'label' => 'above',
      'type' => 'timestamp',
      'weight' => 0,
    ])
      ->setDisplayConfigurable('view', TRUE);
    $fields['completed'] = BaseFieldDefinition::create('timestamp')
      ->setLabel(t('Completed'))
      ->setDescription(t('The time when the order was completed.'))
      ->setDisplayOptions('view', [
      'label' => 'above',
      'type' => 'timestamp',
      'weight' => 0,
    ])
      ->setDisplayConfigurable('view', TRUE);
    return $fields;
  }

  /**
   * Default value callback for 'uid' base field definition.
   *
   * @see ::baseFieldDefinitions()
   *
   * @return array
   *   An array of default values.
   */
  public static function getCurrentUserId() {
    return [
      \Drupal::currentUser()
        ->id(),
    ];
  }

  /**
   * Gets the workflow ID for the state field.
   *
   * @param \Drupal\commerce_order\Entity\OrderInterface $order
   *   The order.
   *
   * @return string
   *   The workflow ID.
   */
  public static function getWorkflowId(OrderInterface $order) {
    $workflow = OrderType::load($order
      ->bundle())
      ->getWorkflowId();
    return $workflow;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheableDependencyTrait::$cacheContexts protected property Cache contexts.
CacheableDependencyTrait::$cacheMaxAge protected property Cache max-age.
CacheableDependencyTrait::$cacheTags protected property Cache tags.
CacheableDependencyTrait::setCacheability protected function Sets cacheability; useful for value object constructors.
CommerceContentEntityBase::ensureTranslations protected function Ensures entities are in the current entity's language, if possible.
CommerceContentEntityBase::getTranslatedReferencedEntities public function Gets the translations of an entity reference field. Overrides CommerceContentEntityInterface::getTranslatedReferencedEntities
CommerceContentEntityBase::getTranslatedReferencedEntity public function Gets the translation of a referenced entity. Overrides CommerceContentEntityInterface::getTranslatedReferencedEntity
ContentEntityBase::$activeLangcode protected property Language code identifying the entity active language.
ContentEntityBase::$defaultLangcode protected property Local cache for the default language code.
ContentEntityBase::$defaultLangcodeKey protected property The default langcode entity key.
ContentEntityBase::$enforceRevisionTranslationAffected protected property Whether the revision translation affected flag has been enforced.
ContentEntityBase::$entityKeys protected property Holds untranslatable entity keys such as the ID, bundle, and revision ID.
ContentEntityBase::$fieldDefinitions protected property Local cache for field definitions.
ContentEntityBase::$fields protected property The array of fields, each being an instance of FieldItemListInterface.
ContentEntityBase::$fieldsToSkipFromTranslationChangesCheck protected static property Local cache for fields to skip from the checking for translation changes.
ContentEntityBase::$isDefaultRevision protected property Indicates whether this is the default revision.
ContentEntityBase::$langcodeKey protected property The language entity key.
ContentEntityBase::$languages protected property Local cache for the available language objects.
ContentEntityBase::$loadedRevisionId protected property The loaded revision ID before the new revision was set.
ContentEntityBase::$newRevision protected property Boolean indicating whether a new revision should be created on save.
ContentEntityBase::$revisionTranslationAffectedKey protected property The revision translation affected entity key.
ContentEntityBase::$translatableEntityKeys protected property Holds translatable entity keys such as the label.
ContentEntityBase::$translationInitialize protected property A flag indicating whether a translation object is being initialized.
ContentEntityBase::$translations protected property An array of entity translation metadata.
ContentEntityBase::$validated protected property Whether entity validation was performed.
ContentEntityBase::$validationRequired protected property Whether entity validation is required before saving the entity.
ContentEntityBase::$values protected property The plain data values of the contained fields.
ContentEntityBase::access public function Checks data value access. Overrides EntityBase::access 1
ContentEntityBase::addTranslation public function Adds a new translation to the translatable object. Overrides TranslatableInterface::addTranslation
ContentEntityBase::bundle public function Gets the bundle of the entity. Overrides EntityBase::bundle
ContentEntityBase::bundleFieldDefinitions public static function Provides field definitions for a specific bundle. Overrides FieldableEntityInterface::bundleFieldDefinitions 4
ContentEntityBase::clearTranslationCache protected function Clear entity translation object cache to remove stale references.
ContentEntityBase::createDuplicate public function Creates a duplicate of the entity. Overrides EntityBase::createDuplicate 1
ContentEntityBase::get public function Gets a field item list. Overrides FieldableEntityInterface::get
ContentEntityBase::getEntityKey protected function Gets the value of the given entity key, if defined. 1
ContentEntityBase::getFieldDefinition public function Gets the definition of a contained field. Overrides FieldableEntityInterface::getFieldDefinition
ContentEntityBase::getFieldDefinitions public function Gets an array of field definitions of all contained fields. Overrides FieldableEntityInterface::getFieldDefinitions
ContentEntityBase::getFields public function Gets an array of all field item lists. Overrides FieldableEntityInterface::getFields
ContentEntityBase::getFieldsToSkipFromTranslationChangesCheck protected function Returns an array of field names to skip in ::hasTranslationChanges. 1
ContentEntityBase::getIterator public function
ContentEntityBase::getLanguages protected function
ContentEntityBase::getLoadedRevisionId public function Gets the loaded Revision ID of the entity. Overrides RevisionableInterface::getLoadedRevisionId
ContentEntityBase::getRevisionId public function Gets the revision identifier of the entity. Overrides RevisionableInterface::getRevisionId
ContentEntityBase::getTranslatableFields public function Gets an array of field item lists for translatable fields. Overrides FieldableEntityInterface::getTranslatableFields
ContentEntityBase::getTranslatedField protected function Gets a translated field.
ContentEntityBase::getTranslation public function Gets a translation of the data. Overrides TranslatableInterface::getTranslation
ContentEntityBase::getTranslationLanguages public function Returns the languages the data is translated to. Overrides TranslatableInterface::getTranslationLanguages
ContentEntityBase::getTranslationStatus public function Returns the translation status. Overrides TranslationStatusInterface::getTranslationStatus
ContentEntityBase::getUntranslated public function Returns the translatable object referring to the original language. Overrides TranslatableInterface::getUntranslated
ContentEntityBase::hasField public function Determines whether the entity has a field with the given name. Overrides FieldableEntityInterface::hasField
ContentEntityBase::hasTranslation public function Checks there is a translation for the given language code. Overrides TranslatableInterface::hasTranslation
ContentEntityBase::hasTranslationChanges public function Determines if the current translation of the entity has unsaved changes. Overrides TranslatableInterface::hasTranslationChanges
ContentEntityBase::id public function Gets the identifier. Overrides EntityBase::id
ContentEntityBase::initializeTranslation protected function Instantiates a translation object for an existing translation.
ContentEntityBase::isDefaultRevision public function Checks if this entity is the default revision. Overrides RevisionableInterface::isDefaultRevision
ContentEntityBase::isDefaultTranslation public function Checks whether the translation is the default one. Overrides TranslatableInterface::isDefaultTranslation
ContentEntityBase::isDefaultTranslationAffectedOnly public function Checks if untranslatable fields should affect only the default translation. Overrides TranslatableRevisionableInterface::isDefaultTranslationAffectedOnly
ContentEntityBase::isLatestRevision public function Checks if this entity is the latest revision. Overrides RevisionableInterface::isLatestRevision
ContentEntityBase::isLatestTranslationAffectedRevision public function Checks whether this is the latest revision affecting this translation. Overrides TranslatableRevisionableInterface::isLatestTranslationAffectedRevision
ContentEntityBase::isNewRevision public function Determines whether a new revision should be created on save. Overrides RevisionableInterface::isNewRevision
ContentEntityBase::isNewTranslation public function Checks whether the translation is new. Overrides TranslatableInterface::isNewTranslation
ContentEntityBase::isRevisionTranslationAffected public function Checks whether the current translation is affected by the current revision. Overrides TranslatableRevisionableInterface::isRevisionTranslationAffected
ContentEntityBase::isRevisionTranslationAffectedEnforced public function Checks if the revision translation affected flag value has been enforced. Overrides TranslatableRevisionableInterface::isRevisionTranslationAffectedEnforced
ContentEntityBase::isTranslatable public function Returns the translation support status. Overrides TranslatableInterface::isTranslatable
ContentEntityBase::isValidationRequired public function Checks whether entity validation is required before saving the entity. Overrides FieldableEntityInterface::isValidationRequired
ContentEntityBase::label public function Gets the label of the entity. Overrides EntityBase::label 2
ContentEntityBase::language public function Gets the language of the entity. Overrides EntityBase::language
ContentEntityBase::onChange public function Reacts to changes to a field. Overrides FieldableEntityInterface::onChange
ContentEntityBase::postCreate public function Acts on a created entity before hooks are invoked. Overrides EntityBase::postCreate
ContentEntityBase::preSaveRevision public function Acts on a revision before it gets saved. Overrides RevisionableInterface::preSaveRevision 2
ContentEntityBase::referencedEntities public function Gets a list of entities referenced by this entity. Overrides EntityBase::referencedEntities 1
ContentEntityBase::removeTranslation public function Removes the translation identified by the given language code. Overrides TranslatableInterface::removeTranslation
ContentEntityBase::set public function Sets a field value. Overrides FieldableEntityInterface::set
ContentEntityBase::setDefaultLangcode protected function Populates the local cache for the default language code.
ContentEntityBase::setNewRevision public function Enforces an entity to be saved as a new revision. Overrides RevisionableInterface::setNewRevision
ContentEntityBase::setRevisionTranslationAffected public function Marks the current revision translation as affected. Overrides TranslatableRevisionableInterface::setRevisionTranslationAffected
ContentEntityBase::setRevisionTranslationAffectedEnforced public function Enforces the revision translation affected flag value. Overrides TranslatableRevisionableInterface::setRevisionTranslationAffectedEnforced
ContentEntityBase::setValidationRequired public function Sets whether entity validation is required before saving the entity. Overrides FieldableEntityInterface::setValidationRequired
ContentEntityBase::toArray public function Gets an array of all property values. Overrides EntityBase::toArray
ContentEntityBase::updateFieldLangcodes protected function Updates language for already instantiated fields.
ContentEntityBase::updateLoadedRevisionId public function Updates the loaded Revision ID with the revision ID. Overrides RevisionableInterface::updateLoadedRevisionId
ContentEntityBase::updateOriginalValues public function Updates the original values with the interim changes.
ContentEntityBase::uuid public function Gets the entity UUID (Universally Unique Identifier). Overrides EntityBase::uuid
ContentEntityBase::validate public function Validates the currently set values. Overrides FieldableEntityInterface::validate
ContentEntityBase::wasDefaultRevision public function Checks whether the entity object was a default revision when it was saved. Overrides RevisionableInterface::wasDefaultRevision
ContentEntityBase::__clone public function Magic method: Implements a deep clone.
ContentEntityBase::__construct public function Constructs an Entity object. Overrides EntityBase::__construct
ContentEntityBase::__get public function Implements the magic method for getting object properties.
ContentEntityBase::__isset public function Implements the magic method for isset().
ContentEntityBase::__set public function Implements the magic method for setting object properties.
ContentEntityBase::__sleep public function Overrides EntityBase::__sleep
ContentEntityBase::__unset public function Implements the magic method for unset().
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function Aliased as: traitSleep 1
DependencySerializationTrait::__wakeup public function 2
EntityBase::$enforceIsNew protected property Boolean indicating whether the entity should be forced to be new.
EntityBase::$entityTypeId protected property The entity type.
EntityBase::$typedData protected property A typed data object wrapping this entity.
EntityBase::create public static function Constructs a new entity object, without permanently saving it. Overrides EntityInterface::create
EntityBase::delete public function Deletes an entity permanently. Overrides EntityInterface::delete 2
EntityBase::enforceIsNew public function Enforces an entity to be new. Overrides EntityInterface::enforceIsNew
EntityBase::entityManager Deprecated protected function Gets the entity manager.
EntityBase::entityTypeBundleInfo protected function Gets the entity type bundle info service.
EntityBase::entityTypeManager protected function Gets the entity type manager.
EntityBase::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyTrait::getCacheContexts
EntityBase::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyTrait::getCacheMaxAge
EntityBase::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyTrait::getCacheTags
EntityBase::getCacheTagsToInvalidate public function Returns the cache tags that should be used to invalidate caches. Overrides EntityInterface::getCacheTagsToInvalidate 2
EntityBase::getConfigDependencyKey public function Gets the key that is used to store configuration dependencies. Overrides EntityInterface::getConfigDependencyKey
EntityBase::getConfigDependencyName public function Gets the configuration dependency name. Overrides EntityInterface::getConfigDependencyName 1
EntityBase::getConfigTarget public function Gets the configuration target identifier for the entity. Overrides EntityInterface::getConfigTarget 1
EntityBase::getEntityType public function Gets the entity type definition. Overrides EntityInterface::getEntityType
EntityBase::getEntityTypeId public function Gets the ID of the type of the entity. Overrides EntityInterface::getEntityTypeId
EntityBase::getListCacheTagsToInvalidate protected function The list cache tags to invalidate for this entity.
EntityBase::getOriginalId public function Gets the original ID. Overrides EntityInterface::getOriginalId 1
EntityBase::getTypedData public function Gets a typed data object for this entity object. Overrides EntityInterface::getTypedData
EntityBase::hasLinkTemplate public function Indicates if a link template exists for a given key. Overrides EntityInterface::hasLinkTemplate
EntityBase::invalidateTagsOnDelete protected static function Invalidates an entity's cache tags upon delete. 1
EntityBase::invalidateTagsOnSave protected function Invalidates an entity's cache tags upon save. 1
EntityBase::isNew public function Determines whether the entity is new. Overrides EntityInterface::isNew 2
EntityBase::languageManager protected function Gets the language manager.
EntityBase::link public function Deprecated way of generating a link to the entity. See toLink(). Overrides EntityInterface::link 1
EntityBase::linkTemplates protected function Gets an array link templates. 1
EntityBase::load public static function Loads an entity. Overrides EntityInterface::load
EntityBase::loadMultiple public static function Loads one or more entities. Overrides EntityInterface::loadMultiple
EntityBase::postLoad public static function Acts on loaded entities. Overrides EntityInterface::postLoad 2
EntityBase::preCreate public static function Changes the values of an entity before it is created. Overrides EntityInterface::preCreate 5
EntityBase::preDelete public static function Acts on entities before they are deleted and before hooks are invoked. Overrides EntityInterface::preDelete 4
EntityBase::save public function Saves an entity permanently. Overrides EntityInterface::save 3
EntityBase::setOriginalId public function Sets the original ID. Overrides EntityInterface::setOriginalId 1
EntityBase::toLink public function Generates the HTML for a link to this entity. Overrides EntityInterface::toLink
EntityBase::toUrl public function Gets the URL object for the entity. Overrides EntityInterface::toUrl 2
EntityBase::uriRelationships public function Gets a list of URI relationships supported by this entity. Overrides EntityInterface::uriRelationships
EntityBase::url public function Gets the public URL for this entity. Overrides EntityInterface::url 2
EntityBase::urlInfo public function Gets the URL object for the entity. Overrides EntityInterface::urlInfo 1
EntityBase::urlRouteParameters protected function Gets an array of placeholders for this entity. 2
EntityBase::uuidGenerator protected function Gets the UUID generator.
EntityChangedTrait::getChangedTime public function Gets the timestamp of the last entity change for the current translation.
EntityChangedTrait::getChangedTimeAcrossTranslations public function Returns the timestamp of the last entity change across all translations.
EntityChangedTrait::setChangedTime public function Sets the timestamp of the last entity change for the current translation.
EntityChangesDetectionTrait::getFieldsToSkipFromTranslationChangesCheck protected function Returns an array of field names to skip when checking for changes. Aliased as: traitGetFieldsToSkipFromTranslationChangesCheck
Order::addAdjustment public function Adds an adjustment. Overrides EntityAdjustableInterface::addAdjustment
Order::addItem public function Adds an order item. Overrides OrderInterface::addItem
Order::baseFieldDefinitions public static function Provides base field definitions for an entity type. Overrides ContentEntityBase::baseFieldDefinitions
Order::clearAdjustments public function Removes all adjustments that belong to the order. Overrides OrderInterface::clearAdjustments
Order::collectAdjustments public function Collects all adjustments that belong to the order. Overrides OrderInterface::collectAdjustments
Order::collectProfiles public function Collects all profiles that belong to the order. Overrides OrderInterface::collectProfiles
Order::getAdjustments public function Gets the adjustments. Overrides EntityAdjustableInterface::getAdjustments
Order::getBalance public function Gets the order balance. Overrides OrderInterface::getBalance
Order::getBillingProfile public function Gets the billing profile. Overrides OrderInterface::getBillingProfile
Order::getCalculationDate public function Gets the calculation date/time for the order. Overrides OrderInterface::getCalculationDate
Order::getCompletedTime public function Gets the order completed timestamp. Overrides OrderInterface::getCompletedTime
Order::getCreatedTime public function Gets the order creation timestamp. Overrides OrderInterface::getCreatedTime
Order::getCurrentUserId public static function Default value callback for 'uid' base field definition.
Order::getCustomer public function Gets the customer user. Overrides OrderInterface::getCustomer
Order::getCustomerId public function Gets the customer user ID. Overrides OrderInterface::getCustomerId
Order::getData public function Gets an order data value with the given key. Overrides OrderInterface::getData
Order::getEmail public function Gets the order email. Overrides OrderInterface::getEmail
Order::getIpAddress public function Gets the order IP address. Overrides OrderInterface::getIpAddress
Order::getItemIndex protected function Gets the index of the given order item.
Order::getItems public function Gets the order items. Overrides OrderInterface::getItems
Order::getOrderNumber public function Gets the order number. Overrides OrderInterface::getOrderNumber
Order::getPlacedTime public function Gets the order placed timestamp. Overrides OrderInterface::getPlacedTime
Order::getRefreshState public function Gets the order refresh state. Overrides OrderInterface::getRefreshState
Order::getState public function Gets the order state. Overrides OrderInterface::getState
Order::getStore public function Gets the store. Overrides EntityStoreInterface::getStore
Order::getStoreId public function Gets the store ID. Overrides EntityStoreInterface::getStoreId
Order::getSubtotalPrice public function Gets the order subtotal price. Overrides OrderInterface::getSubtotalPrice
Order::getTotalPaid public function Gets the total paid price. Overrides OrderInterface::getTotalPaid
Order::getTotalPrice public function Gets the order total price. Overrides OrderInterface::getTotalPrice
Order::getVersion public function Gets the order version identifier. Overrides OrderInterface::getVersion
Order::getWorkflowId public static function Gets the workflow ID for the state field.
Order::hasItem public function Checks whether the order has a given order item. Overrides OrderInterface::hasItem
Order::hasItems public function Gets whether the order has order items. Overrides OrderInterface::hasItems
Order::isLocked public function Gets whether the order is locked. Overrides OrderInterface::isLocked
Order::isPaid public function Gets whether the order has been fully paid. Overrides OrderInterface::isPaid
Order::lock public function Locks the order. Overrides OrderInterface::lock
Order::postDelete public static function Acts on deleted entities before the delete hook is invoked. Overrides EntityBase::postDelete
Order::postSave public function Acts on a saved entity before the insert or update hook is invoked. Overrides ContentEntityBase::postSave
Order::preSave public function Acts on an entity before the presave hook is invoked. Overrides ContentEntityBase::preSave
Order::recalculateTotalPrice public function Recalculates the order total price. Overrides OrderInterface::recalculateTotalPrice
Order::removeAdjustment public function Removes an adjustment. Overrides EntityAdjustableInterface::removeAdjustment
Order::removeItem public function Removes an order item. Overrides OrderInterface::removeItem
Order::setAdjustments public function Sets the adjustments. Overrides EntityAdjustableInterface::setAdjustments
Order::setBillingProfile public function Sets the billing profile. Overrides OrderInterface::setBillingProfile
Order::setCompletedTime public function Sets the order completed timestamp. Overrides OrderInterface::setCompletedTime
Order::setCreatedTime public function Sets the order creation timestamp. Overrides OrderInterface::setCreatedTime
Order::setCustomer public function Sets the customer user. Overrides OrderInterface::setCustomer
Order::setCustomerId public function Sets the customer user ID. Overrides OrderInterface::setCustomerId
Order::setData public function Sets an order data value with the given key. Overrides OrderInterface::setData
Order::setEmail public function Sets the order email. Overrides OrderInterface::setEmail
Order::setIpAddress public function Sets the order IP address. Overrides OrderInterface::setIpAddress
Order::setItems public function Sets the order items. Overrides OrderInterface::setItems
Order::setOrderNumber public function Sets the order number. Overrides OrderInterface::setOrderNumber
Order::setPlacedTime public function Sets the order placed timestamp. Overrides OrderInterface::setPlacedTime
Order::setRefreshState public function Sets the order refresh state. Overrides OrderInterface::setRefreshState
Order::setStore public function Sets the store. Overrides EntityStoreInterface::setStore
Order::setStoreId public function Sets the store ID. Overrides EntityStoreInterface::setStoreId
Order::setTotalPaid public function Sets the total paid price. Overrides OrderInterface::setTotalPaid
Order::setVersion public function Sets the order version identifier. Overrides OrderInterface::setVersion
Order::unlock public function Unlocks the order. Overrides OrderInterface::unlock
Order::unsetData public function Unsets an order data value with the given key. Overrides OrderInterface::unsetData
OrderInterface::REFRESH_ON_LOAD constant
OrderInterface::REFRESH_ON_SAVE constant
OrderInterface::REFRESH_SKIP constant
RefinableCacheableDependencyTrait::addCacheableDependency public function 1
RefinableCacheableDependencyTrait::addCacheContexts public function
RefinableCacheableDependencyTrait::addCacheTags public function
RefinableCacheableDependencyTrait::mergeCacheMaxAge public function
SynchronizableEntityTrait::$isSyncing protected property Whether this entity is being created, updated or deleted through a synchronization process.
SynchronizableEntityTrait::isSyncing public function
SynchronizableEntityTrait::setSyncing public function
TranslationStatusInterface::TRANSLATION_CREATED constant Status code identifying a newly created translation.
TranslationStatusInterface::TRANSLATION_EXISTING constant Status code identifying an existing translation.
TranslationStatusInterface::TRANSLATION_REMOVED constant Status code identifying a removed translation.