Drupal 8  8.0.2
EntityFile Class Reference
Inheritance diagram for EntityFile:

Public Member Functions

 __construct (array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager, StreamWrapperManagerInterface $stream_wrappers, FileSystemInterface $file_system)
 
 import (Row $row, array $old_destination_id_values=array())
 
- Public Member Functions inherited from EntityContentBase
 __construct (array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager)
 
 import (Row $row, array $old_destination_id_values=array())
 
 getIds ()
 
- Public Member Functions inherited from Entity
 __construct (array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles)
 
 fields (MigrationInterface $migration=NULL)
 
 rollback (array $destination_identifier)
 
 calculateDependencies ()
 
- Public Member Functions inherited from DestinationBase
 __construct (array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration)
 
 rollbackAction ()
 
 checkRequirements ()
 
 rollback (array $destination_identifier)
 
 supportsRollback ()
 
- Public Member Functions inherited from PluginInspectionInterface
 getPluginId ()
 
 getPluginDefinition ()
 

Static Public Member Functions

static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration=NULL)
 
- Static Public Member Functions inherited from EntityContentBase
static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration=NULL)
 
- Static Public Member Functions inherited from Entity
static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration=NULL)
 
- Static Public Member Functions inherited from ContainerFactoryPluginInterface
static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
 

Protected Member Functions

 getEntity (Row $row, array $old_destination_id_values)
 
 writeFile ($source, $destination, $replace=FILE_EXISTS_REPLACE)
 
 getOverwriteMode (Row $row)
 
 getDirectory ($uri)
 
 isLocationUnchanged ($source, $destination)
 
 isLocalUri ($uri)
 
 urlencode ($filename)
 
 processStubRow (Row $row)
 
- Protected Member Functions inherited from EntityContentBase
 save (ContentEntityInterface $entity, array $old_destination_id_values=array())
 
 updateEntity (EntityInterface $entity, Row $row)
 
- Protected Member Functions inherited from Entity
 getEntity (Row $row, array $old_destination_id_values)
 
 getEntityId (Row $row)
 
 getKey ($key)
 
- Protected Member Functions inherited from DestinationBase
 setRollbackAction (array $id_map)
 

Protected Attributes

 $streamWrapperManager
 
 $fileSystem
 
- Protected Attributes inherited from EntityContentBase
 $entityManager
 
 $fieldTypeManager
 
- Protected Attributes inherited from Entity
 $storage
 
 $bundles
 
- Protected Attributes inherited from DestinationBase
 $supportsRollback = FALSE
 
 $rollbackAction = MigrateIdMapInterface::ROLLBACK_DELETE
 
 $migration
 

Additional Inherited Members

- Static Protected Member Functions inherited from Entity
static getEntityTypeId ($plugin_id)
 

Detailed Description

Every migration that uses this destination must have an optional dependency on the d6_file migration to ensure it runs first.

( id = "entity:file" )

Constructor & Destructor Documentation

__construct ( array  $configuration,
  $plugin_id,
  $plugin_definition,
MigrationInterface  $migration,
EntityStorageInterface  $storage,
array  $bundles,
EntityManagerInterface  $entity_manager,
FieldTypePluginManagerInterface  $field_type_manager,
StreamWrapperManagerInterface  $stream_wrappers,
FileSystemInterface  $file_system 
)

{}

Member Function Documentation

static create ( ContainerInterface  $container,
array  $configuration,
  $plugin_id,
  $plugin_definition,
MigrationInterface  $migration = NULL 
)
static

{}

getDirectory (   $uri)
protected

Returns the directory component of a URI or path.

For URIs like public://foo.txt, the full physical path of public:// will be returned, since a scheme by itself will trip up certain file API functions (such as file_prepare_directory()).

Parameters
string$uriThe URI or path.
Returns
string|false The directory component of the path or URI, or FALSE if it could not be determined.

Referenced by EntityFile\import().

Here is the caller graph for this function:

getEntity ( Row  $row,
array  $old_destination_id_values 
)
protected

{}

getOverwriteMode ( Row  $row)
protected

Determines how to handle file conflicts.

Parameters
\Drupal\migrate\Row$row
Returns
int Either FILE_EXISTS_REPLACE (default) or FILE_EXISTS_RENAME, depending on the current configuration.

References FILE_EXISTS_RENAME, FILE_EXISTS_REPLACE, and Entity\getKey().

Referenced by EntityFile\import().

Here is the call graph for this function:

Here is the caller graph for this function:

import ( Row  $row,
array  $old_destination_id_values = array() 
)

{}

References FILE_CREATE_DIRECTORY, file_prepare_directory(), EntityFile\getDirectory(), EntityFile\getOverwriteMode(), EntityFile\isLocalUri(), EntityFile\isLocationUnchanged(), and EntityFile\writeFile().

Here is the call graph for this function:

isLocalUri (   $uri)
protected

Returns if the given URI or path is considered local.

A URI or path is considered local if it either has no scheme component, or the scheme is implemented by a stream wrapper which extends .

Parameters
string$uriThe URI or path to test.
Returns
bool

Referenced by EntityFile\import(), and EntityFile\isLocationUnchanged().

Here is the caller graph for this function:

isLocationUnchanged (   $source,
  $destination 
)
protected

Returns if the source and destination URIs represent identical paths. If either URI is a remote stream, will return FALSE.

Parameters
string$sourceThe source URI.
string$destinationThe destination URI.
Returns
bool TRUE if the source and destination URIs refer to the same physical path, otherwise FALSE.

References EntityFile\isLocalUri().

Referenced by EntityFile\import().

Here is the call graph for this function:

Here is the caller graph for this function:

processStubRow ( Row  $row)
protected

{}

References Drupal\entityManager(), UriItem\generateSampleValue(), Entity\getKey(), and Unicode\substr().

Here is the call graph for this function:

urlencode (   $filename)
protected

Urlencode all the components of a remote filename.

Parameters
string$filenameThe filename of the file to be urlencoded.
Returns
string The urlencoded filename.

Referenced by EntityFile\writeFile().

Here is the caller graph for this function:

writeFile (   $source,
  $destination,
  $replace = FILE_EXISTS_REPLACE 
)
protected

Tries to move or copy a file.

Parameters
string$sourceThe source path or URI.
string$destinationThe destination path or URI.
int$replace(optional) FILE_EXISTS_REPLACE (default) or FILE_EXISTS_RENAME.
Returns
bool TRUE on success, FALSE on failure.

References file_destination(), file_unmanaged_move(), and EntityFile\urlencode().

Referenced by EntityFile\import().

Here is the call graph for this function:

Here is the caller graph for this function:


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