本文整理汇总了PHP中Drupal\migrate\Row类的典型用法代码示例。如果您正苦于以下问题:PHP Row类的具体用法?PHP Row怎么用?PHP Row使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Row类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row)
{
$query = $this->select('upload', 'u')->fields('u', array('fid', 'description', 'list'))->condition('u.nid', $row->getSourceProperty('nid'))->orderBy('u.weight');
$query->innerJoin('node', 'n', static::JOIN);
$row->setSourceProperty('upload', $query->execute()->fetchAll());
return parent::prepareRow($row);
}
开发者ID:briefmedia-digital,项目名称:drupal8,代码行数:10,代码来源:Upload.php
示例2: transform
/**
* Posts are either type recpie or restaurant_review.
* Recpies contain <div class="recipe">, everything else is considered type
* restaurant_review.
*/
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property)
{
$return = array();
$caption_tags = $this->getTags($value)['caption']['values'];
if (is_array($caption_tags)) {
foreach ($caption_tags as $image) {
// Search for imported File:
$q = db_select('migrate_map_donkeymedia_file', 'm')->fields('m', array('sourceid1', 'destid1'))->condition('m.sourceid1', $image['attachment'])->execute();
$map = $q->fetchObject();
if ($map) {
$dest = array('target_id' => $map->destid1, 'alt' => 'Sorry. No describing text available.', 'title' => 'No title');
// Alt Tag.
if (!empty($image['alt'])) {
$dest['alt'] = $image['alt'];
}
// Title.
if (!empty($image['caption'])) {
$dest['title'] = $image['caption'];
}
$return[] = $dest;
} else {
echo 'Source Id: "' . $image['attachment'] . '" not Found in File Map table (migrate_map_donkeymedia_file)' . "\n";
throw new MigrateSkipProcessException();
}
}
}
if (!empty($return)) {
$row->setDestinationProperty($destination_property, $return);
}
}
开发者ID:digitaldonkey,项目名称:donkeymedia_migrate,代码行数:35,代码来源:AttachmentToFile.php
示例3: getFieldType
/**
* {@inheritdoc}
*/
public function getFieldType(Row $row)
{
$widget_type = $row->getSourceProperty('widget_type');
if ($widget_type == 'text_textfield') {
$settings = $row->getSourceProperty('global_settings');
$field_type = $settings['text_processing'] ? 'text' : 'string';
if (empty($settings['max_length']) || $settings['max_length'] > 255) {
$field_type .= '_long';
}
return $field_type;
} else {
switch ($widget_type) {
case 'optionwidgets_buttons':
case 'optionwidgets_select':
return 'list_string';
case 'optionwidgets_onoff':
return 'boolean';
case 'text_textarea':
return 'text_long';
default:
return parent::getFieldType($row);
break;
}
}
}
开发者ID:sgtsaughter,项目名称:d8portfolio,代码行数:28,代码来源:TextField.php
示例4: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row)
{
$uid = $row->getSourceProperty('uid');
// field_real_name
$result = $this->getDatabase()->query('
SELECT
fld.field_real_name_value
FROM
{dcf_field_data_field_real_name} fld
WHERE
fld.entity_id = :uid
', array(':uid' => $uid));
foreach ($result as $record) {
$row->setSourceProperty('field_real_name', $record->field_real_name_value);
}
// field_availability
$result = $this->getDatabase()->query('
SELECT
fld.field_availability_value
FROM
{dcf_field_data_field_availability} fld
WHERE
fld.entity_id = :uid
', array(':uid' => $uid));
foreach ($result as $record) {
$row->setSourceProperty('field_availability', $record->field_availability_value);
}
return parent::prepareRow($row);
}
开发者ID:atxajon,项目名称:d8cafe,代码行数:32,代码来源:User.php
示例5: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row)
{
$type = $row->getSourceProperty('type');
$row->setSourceProperty('language_content_type', $this->variableGet('language_content_type_' . $type, NULL));
$row->setSourceProperty('i18n_lock_node', $this->variableGet('i18n_lock_node_' . $type, 0));
return parent::prepareRow($row);
}
开发者ID:eigentor,项目名称:tommiblog,代码行数:10,代码来源:LanguageContentSettings.php
示例6: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row)
{
$data = unserialize($row->getSourceProperty('data'));
$row->setSourceProperty('widget', $data['widget']);
$row->setSourceProperty('widget_settings', $data['widget']['settings']);
return parent::prepareRow($row);
}
开发者ID:eigentor,项目名称:tommiblog,代码行数:10,代码来源:FieldInstancePerFormDisplay.php
示例7: prepareRow
public function prepareRow(Row $row)
{
if ($value = $row->getSourceProperty('beers')) {
$row->setSourceProperty('beers', explode('|', $value));
}
return parent::prepareRow($row);
}
开发者ID:Wylbur,项目名称:eight,代码行数:7,代码来源:BeerUser.php
示例8: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row)
{
$post_type = $row->getSourceProperty('post_type');
$type = $post_type == 'page' ? 'page' : 'article';
$row->setSourceProperty('type', $type);
return parent::prepareRow($row);
}
开发者ID:gl-prout,项目名称:d8_migrate_wordpress,代码行数:10,代码来源:Posts.php
示例9: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row)
{
if ($value = $row->getSourceProperty('value')) {
$row->setSourceProperty('value', unserialize($value));
}
return parent::prepareRow($row);
}
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:10,代码来源:VariableMultiRow.php
示例10: transform
/**
* {@inheritdoc}
*/
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property)
{
// If we're stubbing a file entity, return a URI of NULL so it will get
// stubbed by the general process.
if ($row->isStub()) {
return NULL;
}
list($source, $destination) = $value;
// Ensure the source file exists, if it's a local URI or path.
if ($this->isLocalUri($source) && !file_exists($source)) {
throw new MigrateException("File '{$source}' does not exist");
}
// If the start and end file is exactly the same, there is nothing to do.
if ($this->isLocationUnchanged($source, $destination)) {
return $destination;
}
$replace = $this->getOverwriteMode();
// We attempt the copy/move first to avoid calling file_prepare_directory()
// any more than absolutely necessary.
$final_destination = $this->writeFile($source, $destination, $replace);
if ($final_destination) {
return $final_destination;
}
// If writeFile didn't work, make sure there's a writable directory in
// place.
$dir = $this->getDirectory($destination);
if (!file_prepare_directory($dir, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
throw new MigrateException("Could not create or write to directory '{$dir}'");
}
$final_destination = $this->writeFile($source, $destination, $replace);
if ($final_destination) {
return $final_destination;
}
throw new MigrateException("File {$source} could not be copied to {$destination}");
}
开发者ID:eigentor,项目名称:tommiblog,代码行数:38,代码来源:FileCopy.php
示例11: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row)
{
// Select all related tickets (rnid) to the current ticket (nid)
$query = $this->select('support_reference', 'sr')->fields('sr', array('rnid'))->condition('sr.nid', $row->getSourceProperty('nid'));
$row->setSourceProperty('rnid', $query->execute()->fetchCol());
return parent::prepareRow($row);
}
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:10,代码来源:SupportTicketReference.php
示例12: getEntityId
/**
* {@inheritdoc}
*/
protected function getEntityId(Row $row)
{
$entity_type = $row->getDestinationProperty('entity_type');
$bundle = $row->getDestinationProperty('bundle');
$field_name = $row->getDestinationProperty('field_name');
return "{$entity_type}.{$bundle}.{$field_name}";
}
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:10,代码来源:EntityBaseFieldOverride.php
示例13: import
/**
* {@inheritdoc}
*/
public function import(Row $row, array $old_destination_id_values = array())
{
$source = $this->configuration['source_base_path'] . $row->getSourceProperty($this->configuration['source_path_property']);
$destination = $row->getDestinationProperty($this->configuration['destination_path_property']);
$replace = FILE_EXISTS_REPLACE;
if (!empty($this->configuration['rename'])) {
$entity_id = $row->getDestinationProperty($this->getKey('id'));
if (!empty($entity_id) && ($entity = $this->storage->load($entity_id))) {
$replace = FILE_EXISTS_RENAME;
}
}
$dirname = drupal_dirname($destination);
if (!file_prepare_directory($dirname, FILE_CREATE_DIRECTORY)) {
throw new MigrateException(t('Could not create directory %dirname', array('%dirname' => $dirname)));
}
if ($this->configuration['move']) {
$copied = file_unmanaged_move($source, $destination, $replace);
} else {
// Determine whether we can perform this operation based on overwrite rules.
$original_destination = $destination;
$destination = file_destination($destination, $replace);
if ($destination === FALSE) {
throw new MigrateException(t('File %file could not be copied because a file by that name already exists in the destination directory (%destination)', array('%file' => $source, '%destination' => $original_destination)));
}
$source = $this->urlencode($source);
$copied = copy($source, $destination);
}
if ($copied) {
return parent::import($row, $old_destination_id_values);
} else {
throw new MigrateException(t('File %source could not be copied to %destination.', array('%source' => $source, '%destination' => $destination)));
}
}
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:36,代码来源:EntityFile.php
示例14: transform
/**
* {@inheritdoc}
*/
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property)
{
// If we're stubbing a file entity, return a uri of NULL so it will get
// stubbed by the general process.
if ($row->isStub()) {
return NULL;
}
list($source, $destination) = $value;
// Modify the destination filename if necessary.
$replace = !empty($this->configuration['rename']) ? FILE_EXISTS_RENAME : FILE_EXISTS_REPLACE;
$final_destination = file_destination($destination, $replace);
// Try opening the file first, to avoid calling file_prepare_directory()
// unnecessarily. We're suppressing fopen() errors because we want to try
// to prepare the directory before we give up and fail.
$destination_stream = @fopen($final_destination, 'w');
if (!$destination_stream) {
// If fopen didn't work, make sure there's a writable directory in place.
$dir = $this->fileSystem->dirname($final_destination);
if (!file_prepare_directory($dir, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
throw new MigrateException("Could not create or write to directory '{$dir}'");
}
// Let's try that fopen again.
$destination_stream = @fopen($final_destination, 'w');
if (!$destination_stream) {
throw new MigrateException("Could not write to file '{$final_destination}'");
}
}
// Stream the request body directly to the final destination stream.
$this->configuration['guzzle_options']['sink'] = $destination_stream;
// Make the request. Guzzle throws an exception for anything other than 200.
$this->httpClient->get($source, $this->configuration['guzzle_options']);
return $final_destination;
}
开发者ID:Greg-Boggs,项目名称:electric-dev,代码行数:36,代码来源:Download.php
示例15: getEntity
/**
* {@inheritdoc}
*/
protected function getEntity(Row $row, array $old_destination_id_values)
{
if ($row->isStub()) {
$row->setDestinationProperty('name', $this->t('Stub name for source tid:') . $row->getSourceProperty('tid'));
}
return parent::getEntity($row, $old_destination_id_values);
}
开发者ID:dmyerson,项目名称:d8ecs,代码行数:10,代码来源:EntityTaxonomyTerm.php
示例16: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row, $keep = TRUE)
{
foreach (unserialize($row->getSourceProperty('data')) as $key => $value) {
$row->setSourceProperty($key, $value);
}
return parent::prepareRow($row);
}
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:10,代码来源:Field.php
示例17: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row)
{
$row->setSourceProperty('file_directory_path', $this->filePath);
$row->setSourceProperty('temp_directory_path', $this->tempFilePath);
$row->setSourceProperty('is_public', $this->isPublic);
return parent::prepareRow($row);
}
开发者ID:ravindrasingh22,项目名称:Drupal-8-rc,代码行数:10,代码来源:File.php
示例18: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row)
{
// Find parents for this row.
$parents = $this->select('term_hierarchy', 'th')->fields('th', array('parent', 'tid'))->condition('tid', $row->getSourceProperty('tid'))->execute()->fetchCol();
$row->setSourceProperty('parent', $parents);
return parent::prepareRow($row);
}
开发者ID:nsp15,项目名称:Drupal8,代码行数:10,代码来源:Term.php
示例19: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row)
{
$vocab = $row->getSourceProperty('taxonomy');
$label = $vocab == 'category' ? 'Category' : 'Post Tags';
$row->setSourceProperty('label', $label);
return parent::prepareRow($row);
}
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:10,代码来源:Vocabulary.php
示例20: prepareRow
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row)
{
/**
* prepareRow() is the most common place to perform custom run-time
* processing that isn't handled by an existing process plugin. It is called
* when the raw data has been pulled from the source, and provides the
* opportunity to modify or add to that data, creating the canonical set of
* source data that will be fed into the processing pipeline.
*
* In our particular case, the list of a user's favorite ssds is a pipe-
* separated list of ssd IDs. The processing pipeline deals with arrays
* representing multi-value fields naturally, so we want to explode that
* string to an array of individual ssd IDs.
*/
if ($value = $row->getSourceProperty('ssds')) {
$row->setSourceProperty('ssds', explode('|', $value));
}
/**
* Always call your parent! Essential processing is performed in the base
* class. Be mindful that prepareRow() returns a boolean status - if FALSE
* that indicates that the item being processed should be skipped. Unless
* we're deciding to skip an item ourselves, let the parent class decide.
*/
return parent::prepareRow($row);
}
开发者ID:aritnath1990,项目名称:migration_task_ssd,代码行数:28,代码来源:SsdUser.php
注:本文中的Drupal\migrate\Row类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论