本文整理匯總了PHP中Drupal\Core\Entity\ContentEntityBase::postLoad方法的典型用法代碼示例。如果您正苦於以下問題:PHP ContentEntityBase::postLoad方法的具體用法?PHP ContentEntityBase::postLoad怎麽用?PHP ContentEntityBase::postLoad使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Drupal\Core\Entity\ContentEntityBase
的用法示例。
在下文中一共展示了ContentEntityBase::postLoad方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: postLoad
/**
* {@inheritdoc}
*/
public static function postLoad(EntityStorageInterface $storage, array &$orders)
{
parent::postLoad($storage, $orders);
foreach ($orders as $id => $order) {
$order->products = \Drupal::entityManager()->getStorage('uc_order_product')->loadByProperties(['order_id' => $id]);
// Load line items... has to be last after everything has been loaded.
$order->line_items = $order->getLineItems();
}
}
示例2: postLoad
/**
* {@inheritdoc}
*/
public static function postLoad(EntityStorageInterface $storage, array &$items)
{
foreach ($items as $item) {
$item->product = uc_product_load_variant($item->nid->target_id, $item->data->first()->toArray());
if ($item->product) {
$item->title = $item->product->label();
$item->model = $item->product->model;
$item->cost = $item->product->cost->value;
$item->price = $item->product->price;
$item->weight = $item->product->weight->value;
$item->weight_units = $item->product->weight->units;
}
$item->module = $item->data->module;
}
parent::postLoad($storage, $items);
}