Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * @file
- * Contains \Drupal\unicef_migration\Plugin\migrate\source\NodeBlogFeaturedImage.
- */
- namespace Drupal\unicef_migration\Plugin\migrate\source;
- use Drupal\file\Plugin\migrate\source\d6\File;
- use Drupal\Core\Database\Query\Condition;
- use Drupal\migrate\Row;
- /**
- * Blog Featured Image
- *
- * @MigrateSource(
- * id = "unicef_migration_blog_featured_image"
- * )
- */
- class NodeBlogFeaturedImage extends File {
- /**
- * {@inheritdoc}
- */
- public function query() {
- $query = $this->select('files', 'f');
- // Join data from 'content_type_blog', which is d6's way of storing field data.
- $query->join('content_type_blog', 'ctb', 'ctb.field_blog_feature_img_fid = f.fid');
- // Join data from 'node' table
- $query->join('node', 'n', 'n.nid = ctb.nid');
- $query->fields('f', ['fid', 'uid', 'filename', 'filepath', 'filemime', 'status', 'timestamp'])
- ->distinct()
- ->condition('n.type', 'blog')
- ->orderBy('n.changed', 'DESC');
- return $query;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement