connection = $connection; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { return new static( $configuration, $plugin_id, $plugin_definition, $migration, $container->get('database') ); } /** * {@inheritdoc} */ public function import(Row $row, array $old_destination_id_values = []) { // Save the row to custom table. $this->connection ->insert('example') ->fields([ 'id' => $row->getDestinationProperty('id'), 'name' => $row->getDestinationProperty('name'), 'status' => $row->getDestinationProperty('status'), ]) ->execute(); return [$row->getDestinationProperty('id')]; } /** * {@inheritdoc} */ public function getIds() { $ids['id']['type'] = [ 'type' => 'integer', 'unsigned' => TRUE, 'size' => 'big', ]; return $ids; } /** * {@inheritdoc} */ public function fields(MigrationInterface $migration = NULL) { return [ 'id' => $this->t('The record ID.'), 'name' => $this->t('The record name.'), 'status' => $this->t('The record status'), ]; } }