Unverified Commit 60f92438 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3190818 by Wim Leers, narendraR, quietone, xjm: Allow source counts to...

Issue #3190818 by Wim Leers, narendraR, quietone, xjm: Allow source counts to be cached: implement ::doCount() instead of ::count()
parent eb2ed234
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ public function getIds() {
  /**
   * {@inheritdoc}
   */
  public function count($refresh = FALSE) {
  protected function doCount() {
    // Since the number of variables we fetch with query() does not match the
    // actual number of rows generated by initializeIterator(), we need to
    // override count() to return the correct count.
+1 −1
Original line number Diff line number Diff line
@@ -252,7 +252,7 @@ public function getIds() {
  /**
   * {@inheritdoc}
   */
  public function count($refresh = FALSE) {
  protected function doCount() {
    return $this->initializeIterator()->count();
  }

+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ public function fields() {
  /**
   * {@inheritdoc}
   */
  public function count($refresh = FALSE) {
  protected function doCount() {
    return count($this->initializeIterator());
  }

+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ public function query() {
  /**
   * {@inheritdoc}
   */
  public function count($refresh = FALSE) {
  protected function doCount() {
    return 1;
  }

+2 −0
Original line number Diff line number Diff line
@@ -114,6 +114,8 @@ public function getIds() {
   * {@inheritdoc}
   */
  public function count($refresh = FALSE) {
    // We do not want this source plugin to have a cacheable count.
    // @see \Drupal\migrate_cache_counts_test\Plugin\migrate\source\CacheableEmbeddedDataSource
    return count($this->dataRows);
  }

Loading