class MigrateDestinationReservation in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3
Hierarchy
- class \MigrateDestination
- class \MigrateDestinationEntity
- class \MigrateDestinationEntityAPI
- class \MigrateDestinationEntity
Expanded class hierarchy of MigrateDestinationReservation
File
- merci_migrate/
merci_reservation.inc, line 113
View source
class MigrateDestinationReservation extends MigrateDestinationEntityAPI {
protected $bypassDestIdCheck = FALSE;
public static function getKeySchema() {
return array(
'id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'Primary Key: Unique ID.',
),
);
}
public function __construct($bundle, array $options = array()) {
parent::__construct('merci_line_item', $bundle, $options);
}
/**
* Import a single node.
*
* @param $node
* Node object to build. Prefilled with any fields mapped in the Migration.
* @param $row
* Raw source data object - passed through to prepare/complete handlers.
* @return array
* Array of key fields (nid only in this case) of the node that was saved if
* successful. FALSE on failure.
*/
public function import(stdClass $object, stdClass $row) {
// Updating previously-migrated content?
$migration = Migration::currentMigration();
if (!isset($object->type)) {
// Default the type to our designated destination bundle (by doing this
// conditionally, we permit some flexibility in terms of implementing
// migrations which can affect more than one type).
$object->type = $this->bundle;
}
// Invoke migration prepare handlers
$this
->prepare($object, $row);
// Validate field data prior to saving.
MigrateDestinationEntity::fieldAttachValidate('merci_line_item', $object);
migrate_instrument_start('merci_line_item_save');
entity_save('merci_line_item', $object);
migrate_instrument_stop('merci_line_item_save');
if (isset($object->line_item_id)) {
$this->numCreated++;
$return = array(
$object->line_item_id,
);
}
else {
$return = FALSE;
}
$this
->complete($object, $row);
return $return;
}
public function rollback(array $id) {
static $count = 0;
migrate_instrument_start('merci_line_item_delete');
$this
->prepareRollback($id);
entity_delete('merci_line_item', reset($id));
$this
->completeRollback($id);
migrate_instrument_stop('merci_line_item_delete');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MigrateDestination:: |
protected | property | Maintain stats on the number of destination objects created or updated. | |
MigrateDestination:: |
protected | property | ||
MigrateDestination:: |
public | function | ||
MigrateDestination:: |
public | function | ||
MigrateDestination:: |
public | function | Reset numCreated and numUpdated back to 0. | |
MigrateDestinationEntity:: |
protected | property | The bundle (node type, vocabulary, etc.) of the destination. | |
MigrateDestinationEntity:: |
protected | property | The entity type (node, user, taxonomy_term, etc.) of the destination. | |
MigrateDestinationEntity:: |
protected | property | Default language for text fields in this destination. | |
MigrateDestinationEntity:: |
protected | property | Default input format for text fields in this destination. | |
MigrateDestinationEntity:: |
public static | function | Flattens an array of allowed values. | |
MigrateDestinationEntity:: |
public | function | Give handlers a shot at modifying the object (or taking additional action) after saving it. | |
MigrateDestinationEntity:: |
public | function | Give handlers a shot at cleaning up after an entity has been rolled back. | |
MigrateDestinationEntity:: |
public static | function | Perform field validation against the field data in an entity. Wraps field_attach_validate to handle exceptions cleanly and provide maximum information for identifying the cause of validation errors. | |
MigrateDestinationEntity:: |
public | function | ||
MigrateDestinationEntity:: |
public | function | ||
MigrateDestinationEntity:: |
public | function | ||
MigrateDestinationEntity:: |
public | function | ||
MigrateDestinationEntity:: |
public | function | Give handlers a shot at modifying the object before saving it. | |
MigrateDestinationEntity:: |
public | function | Give handlers a shot at cleaning up before an entity has been rolled back. | |
MigrateDestinationEntity:: |
public | function |
Derived classes must implement __toString(). Overrides MigrateDestination:: |
|
MigrateDestinationEntityAPI:: |
protected | property | Name of the entity id key (for example, nid for nodes). | |
MigrateDestinationEntityAPI:: |
protected | property | Info about the current entity type. | |
MigrateDestinationEntityAPI:: |
protected | property | Name of the entity revision key (for example, vid for nodes). | |
MigrateDestinationEntityAPI:: |
public | function | Deletes multiple entities. | |
MigrateDestinationEntityAPI:: |
public | function |
Returns a list of fields available to be mapped for entities attached to
a particular bundle. Overrides MigrateDestination:: |
|
MigrateDestinationEntityAPI:: |
public static | function | Return an options array (language, text_format), used for creating fields. | |
MigrateDestinationEntityAPI:: |
public | function | Clear the field cache after an import or rollback. | |
MigrateDestinationEntityAPI:: |
public | function | ||
MigrateDestinationReservation:: |
protected | property | ||
MigrateDestinationReservation:: |
public static | function |
Gets the schema for the base key(s) of an entity type. Overrides MigrateDestinationEntityAPI:: |
|
MigrateDestinationReservation:: |
public | function |
Import a single node. Overrides MigrateDestinationEntityAPI:: |
|
MigrateDestinationReservation:: |
public | function | ||
MigrateDestinationReservation:: |
public | function |
Basic initialization Overrides MigrateDestinationEntityAPI:: |