/**
  * Note: The result of this method cannot be cached, as the target table alias might change for different query scenarios
  *
  * @param ClassMetadata $targetEntity
  * @param string $targetTableAlias
  * @return string
  */
 public function getSqlConstraint(ClassMetadata $targetEntity, $targetTableAlias)
 {
     $this->evaluateMatcher();
     /** @var EntityManager $entityManager */
     $entityManager = $this->objectManager->get(ObjectManager::class);
     $sqlFilter = new SqlFilter($entityManager);
     if (!$this->matchesEntityType($targetEntity->getName())) {
         return null;
     }
     return $this->conditionGenerator->getSql($sqlFilter, $targetEntity, $targetTableAlias);
 }
 /**
  * @param DoctrineSqlFilter $sqlFilter
  * @param ClassMetaData $targetEntity Metadata object for the target entity to create the constraint for
  * @param string $targetTableAlias The target table alias used in the current query
  * @return string
  */
 public function getSql(DoctrineSqlFilter $sqlFilter, ClassMetadata $targetEntity, $targetTableAlias)
 {
     return ' NOT (' . $this->expression->getSql($sqlFilter, $targetEntity, $targetTableAlias) . ')';
 }