You are here

public function CommerceDiscountControllerExportable::import in Commerce Discount 7

Imports an entity from a string.

Parameters

string $export: An exported entity as serialized string.

Return value

object An entity object not yet saved.

Overrides EntityAPIController::import

File

includes/commerce_discount.controller.inc, line 46
The controller for the discount entity containing the CRUD operations.

Class

CommerceDiscountControllerExportable
Controller for discount entities; Overrides CRUD operations.

Code

public function import($export) {
  $entity = parent::import($export);
  $discount_offer = $entity->commerce_discount_offer;
  unset($entity->commerce_discount_offer);
  $entity->commerce_discount_offer = array(
    'commerce_discount_fields' => $discount_offer,
  );
  return $entity;
}