Drupal 8  8.0.2
Row Class Reference

Public Member Functions

 __construct (array $values, array $source_ids, $is_stub=FALSE)
 
 getSourceIdValues ()
 
 hasSourceProperty ($property)
 
 getSourceProperty ($property)
 
 getSource ()
 
 setSourceProperty ($property, $data)
 
 freezeSource ()
 
 cloneWithoutDestination ()
 
 hasDestinationProperty ($property)
 
 setDestinationProperty ($property, $value)
 
 removeDestinationProperty ($property)
 
 getDestination ()
 
 getRawDestination ()
 
 getDestinationProperty ($property)
 
 setIdMap (array $id_map)
 
 getIdMap ()
 
 rehash ()
 
 changed ()
 
 needsUpdate ()
 
 getHash ()
 
 isStub ()
 

Data Fields

const PROPERTY_SEPARATOR = '/'
 

Protected Attributes

 $source = array()
 
 $sourceIds = array()
 
 $destination = array()
 
 $idMap
 
 $frozen = FALSE
 
 $rawDestination = []
 
 $isStub = FALSE
 

Detailed Description

Stores a row.

Constructor & Destructor Documentation

__construct ( array  $values,
array  $source_ids,
  $is_stub = FALSE 
)

Constructs a object.

Parameters
array$valuesAn array of values to add as properties on the object.
array$source_idsAn array containing the IDs of the source using the keys as the field names.
bool$is_stubTRUE if the row being created is a stub.
Exceptions
\InvalidArgumentExceptionThrown when a source ID property does not exist.

References Row\hasSourceProperty(), and Row\isStub().

Here is the call graph for this function:

Member Function Documentation

changed ( )

Checks whether the row has changed compared to the original ID map.

Returns
bool TRUE if the row has changed, FALSE otherwise. If setIdMap() was not called, this always returns FALSE.

Referenced by SourcePluginBase\rowChanged().

Here is the caller graph for this function:

cloneWithoutDestination ( )

Clones the row with an empty set of destination values.

Returns
static

References Row\getSource(), and Row\isStub().

Referenced by EntityContentBase\updateEntity().

Here is the call graph for this function:

Here is the caller graph for this function:

freezeSource ( )

Freezes the source.

Returns
$this
getDestination ( )

Returns the whole destination array.

Returns
array An array of destination values.

Referenced by Entity\getEntity(), and EntityContentBase\updateEntity().

Here is the caller graph for this function:

getDestinationProperty (   $property)

Returns the value of a destination property.

Parameters
string$propertyThe name of a property on the destination.
Returns
mixed The destination value.

References Drupal\destination(), and NestedArray\getValue().

Referenced by EntityConfigBase\generateId(), EntityRevision\getEntity(), EntityBlock\getEntityId(), EntityBaseFieldOverride\getEntityId(), Entity\getEntityId(), EntityUser\processStubRow(), FieldFormatterSettingsDefaults\transform(), Get\transform(), Iterator\transformKey(), Book\updateEntity(), and EntityContentBase\updateEntity().

Here is the call graph for this function:

Here is the caller graph for this function:

getHash ( )

Returns the hash for the source values..

Returns
mixed The hash of the source values.

Referenced by Sql\saveIdMapping().

Here is the caller graph for this function:

getIdMap ( )

Retrieves the Migrate ID mappings.

Returns
array An array of mapping between source and destination identifiers.

Referenced by EntityConfigBase\updateEntity(), and EntityContentBase\updateEntity().

Here is the caller graph for this function:

getRawDestination ( )

Returns the raw destination. Rarely necessary.

For example calling setDestination('foo/bar', 'baz') results in

$this->destination['foo']['bar'] = 'baz';
$this->rawDestination['foo/bar'] = 'baz';
Returns
array The raw destination values.

Referenced by EntityConfigBase\updateEntity().

Here is the caller graph for this function:

getSource ( )

Returns the whole source array.

Returns
array An array of source plugins.

Referenced by Row\cloneWithoutDestination().

Here is the caller graph for this function:

getSourceIdValues ( )

Retrieves the values of the source identifiers.

Returns
array An array containing the values of the source identifiers.

Referenced by SourcePluginBase\next(), and Sql\saveIdMapping().

Here is the caller graph for this function:

getSourceProperty (   $property)

Retrieves a source property.

Parameters
string$propertyA property on the source.
Returns
mixed|null The found returned property or NULL if not found.

References NestedArray\getValue().

Referenced by SourcePluginBase\aboveHighwater(), CckFieldPluginBase\getFieldType(), hook_migrate_prepare_row(), ProfileFieldValues\prepareRow(), ContactCategory\prepareRow(), FieldInstancePerFormDisplay\prepareRow(), VariableMultiRow\prepareRow(), ImageCachePreset\prepareRow(), User\prepareRow(), ImageStyles\prepareRow(), TermNode\prepareRow(), ProfileField\prepareRow(), FieldInstance\prepareRow(), UserPictureFile\prepareRow(), Action\prepareRow(), Vocabulary\prepareRow(), Field\prepareRow(), Role\prepareRow(), MenuLink\prepareRow(), Term\prepareRow(), Block\prepareRow(), FieldSettings\transform(), ImageCacheActions\transform(), FieldTypeDefaults\transform(), UserUpdate8002\transform(), FieldFormatterSettingsDefaults\transform(), Get\transform(), and UserUpdate7002\transform().

Here is the call graph for this function:

Here is the caller graph for this function:

hasDestinationProperty (   $property)

Tests if destination property exists.

Parameters
array | string$propertyAn array of properties on the destination.
Returns
bool TRUE if the destination property exists.

References Drupal\destination(), and NestedArray\keyExists().

Here is the call graph for this function:

hasSourceProperty (   $property)

Determines whether a source has a property.

Parameters
string$propertyA property on the source.
Returns
bool TRUE if the source has property; FALSE otherwise.

References NestedArray\keyExists().

Referenced by Row\__construct(), User\prepareRow(), and UserUpdate7002\transform().

Here is the call graph for this function:

Here is the caller graph for this function:

isStub ( )

Reports whether this row is a stub.

Returns
bool The current stub value.

Referenced by Row\__construct(), Row\cloneWithoutDestination(), and Entity\getEntity().

Here is the caller graph for this function:

needsUpdate ( )

Returns if this row needs an update.

Returns
bool TRUE if the row needs updating, FALSE otherwise.
rehash ( )

Recalculates the hash for the row.

Referenced by SourcePluginBase\prepareRow().

Here is the caller graph for this function:

removeDestinationProperty (   $property)

Removes destination property.

Parameters
string$propertyThe name of the destination property.

References Drupal\destination(), and NestedArray\unsetValue().

Here is the call graph for this function:

setDestinationProperty (   $property,
  $value 
)

Sets destination properties.

Parameters
string$propertyThe name of the destination property.
mixed$valueThe property value to set on the destination.

References Drupal\destination(), and NestedArray\setValue().

Referenced by EntityUser\processStubRow().

Here is the call graph for this function:

Here is the caller graph for this function:

setIdMap ( array  $id_map)

Sets the Migrate ID mappings.

Parameters
array$id_mapAn array of mappings between source ID and destination ID.
setSourceProperty (   $property,
  $data 
)

Sets a source property.

This can only be called from the source plugin.

Parameters
string$propertyA property on the source.
mixed$dataThe property value to set on the source.
Exceptions
\Exception

References NestedArray\setValue().

Referenced by hook_migrate_prepare_row(), ProfileFieldValues\prepareRow(), ContactCategory\prepareRow(), FieldInstancePerFormDisplay\prepareRow(), VariableMultiRow\prepareRow(), User\prepareRow(), ImageStyles\prepareRow(), ImageCachePreset\prepareRow(), TermNode\prepareRow(), ProfileField\prepareRow(), FieldInstance\prepareRow(), UserPictureFile\prepareRow(), Action\prepareRow(), Vocabulary\prepareRow(), Field\prepareRow(), Role\prepareRow(), MenuLink\prepareRow(), Term\prepareRow(), and Block\prepareRow().

Here is the call graph for this function:

Here is the caller graph for this function:

Field Documentation

$idMap
protected
Initial value:
= array(
'original_hash' => '',
'hash' => '',
'source_row_status' => MigrateIdMapInterface::STATUS_NEEDS_UPDATE,
)
const PROPERTY_SEPARATOR = '/'

Level separator of destination and source properties.

Referenced by Config\import(), and EntityConfigBase\updateEntity().


The documentation for this class was generated from the following file: