3 namespace Drupal\migrate_example_advanced\Plugin\migrate\source;
5 use Drupal\migrate\Plugin\migrate\source\SqlBase;
8 * A SQL-based source plugin, to retrieve category data from a source database.
14 class WineTerm extends SqlBase {
19 public function query() {
28 return $this->select('migrate_example_advanced_categories', 'wc')
29 ->fields('wc', $fields)
30 // This sort assures that parents are saved before children.
31 ->orderBy('category_parent', 'ASC');
37 public function fields() {
39 'categoryid' => $this->t('Unique ID of the category'),
40 'type' => $this->t('Category type corresponding to Drupal vocabularies'),
41 'name' => $this->t('Category name'),
42 'details' => $this->t('Description of the category'),
43 'category_parent' => $this->t('ID of the parent category'),
44 'ordering' => $this->t('Order in which to display this category'),
53 public function getIds() {
54 return ['categoryid' => ['type' => 'integer']];