src/Repository/Doctrine/SoftDeletes.php
protected function scopeExcludeTrashed(QueryBuilder $query) {
        $time = new DateTime();

        return $query
            ->andWhere('o.deletedAt is NULL')
            ->orWhere('o.deletedAt > :currentTimestamp')
            ->setParameter('currentTimestamp', $time->format('Y-m-d H:i:s'));
    }
protected function scopeExcludeTrashed(QueryBuilder $query) {
        $time = new DateTime();

        return $query
            ->andWhere('o.deletedAt is NULL')
            ->orWhere('o.deletedAt > :currentTimestamp')
            ->setParameter('currentTimestamp', $time->format('Y-m-d H:i:s'));
    }
Filters out trashed entities.

@param QueryBuilder $query
@return QueryBuilder