You are here

public function Asset::__construct in Asset 7

Basic constructor.

Overrides Entity::__construct

File

includes/asset.controllers.inc, line 22
Provides a controller classes for Asset and related entities

Class

Asset
Use a separate class for assets so we can specify some defaults.

Code

public function __construct($values = array()) {
  if (isset($values['user'])) {
    $values['uid'] = $values['user']->uid;
    unset($values['user']);
  }
  if (isset($values['type']) && is_object($values['type'])) {
    $values['type'] = $values['type']->type;
  }
  parent::__construct($values, 'asset');
  if (!isset($this->uid)) {
    $this->uid = $GLOBALS['user']->uid;
  }
  if (!isset($this->created)) {
    $this->created = REQUEST_TIME;
  }
}