Commit b6a2503e authored by Fabrice Scoyer's avatar Fabrice Scoyer Committed by fabrice.scoyer
Browse files

Issue #3254542 by flocondetoile: Updating a self_valuation does not invalidate answer cached

parent 1b590377
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Drupal\self_evaluation\Entity;

use Drupal\Core\Cache\Cache;
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityChangedTrait;
use Drupal\Core\Entity\EntityStorageInterface;
@@ -142,6 +143,18 @@ class SelfEvaluationAnswer extends ContentEntityBase implements SelfEvaluationAn
    return $this->get('self_evaluation')->entity;
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheTagsToInvalidate() {
    $cache_tags = parent::getCacheTagsToInvalidate();
    $self_evaluation = $this->getSelfEvaluation();
    if ($self_evaluation instanceof SelfEvaluationInterface) {
      $cache_tags = Cache::mergeTags($cache_tags, $self_evaluation->getCacheTags());
    }
    return $cache_tags;
  }

  /**
   * {@inheritdoc}
   */