Convert Doctrine specific code to camel case
[MAILPOET-1796]
This commit is contained in:
@ -32,7 +32,7 @@ class CustomFields extends APIEndpoint {
|
||||
}
|
||||
|
||||
public function getAll() {
|
||||
$collection = $this->customFieldsRepository->findBy([], ['created_at' => 'asc']);
|
||||
$collection = $this->customFieldsRepository->findBy([], ['createdAt' => 'asc']);
|
||||
return $this->successResponse($this->customFieldsResponseBuilder->buildBatch($collection));
|
||||
}
|
||||
|
||||
|
@ -314,7 +314,7 @@ class Populator {
|
||||
private function createOrUpdateUserFlag($userId, $name, $value) {
|
||||
$userFlagsRepository = \MailPoet\DI\ContainerWrapper::getInstance(WP_DEBUG)->get(UserFlagsRepository::class);
|
||||
$flag = $userFlagsRepository->findOneBy([
|
||||
'user_id' => $userId,
|
||||
'userId' => $userId,
|
||||
'name' => $name,
|
||||
]);
|
||||
|
||||
|
@ -45,7 +45,7 @@ class Mailer {
|
||||
}
|
||||
|
||||
public function getProcessingMethod() {
|
||||
return ($this->mailer->mailer_config['method'] === MailerFactory::METHOD_MAILPOET) ?
|
||||
return ($this->mailer->mailerConfig['method'] === MailerFactory::METHOD_MAILPOET) ?
|
||||
'bulk' :
|
||||
'individual';
|
||||
}
|
||||
@ -58,7 +58,7 @@ class Mailer {
|
||||
if ($this->getProcessingMethod() === 'individual') {
|
||||
throw new \LogicException('Trying to send a batch with individual processing method');
|
||||
}
|
||||
return $this->mailer->mailer_instance->send(
|
||||
return $this->mailer->mailerInstance->send(
|
||||
$preparedNewsletters,
|
||||
$preparedSubscribers,
|
||||
$extraParams
|
||||
@ -69,7 +69,7 @@ class Mailer {
|
||||
if ($this->getProcessingMethod() === 'bulk') {
|
||||
throw new \LogicException('Trying to send an individual email with a bulk processing method');
|
||||
}
|
||||
return $this->mailer->mailer_instance->send(
|
||||
return $this->mailer->mailerInstance->send(
|
||||
$preparedNewsletter,
|
||||
$preparedSubscriber,
|
||||
$extraParams
|
||||
|
@ -40,11 +40,11 @@ class StatsNotificationsRepository extends Repository {
|
||||
->addSelect('tasks')
|
||||
->addSelect('n')
|
||||
->addOrderBy('tasks.priority')
|
||||
->addOrderBy('tasks.updated_at')
|
||||
->where('tasks.deleted_at IS NULL')
|
||||
->addOrderBy('tasks.updatedAt')
|
||||
->where('tasks.deletedAt IS NULL')
|
||||
->andWhere('tasks.status = :status')
|
||||
->setParameter('status', ScheduledTaskEntity::STATUS_SCHEDULED)
|
||||
->andWhere('tasks.scheduled_at < :date')
|
||||
->andWhere('tasks.scheduledAt < :date')
|
||||
->setParameter('date', $date)
|
||||
->andWhere('tasks.type = :workerType')
|
||||
->setParameter('workerType', Worker::TASK_TYPE);
|
||||
|
@ -28,7 +28,7 @@ class NewslettersRepository extends Repository {
|
||||
->from(NewsletterEntity::class, 'n')
|
||||
->where('n.status = :status')
|
||||
->setParameter(':status', NewsletterEntity::STATUS_ACTIVE)
|
||||
->andWhere('n.deleted_at is null')
|
||||
->andWhere('n.deletedAt is null')
|
||||
->andWhere('n.type IN (:types)')
|
||||
->setParameter('types', $types)
|
||||
->orderBy('n.subject')
|
||||
|
@ -25,7 +25,7 @@ class NewsletterStatisticsRepository extends Repository {
|
||||
->createQueryBuilder('n')
|
||||
->join('n.queues', 'q')
|
||||
->join('q.task', 't')
|
||||
->select('SUM(q.count_processed)')
|
||||
->select('SUM(q.countProcessed)')
|
||||
->where('t.status = :status')
|
||||
->setParameter('status', ScheduledTaskEntity::STATUS_COMPLETED)
|
||||
->andWhere('q.newsletter = :newsletter')
|
||||
@ -78,7 +78,7 @@ class NewsletterStatisticsRepository extends Repository {
|
||||
try {
|
||||
$qb = $this->entityManager
|
||||
->createQueryBuilder();
|
||||
return $qb->select('COUNT(DISTINCT stats.subscriber_id) as cnt')
|
||||
return $qb->select('COUNT(DISTINCT stats.subscriberId) as cnt')
|
||||
->from($statisticsEntityName, 'stats')
|
||||
->where('stats.newsletter = :newsletter')
|
||||
->setParameter('newsletter', $newsletter)
|
||||
|
@ -62,8 +62,8 @@ class Track {
|
||||
$data->queue = SendingTask::createFromQueue($data->queue);
|
||||
}
|
||||
$data->subscriber = Subscriber::findOne($data->subscriberId) ?: null;
|
||||
$data->newsletter = (!empty($data->queue->newsletter_id)) ?
|
||||
Newsletter::findOne($data->queue->newsletter_id) :
|
||||
$data->newsletter = (!empty($data->queue->newsletterId)) ?
|
||||
Newsletter::findOne($data->queue->newsletterId) :
|
||||
false;
|
||||
if (!empty($data->linkHash)) {
|
||||
$data->link = NewsletterLink::where('hash', $data->linkHash)
|
||||
|
@ -44,7 +44,7 @@ class UserFlagsController {
|
||||
public function set($name, $value) {
|
||||
$currentUserId = WPFunctions::get()->getCurrentUserId();
|
||||
$flag = $this->userFlagsRepository->findOneBy([
|
||||
'user_id' => $currentUserId,
|
||||
'userId' => $currentUserId,
|
||||
'name' => $name,
|
||||
]);
|
||||
|
||||
@ -65,7 +65,7 @@ class UserFlagsController {
|
||||
public function delete($name) {
|
||||
$currentUserId = WPFunctions::get()->getCurrentUserId();
|
||||
$flag = $this->userFlagsRepository->findOneBy([
|
||||
'user_id' => $currentUserId,
|
||||
'userId' => $currentUserId,
|
||||
'name' => $name,
|
||||
]);
|
||||
|
||||
@ -83,7 +83,7 @@ class UserFlagsController {
|
||||
|
||||
private function load() {
|
||||
$currentUserId = WPFunctions::get()->getCurrentUserId();
|
||||
$flags = $this->userFlagsRepository->findBy(['user_id' => $currentUserId]);
|
||||
$flags = $this->userFlagsRepository->findBy(['userId' => $currentUserId]);
|
||||
$this->data = [];
|
||||
foreach ($flags as $flag) {
|
||||
$this->data[$flag->getName()] = $flag->getValue();
|
||||
|
@ -25,7 +25,7 @@ class SubscribersRepository extends Repository {
|
||||
->createQueryBuilder()
|
||||
->select('count(n.id)')
|
||||
->from(SubscriberEntity::class, 'n')
|
||||
->where('n.deleted_at IS NULL AND n.status IN (:statuses)')
|
||||
->where('n.deletedAt IS NULL AND n.status IN (:statuses)')
|
||||
->setParameter('statuses', [
|
||||
SubscriberEntity::STATUS_SUBSCRIBED,
|
||||
SubscriberEntity::STATUS_UNCONFIRMED,
|
||||
|
@ -132,10 +132,10 @@ class Pages {
|
||||
$subscriberData = $this->subscriber->getUnconfirmedData();
|
||||
|
||||
$this->subscriber->status = Subscriber::STATUS_SUBSCRIBED;
|
||||
$this->subscriber->confirmed_ip = Helpers::getIP();
|
||||
$this->subscriber->confirmedIp = Helpers::getIP();
|
||||
$this->subscriber->setExpr('confirmed_at', 'NOW()');
|
||||
$this->subscriber->setExpr('last_subscribed_at', 'NOW()');
|
||||
$this->subscriber->unconfirmed_data = null;
|
||||
$this->subscriber->unconfirmedData = null;
|
||||
$this->subscriber->save();
|
||||
|
||||
if ($this->subscriber->getErrors() === false) {
|
||||
|
@ -200,9 +200,9 @@ class Sending {
|
||||
}
|
||||
|
||||
public function updateCount() {
|
||||
$this->queue->count_processed = ScheduledTaskSubscriber::getProcessedCount($this->task->id);
|
||||
$this->queue->count_to_process = ScheduledTaskSubscriber::getUnprocessedCount($this->task->id);
|
||||
$this->queue->count_total = $this->queue->count_processed + $this->queue->count_to_process;
|
||||
$this->queue->countProcessed = ScheduledTaskSubscriber::getProcessedCount($this->task->id);
|
||||
$this->queue->countToProcess = ScheduledTaskSubscriber::getUnprocessedCount($this->task->id);
|
||||
$this->queue->countTotal = $this->queue->countProcessed + $this->queue->countToProcess;
|
||||
return $this->queue->save();
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ class UserFlags {
|
||||
|
||||
public function withFlag($name, $value) {
|
||||
$userFlag = $this->userFlagsRepository->findOneBy([
|
||||
'user_id' => $this->userId,
|
||||
'userId' => $this->userId,
|
||||
'name' => $name,
|
||||
]);
|
||||
|
||||
|
@ -68,7 +68,7 @@ class UserFlagsControllerTest extends \MailPoetTest {
|
||||
$this->userFlags->set('flag_1', 'updated_value');
|
||||
expect($this->userFlags->get('flag_1'))->equals('updated_value');
|
||||
$flag = $this->userFlagsRepository->findOneBy([
|
||||
'user_id' => $this->currentUserId,
|
||||
'userId' => $this->currentUserId,
|
||||
'name' => 'flag_1',
|
||||
]);
|
||||
expect($flag->getValue())->equals('updated_value');
|
||||
@ -79,7 +79,7 @@ class UserFlagsControllerTest extends \MailPoetTest {
|
||||
$this->userFlags->delete('flag_1');
|
||||
expect($this->userFlags->get('flag_1'))->equals('default_value_1');
|
||||
$flag = $this->userFlagsRepository->findOneBy([
|
||||
'user_id' => $this->currentUserId,
|
||||
'userId' => $this->currentUserId,
|
||||
'name' => 'flag_1',
|
||||
]);
|
||||
expect($flag)->null();
|
||||
@ -102,7 +102,7 @@ class UserFlagsControllerTest extends \MailPoetTest {
|
||||
|
||||
private function updateUserFlag($userId, $name, $value) {
|
||||
$flag = $this->userFlagsRepository->findOneBy([
|
||||
'user_id' => $userId,
|
||||
'userId' => $userId,
|
||||
'name' => $name,
|
||||
]);
|
||||
if (!$flag) {
|
||||
|
Reference in New Issue
Block a user