CacheableEmbeddedDataSource.php

Same filename and directory in other branches
  1. 9 core/modules/migrate/tests/modules/migrate_cache_counts_test/src/Plugin/migrate/source/CacheableEmbeddedDataSource.php
  2. 10 core/modules/migrate/tests/modules/migrate_cache_counts_test/src/Plugin/migrate/source/CacheableEmbeddedDataSource.php

Namespace

Drupal\migrate_cache_counts_test\Plugin\migrate\source

File

core/modules/migrate/tests/modules/migrate_cache_counts_test/src/Plugin/migrate/source/CacheableEmbeddedDataSource.php

View source
<?php

namespace Drupal\migrate_cache_counts_test\Plugin\migrate\source;

use Drupal\migrate\Plugin\migrate\source\EmbeddedDataSource;
use Drupal\migrate\Plugin\migrate\source\SourcePluginBase;

/**
 * A copy of embedded_data which allows caching the count.
 *
 * @MigrateSource(
 *   id = "cacheable_embedded_data",
 *   source_module = "migrate"
 * )
 */
class CacheableEmbeddedDataSource extends EmbeddedDataSource {
    
    /**
     * {@inheritdoc}
     */
    public function count($refresh = FALSE) : int {
        return SourcePluginBase::count($refresh);
    }
    
    /**
     * {@inheritdoc}
     */
    protected function doCount() {
        return parent::count(TRUE);
    }

}

Classes

Title Deprecated Summary
CacheableEmbeddedDataSource A copy of embedded_data which allows caching the count.

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