Replace deprecated doctrine methods in lib directory
[MAILPOET-3889]
This commit is contained in:
committed by
Veljko V
parent
efde80b5c4
commit
73a9bed483
@@ -716,7 +716,7 @@ class Populator {
|
||||
t.status = :tStatusScheduled
|
||||
AND n.status = :nStatusDraft
|
||||
";
|
||||
$this->entityManager->getConnection()->executeUpdate(
|
||||
$this->entityManager->getConnection()->executeStatement(
|
||||
$query,
|
||||
[
|
||||
'tStatusPaused' => ScheduledTaskEntity::STATUS_PAUSED,
|
||||
|
@@ -59,7 +59,7 @@ class StatsNotificationsRepository extends Repository {
|
||||
public function deleteOrphanedScheduledTasks() {
|
||||
$scheduledTasksTable = $this->entityManager->getClassMetadata(ScheduledTaskEntity::class)->getTableName();
|
||||
$statsNotificationsTable = $this->entityManager->getClassMetadata(StatsNotificationEntity::class)->getTableName();
|
||||
$this->entityManager->getConnection()->executeUpdate("
|
||||
$this->entityManager->getConnection()->executeStatement("
|
||||
DELETE st FROM $scheduledTasksTable st
|
||||
LEFT JOIN $statsNotificationsTable sn ON sn.task_id = st.id
|
||||
WHERE sn.id IS NULL AND st.type = :taskType;
|
||||
|
@@ -79,10 +79,10 @@ abstract class Repository {
|
||||
public function truncate() {
|
||||
$tableName = $this->classMetadata->getTableName();
|
||||
$connection = $this->entityManager->getConnection();
|
||||
$connection->query('SET FOREIGN_KEY_CHECKS=0');
|
||||
$connection->executeQuery('SET FOREIGN_KEY_CHECKS=0');
|
||||
$q = "TRUNCATE $tableName";
|
||||
$connection->executeUpdate($q);
|
||||
$connection->query('SET FOREIGN_KEY_CHECKS=1');
|
||||
$connection->executeStatement($q);
|
||||
$connection->executeQuery('SET FOREIGN_KEY_CHECKS=1');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -187,7 +187,7 @@ class NewslettersRepository extends Repository {
|
||||
// Trash scheduled tasks
|
||||
$scheduledTasksTable = $this->entityManager->getClassMetadata(ScheduledTaskEntity::class)->getTableName();
|
||||
$sendingQueueTable = $this->entityManager->getClassMetadata(SendingQueueEntity::class)->getTableName();
|
||||
$this->entityManager->getConnection()->executeUpdate("
|
||||
$this->entityManager->getConnection()->executeStatement("
|
||||
UPDATE $scheduledTasksTable t
|
||||
JOIN $sendingQueueTable q ON t.`id` = q.`task_id`
|
||||
SET t.`deleted_at` = NOW()
|
||||
@@ -195,7 +195,7 @@ class NewslettersRepository extends Repository {
|
||||
", ['ids' => $ids], ['ids' => Connection::PARAM_INT_ARRAY]);
|
||||
|
||||
// Trash sending queues
|
||||
$this->entityManager->getConnection()->executeUpdate("
|
||||
$this->entityManager->getConnection()->executeStatement("
|
||||
UPDATE $sendingQueueTable q
|
||||
SET q.`deleted_at` = NOW()
|
||||
WHERE q.`newsletter_id` IN (:ids)
|
||||
@@ -222,7 +222,7 @@ class NewslettersRepository extends Repository {
|
||||
// Restore scheduled tasks and pause running ones
|
||||
$scheduledTasksTable = $this->entityManager->getClassMetadata(ScheduledTaskEntity::class)->getTableName();
|
||||
$sendingQueueTable = $this->entityManager->getClassMetadata(SendingQueueEntity::class)->getTableName();
|
||||
$this->entityManager->getConnection()->executeUpdate("
|
||||
$this->entityManager->getConnection()->executeStatement("
|
||||
UPDATE $scheduledTasksTable t
|
||||
JOIN $sendingQueueTable q ON t.`id` = q.`task_id`
|
||||
SET t.`deleted_at` = null, t.`status` = IFNULL(t.status, :pausedStatus)
|
||||
@@ -235,7 +235,7 @@ class NewslettersRepository extends Repository {
|
||||
]);
|
||||
|
||||
// Restore sending queues
|
||||
$this->entityManager->getConnection()->executeUpdate("
|
||||
$this->entityManager->getConnection()->executeStatement("
|
||||
UPDATE $sendingQueueTable q
|
||||
SET q.`deleted_at` = null
|
||||
WHERE q.`newsletter_id` IN (:ids)
|
||||
@@ -255,46 +255,46 @@ class NewslettersRepository extends Repository {
|
||||
$this->entityManager->transactional(function (EntityManager $entityManager) use ($ids) {
|
||||
// Delete statistics data
|
||||
$newsletterStatisticsTable = $entityManager->getClassMetadata(StatisticsNewsletterEntity::class)->getTableName();
|
||||
$entityManager->getConnection()->executeUpdate("
|
||||
$entityManager->getConnection()->executeStatement("
|
||||
DELETE s FROM $newsletterStatisticsTable s
|
||||
WHERE s.`newsletter_id` IN (:ids)
|
||||
", ['ids' => $ids], ['ids' => Connection::PARAM_INT_ARRAY]);
|
||||
|
||||
$statisticsOpensTable = $entityManager->getClassMetadata(StatisticsOpenEntity::class)->getTableName();
|
||||
$entityManager->getConnection()->executeUpdate("
|
||||
$entityManager->getConnection()->executeStatement("
|
||||
DELETE s FROM $statisticsOpensTable s
|
||||
WHERE s.`newsletter_id` IN (:ids)
|
||||
", ['ids' => $ids], ['ids' => Connection::PARAM_INT_ARRAY]);
|
||||
|
||||
$statisticsClicksTable = $entityManager->getClassMetadata(StatisticsClickEntity::class)->getTableName();
|
||||
$entityManager->getConnection()->executeUpdate("
|
||||
$entityManager->getConnection()->executeStatement("
|
||||
DELETE s FROM $statisticsClicksTable s
|
||||
WHERE s.`newsletter_id` IN (:ids)
|
||||
", ['ids' => $ids], ['ids' => Connection::PARAM_INT_ARRAY]);
|
||||
|
||||
$statisticsPurchasesTable = $entityManager->getClassMetadata(StatisticsWooCommercePurchaseEntity::class)->getTableName();
|
||||
$entityManager->getConnection()->executeUpdate("
|
||||
$entityManager->getConnection()->executeStatement("
|
||||
DELETE s FROM $statisticsPurchasesTable s
|
||||
WHERE s.`newsletter_id` IN (:ids)
|
||||
", ['ids' => $ids], ['ids' => Connection::PARAM_INT_ARRAY]);
|
||||
|
||||
// Delete newsletter posts
|
||||
$postsTable = $entityManager->getClassMetadata(NewsletterPostEntity::class)->getTableName();
|
||||
$entityManager->getConnection()->executeUpdate("
|
||||
$entityManager->getConnection()->executeStatement("
|
||||
DELETE np FROM $postsTable np
|
||||
WHERE np.`newsletter_id` IN (:ids)
|
||||
", ['ids' => $ids], ['ids' => Connection::PARAM_INT_ARRAY]);
|
||||
|
||||
// Delete newsletter options
|
||||
$optionsTable = $entityManager->getClassMetadata(NewsletterOptionEntity::class)->getTableName();
|
||||
$entityManager->getConnection()->executeUpdate("
|
||||
$entityManager->getConnection()->executeStatement("
|
||||
DELETE no FROM $optionsTable no
|
||||
WHERE no.`newsletter_id` IN (:ids)
|
||||
", ['ids' => $ids], ['ids' => Connection::PARAM_INT_ARRAY]);
|
||||
|
||||
// Delete newsletter links
|
||||
$linksTable = $entityManager->getClassMetadata(NewsletterLinkEntity::class)->getTableName();
|
||||
$entityManager->getConnection()->executeUpdate("
|
||||
$entityManager->getConnection()->executeStatement("
|
||||
DELETE nl FROM $linksTable nl
|
||||
WHERE nl.`newsletter_id` IN (:ids)
|
||||
", ['ids' => $ids], ['ids' => Connection::PARAM_INT_ARRAY]);
|
||||
@@ -305,15 +305,15 @@ class NewslettersRepository extends Repository {
|
||||
$taskIds = $entityManager->getConnection()->executeQuery("
|
||||
SELECT task_id FROM $statsNotificationsTable sn
|
||||
WHERE sn.`newsletter_id` IN (:ids)
|
||||
", ['ids' => $ids], ['ids' => Connection::PARAM_INT_ARRAY])->fetchAll();
|
||||
", ['ids' => $ids], ['ids' => Connection::PARAM_INT_ARRAY])->fetchAllAssociative();
|
||||
$taskIds = array_column($taskIds, 'task_id');
|
||||
$entityManager->getConnection()->executeUpdate("
|
||||
$entityManager->getConnection()->executeStatement("
|
||||
DELETE st FROM $scheduledTasksTable st
|
||||
WHERE st.`id` IN (:ids)
|
||||
", ['ids' => $taskIds], ['ids' => Connection::PARAM_INT_ARRAY]);
|
||||
|
||||
// Delete stats notifications
|
||||
$entityManager->getConnection()->executeUpdate("
|
||||
$entityManager->getConnection()->executeStatement("
|
||||
DELETE sn FROM $statsNotificationsTable sn
|
||||
WHERE sn.`newsletter_id` IN (:ids)
|
||||
", ['ids' => $ids], ['ids' => Connection::PARAM_INT_ARRAY]);
|
||||
@@ -323,28 +323,28 @@ class NewslettersRepository extends Repository {
|
||||
$scheduledTaskSubscribersTable = $entityManager->getClassMetadata(ScheduledTaskSubscriberEntity::class)->getTableName();
|
||||
|
||||
// Delete scheduled tasks subscribers
|
||||
$entityManager->getConnection()->executeUpdate("
|
||||
$entityManager->getConnection()->executeStatement("
|
||||
DELETE ts FROM $scheduledTaskSubscribersTable ts
|
||||
JOIN $scheduledTasksTable t ON t.`id` = ts.`task_id`
|
||||
JOIN $sendingQueueTable q ON q.`task_id` = t.`id`
|
||||
WHERE q.`newsletter_id` IN (:ids)
|
||||
", ['ids' => $ids], ['ids' => Connection::PARAM_INT_ARRAY]);
|
||||
|
||||
$entityManager->getConnection()->executeUpdate("
|
||||
$entityManager->getConnection()->executeStatement("
|
||||
DELETE t FROM $scheduledTasksTable t
|
||||
JOIN $sendingQueueTable q ON t.`id` = q.`task_id`
|
||||
WHERE q.`newsletter_id` IN (:ids)
|
||||
", ['ids' => $ids], ['ids' => Connection::PARAM_INT_ARRAY]);
|
||||
|
||||
// Delete sending queues
|
||||
$entityManager->getConnection()->executeUpdate("
|
||||
$entityManager->getConnection()->executeStatement("
|
||||
DELETE q FROM $sendingQueueTable q
|
||||
WHERE q.`newsletter_id` IN (:ids)
|
||||
", ['ids' => $ids], ['ids' => Connection::PARAM_INT_ARRAY]);
|
||||
|
||||
// Delete newsletter segments
|
||||
$newsletterSegmentsTable = $entityManager->getClassMetadata(NewsletterSegmentEntity::class)->getTableName();
|
||||
$entityManager->getConnection()->executeUpdate("
|
||||
$entityManager->getConnection()->executeStatement("
|
||||
DELETE ns FROM $newsletterSegmentsTable ns
|
||||
WHERE ns.`newsletter_id` IN (:ids)
|
||||
", ['ids' => $ids], ['ids' => Connection::PARAM_INT_ARRAY]);
|
||||
|
@@ -50,7 +50,7 @@ class SegmentSaveController {
|
||||
FROM $subscriberSegmentTable
|
||||
WHERE segment_id = :segmentId
|
||||
");
|
||||
$stmt->execute([
|
||||
$stmt->executeQuery([
|
||||
'duplicateId' => $duplicate->getId(),
|
||||
'segmentId' => $segmentEntity->getId(),
|
||||
]);
|
||||
|
@@ -324,7 +324,7 @@ class SegmentSubscribersRepository {
|
||||
|
||||
$queryBuilder
|
||||
->leftJoin('s', $subscribersSegmentTable, 'ssg',
|
||||
(string)$queryBuilder->expr()->andX(
|
||||
(string)$queryBuilder->expr()->and(
|
||||
$queryBuilder->expr()->eq('ssg.subscriber_id', 's.id'),
|
||||
$queryBuilder->expr()->eq('ssg.status', ':statusSubscribed'),
|
||||
$queryBuilder->expr()->notIn('ssg.segment_id', $deletedSegmentsQueryBuilder->getQuery()->getSQL())
|
||||
|
@@ -148,7 +148,7 @@ class SegmentsRepository extends Repository {
|
||||
$segmentTable = $entityManager->getClassMetadata(SegmentEntity::class)->getTableName();
|
||||
$segmentFiltersTable = $entityManager->getClassMetadata(DynamicSegmentFilterEntity::class)->getTableName();
|
||||
|
||||
$entityManager->getConnection()->executeUpdate("
|
||||
$entityManager->getConnection()->executeStatement("
|
||||
DELETE ss FROM $subscriberSegmentTable ss
|
||||
JOIN $segmentTable s ON ss.`segment_id` = s.`id`
|
||||
WHERE ss.`segment_id` IN (:ids)
|
||||
@@ -158,14 +158,14 @@ class SegmentsRepository extends Repository {
|
||||
'type' => $type,
|
||||
], ['ids' => Connection::PARAM_INT_ARRAY]);
|
||||
|
||||
$entityManager->getConnection()->executeUpdate("
|
||||
$entityManager->getConnection()->executeStatement("
|
||||
DELETE df FROM $segmentFiltersTable df
|
||||
WHERE df.`segment_id` IN (:ids)
|
||||
", [
|
||||
'ids' => $ids,
|
||||
], ['ids' => Connection::PARAM_INT_ARRAY]);
|
||||
|
||||
return $entityManager->getConnection()->executeUpdate("
|
||||
return $entityManager->getConnection()->executeStatement("
|
||||
DELETE s FROM $segmentTable s
|
||||
WHERE s.`id` IN (:ids)
|
||||
AND s.`type` = :type
|
||||
|
@@ -21,7 +21,7 @@ class SettingsRepository extends Repository {
|
||||
// by a code solving atomicity of create-or-update on entity (ORM) level in a follow-up ticket.
|
||||
$now = Carbon::createFromTimestamp(WPFunctions::get()->currentTime('timestamp'));
|
||||
$tableName = $this->entityManager->getClassMetadata(SettingEntity::class)->getTableName();
|
||||
$this->entityManager->getConnection()->executeUpdate("
|
||||
$this->entityManager->getConnection()->executeStatement("
|
||||
INSERT INTO $tableName (name, value, created_at, updated_at)
|
||||
VALUES (:name, :value, :now, :now)
|
||||
ON DUPLICATE KEY UPDATE value = :value, updated_at = :now
|
||||
|
@@ -96,7 +96,7 @@ class ImportExportRepository {
|
||||
$rows[] = "(" . implode(', ', $paramNames) . ")";
|
||||
}
|
||||
|
||||
return $this->entityManager->getConnection()->executeUpdate("
|
||||
return $this->entityManager->getConnection()->executeStatement("
|
||||
INSERT IGNORE INTO {$tableName} (`" . implode("`, `", $columns) . "`) VALUES
|
||||
" . implode(", \n", $rows) . "
|
||||
", $parameters);
|
||||
@@ -156,7 +156,7 @@ class ImportExportRepository {
|
||||
$updateColumns[] = 'deleted_at = NULL';
|
||||
}
|
||||
|
||||
return $this->entityManager->getConnection()->executeUpdate("
|
||||
return $this->entityManager->getConnection()->executeStatement("
|
||||
UPDATE {$tableName} SET
|
||||
" . implode(", \n", $updateColumns) . "
|
||||
WHERE
|
||||
|
@@ -50,7 +50,7 @@ class SubscriberSegmentRepository extends Repository {
|
||||
} else {
|
||||
$subscriberSegmentTable = $this->entityManager->getClassMetadata(SubscriberSegmentEntity::class)->getTableName();
|
||||
$segmentTable = $this->entityManager->getClassMetadata(SegmentEntity::class)->getTableName();
|
||||
$this->entityManager->getConnection()->executeUpdate("
|
||||
$this->entityManager->getConnection()->executeStatement("
|
||||
UPDATE $subscriberSegmentTable ss
|
||||
JOIN $segmentTable s ON s.`id` = ss.`segment_id` AND ss.`subscriber_id` = :subscriberId
|
||||
SET ss.`status` = :status
|
||||
|
@@ -136,7 +136,7 @@ class SubscribersRepository extends Repository {
|
||||
// Delete subscriber custom fields
|
||||
$subscriberCustomFieldTable = $entityManager->getClassMetadata(SubscriberCustomFieldEntity::class)->getTableName();
|
||||
$subscriberTable = $entityManager->getClassMetadata(SubscriberEntity::class)->getTableName();
|
||||
$entityManager->getConnection()->executeUpdate("
|
||||
$entityManager->getConnection()->executeStatement("
|
||||
DELETE scs FROM $subscriberCustomFieldTable scs
|
||||
JOIN $subscriberTable s ON s.`id` = scs.`subscriber_id`
|
||||
WHERE scs.`subscriber_id` IN (:ids)
|
||||
@@ -165,7 +165,7 @@ class SubscribersRepository extends Repository {
|
||||
}
|
||||
|
||||
$subscriberSegmentsTable = $this->entityManager->getClassMetadata(SubscriberSegmentEntity::class)->getTableName();
|
||||
$count = $this->entityManager->getConnection()->executeUpdate("
|
||||
$count = $this->entityManager->getConnection()->executeStatement("
|
||||
DELETE ss FROM $subscriberSegmentsTable ss
|
||||
WHERE ss.`subscriber_id` IN (:ids)
|
||||
AND ss.`segment_id` = :segment_id
|
||||
@@ -184,7 +184,7 @@ class SubscribersRepository extends Repository {
|
||||
|
||||
$subscriberSegmentsTable = $this->entityManager->getClassMetadata(SubscriberSegmentEntity::class)->getTableName();
|
||||
$segmentsTable = $this->entityManager->getClassMetadata(SegmentEntity::class)->getTableName();
|
||||
$count = $this->entityManager->getConnection()->executeUpdate("
|
||||
$count = $this->entityManager->getConnection()->executeStatement("
|
||||
DELETE ss FROM $subscriberSegmentsTable ss
|
||||
JOIN $segmentsTable s ON s.id = ss.segment_id AND s.`type` = :typeDefault
|
||||
WHERE ss.`subscriber_id` IN (:ids)
|
||||
|
Reference in New Issue
Block a user