get(EntityManager::class); return static::tableAlias('statistics') ->select('statistics.newsletter_id', 'newsletter_id') ->select('newsletter_rendered_subject') ->select('opens.created_at', 'opened_at') ->select('sent_at') ->join( SendingQueue::$_table, ['statistics.queue_id', '=', 'queue.id'], 'queue' ) ->leftOuterJoin( $entityManager->getClassMetadata(StatisticsOpenEntity::class)->getTableName(), 'statistics.newsletter_id = opens.newsletter_id AND statistics.subscriber_id = opens.subscriber_id', 'opens' ) ->where('statistics.subscriber_id', $subscriber->getId()) ->orderByAsc('newsletter_id'); } }