public function MerciDefaultEntityController::create in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3
Create a new entity.
Parameters
array $values: An array of values to set, keyed by property name.
Return value
A new instance of the entity type.
Overrides EntityAPIControllerInterface::create
1 call to MerciDefaultEntityController::create()
- MerciLineItemEntityControllerDeprecated::create in merci_line_item/
includes/ merci_line_item.controller.inc - Create a new entity.
1 method overrides MerciDefaultEntityController::create()
- MerciLineItemEntityControllerDeprecated::create in merci_line_item/
includes/ merci_line_item.controller.inc - Create a new entity.
File
- merci_line_item/
includes/ merci_line_item.controller.inc, line 279 - Provides a central controller for Drupal Commerce.
Class
- MerciDefaultEntityController
- @file Provides a central controller for Drupal Commerce.
Code
public function create(array $values = array()) {
// Add is_new property if it is not set.
$values += array(
'is_new' => TRUE,
);
// If there is a class for this entity type, instantiate it now.
if (isset($this->entityInfo['entity class']) && ($class = $this->entityInfo['entity class'])) {
$entity = new $class($values, $this->entityType);
}
else {
// Otherwise use a good old stdClass.
$entity = (object) $values;
}
// Allow other modules to alter the created entity.
drupal_alter('merci_entity_create', $this->entityType, $entity);
return $entity;
}