"> supports-preserve-symlinks-flag 30f7226d9a first commit il y a 3 ans tailwind-color-palette 30f7226d9a first commit il y a 3 ans tailwindcss 30f7226d9a first commit il y a 3 ans thenify 30f7226d9a first commit il y a 3 ans thenify-all 30f7226d9a first commit il y a 3 ans to-regex-range 30f7226d9a first commit il y a 3 ans tr46 30f7226d9a first commit il y a 3 ans ts-interface-checker 30f7226d9a first commit il y a 3 ans uglify-js 30f7226d9a first commit il y a 3 ans underscore 30f7226d9a first commit il y a 3 ans upper-case 30f7226d9a first commit il y a 3 ans util-deprecate 30f7226d9a first commit il y a 3 ans valid-data-url 30f7226d9a first commit il y a 3 ans web-resource-inliner 30f7226d9a first commit il y a 3 ans webidl-conversions 30f7226d9a first commit il y a 3 ans whatwg-url 30f7226d9a first commit il y a 3 ans wrap-ansi 30f7226d9a first commit il y a 3 ans wrappy 30f7226d9a first commit il y a 3 ans y18n 30f7226d9a first commit il y a 3 ans yallist 30f7226d9a first commit il y a 3 ans yaml 30f7226d9a first commit il y a 3 ans yargs 30f7226d9a first commit il y a 3 ans yargs-parser 30f7226d9a first commit il y a 3 ans .yarn-integrity 30f7226d9a first commit il y a 3 ans tum/whitesports - Gogs: Simplico Git Service

Нема описа

SubscriberCustomFieldRepository.php 1.1KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace MailPoet\Subscribers;
  3. if (!defined('ABSPATH')) exit;
  4. use MailPoet\Doctrine\Repository;
  5. use MailPoet\Entities\CustomFieldEntity;
  6. use MailPoet\Entities\SubscriberCustomFieldEntity;
  7. use MailPoet\Entities\SubscriberEntity;
  8. /**
  9. * @extends Repository<SubscriberCustomFieldEntity>
  10. */
  11. class SubscriberCustomFieldRepository extends Repository {
  12. protected function getEntityClassName() {
  13. return SubscriberCustomFieldEntity::class;
  14. }
  15. /**
  16. * @param string|array|null $value
  17. */
  18. public function createOrUpdate(SubscriberEntity $subscriber, CustomFieldEntity $customField, $value): SubscriberCustomFieldEntity {
  19. $subscriberCustomField = $this->findOneBy(['subscriber' => $subscriber, 'customField' => $customField]);
  20. if ($subscriberCustomField instanceof SubscriberCustomFieldEntity) {
  21. $subscriberCustomField->setValue($value);
  22. } else {
  23. $subscriberCustomField = new SubscriberCustomFieldEntity($subscriber, $customField, $value);
  24. $this->entityManager->persist($subscriberCustomField);
  25. }
  26. $this->entityManager->flush();
  27. return $subscriberCustomField;
  28. }
  29. }