class UcOrderController in Ubercart 7.3
Controller class for uc_order entity.
Hierarchy
- class \DrupalDefaultEntityController implements DrupalEntityControllerInterface
- class \UcOrderController
Expanded class hierarchy of UcOrderController
1 string reference to 'UcOrderController'
- uc_order_entity_info in uc_order/
uc_order.module - Implements hook_entity_info().
File
- uc_order/
uc_order.controller.inc, line 11 - Contains controller classes for uc_order and uc_order_product entities.
View source
class UcOrderController extends DrupalDefaultEntityController {
function attachLoad(&$orders, $revision_id = FALSE) {
foreach ($orders as &$order) {
$order->data = unserialize($order->data);
$efq = new EntityFieldQuery();
$result = $efq
->entityCondition('entity_type', 'uc_order_product')
->propertyCondition('order_id', $order->order_id)
->propertyOrderBy('order_product_id', 'ASC')
->execute();
if (!empty($result['uc_order_product'])) {
$order->products = uc_order_product_load_multiple(array_keys($result['uc_order_product']), TRUE);
foreach ($order->products as $product) {
$product->order = $order;
$product->order_uid = $order->uid;
}
}
else {
$order->products = array();
}
uc_order_module_invoke('load', $order, NULL);
// Load line items... has to be last after everything has been loaded.
$order->line_items = uc_order_load_line_items($order);
$fields = array();
// Make sure the total still matches up...
if (($total = uc_order_get_total($order)) !== $order->order_total) {
$fields['order_total'] = $total;
$order->order_total = $total;
}
if (($count = uc_order_get_product_count($order)) !== $order->product_count) {
$fields['product_count'] = $count;
$order->product_count = $count;
}
if (count($fields)) {
$query = db_update('uc_orders')
->fields($fields)
->condition('order_id', $order->order_id)
->execute();
}
}
parent::attachLoad($orders, $revision_id);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DrupalDefaultEntityController:: |
protected | property | Whether this entity type should use the static cache. | |
DrupalDefaultEntityController:: |
protected | property | Static cache of entities, keyed by entity ID. | |
DrupalDefaultEntityController:: |
protected | property | Array of information about the entity. | |
DrupalDefaultEntityController:: |
protected | property | Entity type for this controller instance. | |
DrupalDefaultEntityController:: |
protected | property | Additional arguments to pass to hook_TYPE_load(). | |
DrupalDefaultEntityController:: |
protected | property | Name of the entity's ID field in the entity database table. | |
DrupalDefaultEntityController:: |
protected | property | Name of entity's revision database table field, if it supports revisions. | |
DrupalDefaultEntityController:: |
protected | property | The table that stores revisions, if the entity supports revisions. | |
DrupalDefaultEntityController:: |
protected | function | Builds the query to load the entity. | 4 |
DrupalDefaultEntityController:: |
protected | function | Gets entities from the static cache. | 1 |
DrupalDefaultEntityController:: |
protected | function | Stores entities in the static entity cache. | |
DrupalDefaultEntityController:: |
protected | function | Ensures integer entity IDs are valid. | |
DrupalDefaultEntityController:: |
protected | function | Callback for array_filter that removes non-integer IDs. | |
DrupalDefaultEntityController:: |
public | function |
Implements DrupalEntityControllerInterface::load(). Overrides DrupalEntityControllerInterface:: |
|
DrupalDefaultEntityController:: |
public | function |
Implements DrupalEntityControllerInterface::resetCache(). Overrides DrupalEntityControllerInterface:: |
|
DrupalDefaultEntityController:: |
public | function | Constructor: sets basic variables. | |
UcOrderController:: |
function |
Attaches data to entities upon loading. Overrides DrupalDefaultEntityController:: |