TestSqlPrepareQuery.php

Namespace

Drupal\migrate_sql_prepare_query_test\Plugin\migrate\source

File

core/modules/migrate/tests/modules/migrate_sql_prepare_query_test/src/Plugin/migrate/source/TestSqlPrepareQuery.php

View source
<?php

declare (strict_types=1);
namespace Drupal\migrate_sql_prepare_query_test\Plugin\migrate\source;

use Drupal\migrate\Attribute\MigrateSource;
use Drupal\migrate\Plugin\migrate\source\SqlBase;

/**
 * Source plugin for prepare query test.
 */
class TestSqlPrepareQuery extends SqlBase {
  
  /**
   * {@inheritdoc}
   */
  public function query() {
    return $this->select('migrate_source_test')
      ->fields('migrate_source_test');
  }
  
  /**
   * {@inheritdoc}
   */
  protected function prepareQuery() {
    $this->query = parent::prepareQuery();
    $this->query
      ->condition('name', 'foo', '!=');
    return $this->query;
  }
  
  /**
   * {@inheritdoc}
   */
  public function getIds() {
    return [
      'id' => [
        'type' => 'integer',
      ],
    ];
  }
  
  /**
   * {@inheritdoc}
   */
  public function fields() {
    return [
      'id' => 'ID',
      'name' => 'Name',
    ];
  }

}

Classes

Title Deprecated Summary
TestSqlPrepareQuery Source plugin for prepare query test.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.