Use Doctrine for the opens and clicks exporters
This commit refactors the code that handles exporting e-mails opens and clicks when generating the personal data file to use Doctrine instead of Paris. I opted to do this in this task as opens and clicks code share some functionality, and I didn't want to add more code that relies on Paris, as we are eventually going to remove it. [MAILPOET-3738]
This commit is contained in:
@@ -2,10 +2,6 @@
|
||||
|
||||
namespace MailPoet\Models;
|
||||
|
||||
use MailPoet\DI\ContainerWrapper;
|
||||
use MailPoet\Entities\UserAgentEntity;
|
||||
use MailPoetVendor\Doctrine\ORM\EntityManager;
|
||||
|
||||
/**
|
||||
* @property int $newsletterId
|
||||
* @property int $subscriberId
|
||||
@@ -28,27 +24,4 @@ class StatisticsOpens extends Model {
|
||||
}
|
||||
return $statistics;
|
||||
}
|
||||
|
||||
public static function getAllForSubscriber(Subscriber $subscriber) {
|
||||
$entityManager = ContainerWrapper::getInstance()->get(EntityManager::class);
|
||||
$userAgentsTable = $entityManager->getClassMetadata(UserAgentEntity::class)->getTableName();
|
||||
|
||||
return static::tableAlias('opens')
|
||||
->select('opens.id', 'id')
|
||||
->select('newsletter_rendered_subject')
|
||||
->select('opens.created_at', 'created_at')
|
||||
->select('user_agent.user_agent')
|
||||
->join(
|
||||
SendingQueue::$_table,
|
||||
['opens.queue_id', '=', 'queue.id'],
|
||||
'queue'
|
||||
)
|
||||
->leftOuterJoin(
|
||||
$userAgentsTable,
|
||||
['opens.user_agent_id', '=', 'user_agent.id'],
|
||||
'user_agent'
|
||||
)
|
||||
->where('opens.subscriber_id', $subscriber->id())
|
||||
->orderByAsc('newsletter_rendered_subject');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user