3 namespace Drupal\contact\Plugin\migrate\source;
5 use Drupal\migrate\Row;
6 use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
9 * Contact category source from database.
12 * id = "contact_category",
13 * source_module = "contact"
16 class ContactCategory extends DrupalSqlBase {
21 public function query() {
22 $query = $this->select('contact', 'c')
32 $query->orderBy('c.cid');
39 public function prepareRow(Row $row) {
40 $row->setSourceProperty('recipients', explode(',', $row->getSourceProperty('recipients')));
41 return parent::prepareRow($row);
47 public function fields() {
49 'cid' => $this->t('Primary Key: Unique category ID.'),
50 'category' => $this->t('Category name.'),
51 'recipients' => $this->t('Comma-separated list of recipient email addresses.'),
52 'reply' => $this->t('Text of the auto-reply message.'),
53 'weight' => $this->t("The category's weight."),
54 'selected' => $this->t('Flag to indicate whether or not category is selected by default. (1 = Yes, 0 = No)'),
61 public function getIds() {
62 $ids['cid']['type'] = 'integer';