Commit Graph

104 Commits

Author SHA1 Message Date
Pavel Dohnal
dcc8eccb42 Add control for selecting segments
[MAILPOET-3502]
2021-11-30 12:33:38 +01:00
Rodrigo Primo
c701f02d27 Pass a copy of the Carbon object to avoid unexpected side effects
This commit changes LastSubscribedAtListener to pass a copy of the Carbon
object representing the current time to the SubscriberEntity property
lastSubscribedAt. Passing a copy instead of the object itself is needed to
avoid unexpected side effects. Before this change, modifying the time
of this property of a given SubscriberEntity instance could affect the
same field of another instance as the same object used inside
LastSubscribedAtListener for all entities.

[MAILPOET-3946]
2021-11-22 10:52:58 +01:00
Rodrigo Primo
2e050d7a32 Pass a copy of the Carbon object to avoid unexpected side effects
This commit changes TimestampListener to pass a copy of the Carbon
object representing the current time to the entity properties updatedAt
and createdAt. Passing a copy instead of the object itself is needed to
avoid unexpected side effects. Before this change, modifying the time
of the createdAt or updatedAt field of a given entity could affect the
same field of another entity as it could be the same object used inside
TimestampListener for all entities.

[MAILPOET-3870]
2021-11-22 09:58:49 +01:00
Rodrigo Primo
ae99fe3be2 Use Doctrine references when saving links
This commit changes the code of the method
\MailPoet\Newsletter\Links\Links::save() to use Doctrine references
instead of full entities when getting a newsletter and sending queue
entities to save the related links.

We don't need the full entities here, and getting a full entity for the
sending queue was generating an error in the
testItLogsErrorWhenNewlyRenderedNewsletterBodyIsInvalid() integration
test (see the description of PR
https://github.com/mailpoet/mailpoet/pull/3784 for more details).

To be able to get the reference, it was necessary to add a helper method
called getReference() to \MailPoet\Doctrine\Repository.

[MAILPOET-3816]
2021-11-15 13:03:47 +01:00
Rostislav Wolny
5134713c2d Optimize memory usage for batch processing of template images
NewsletterTemplateEntity carries base64 data of image. This commit changes how we load templates entities when we process thumbnail images so that there is only one template in memory.
[MAILPOET-2686]
2021-11-08 13:24:53 +01:00
Jan Lysý
8d2cd8e476 Add listeners cleanup
[MAILPOET-3833]
2021-11-03 13:34:15 +01:00
Rostislav Wolny
73a9bed483 Replace deprecated doctrine methods in lib directory
[MAILPOET-3889]
2021-10-28 15:44:18 +02:00
Rostislav Wolny
86e938b46e Provide PSR array cache and switch annotation reader to it
The annotation reader was using CachedReader which has been deprecated so we need to switch to PsrCachedReader
Since 2.0 doctrine/cache no longer provides implementations of caches so I also needed to implement a simple PSR array cache.
[MAILPOET-3892]
2021-10-28 15:44:18 +02:00
Rostislav Wolny
503283fa63 Provide array cache implementation
doctrine/cache 2.0 no longer provides implementations of caches. It provides only interfaces.
We need only PHP array cache so I chose to implement this simple cache instead of introducing
new cache library.
[MAILPOET-3892]
2021-10-28 15:44:18 +02:00
Rodrigo Primo
e59992cc16 Fix checkGenericClassInNonGenericObjectType PHPStan errors
This commit removes the checkGenericClassInNonGenericObjectType flag
from PHPStan configuration files and fixes all associated errors in our
code base.

[MAILPOET-3236]
2021-08-09 12:58:56 +02:00
Rostislav Wolny
f77392ade4 Workaround doctrine serialisation issue in integration tests
Doctrine uses a default ProxyClassNameResolver but it is implemented
as an anonymous class and can not be serialised. This commit adds a custom
ProxyClassNameResolver that copies the anonymous one so that we avoid using the
anonymous fallback.
[MAILPOET-3658]
2021-07-06 13:29:00 +02:00
Rostislav Wolny
ff42762f93 Remove custom PDO driver
[MAILPOET-3658]
2021-07-06 13:29:00 +02:00
Rostislav Wolny
8af9b412ad Switch to built in PDO driver
[MAILPOET-3658]
2021-07-06 13:29:00 +02:00
Rostislav Wolny
c9603b76dc Update doctrine packages and fix metadata cache
[MAILPOET-3658]
2021-07-06 13:29:00 +02:00
Pavel Dohnal
ea1a946a7b Use WP connection db port if missing in config
[MAILPOET-3580]
2021-05-24 13:23:41 +02:00
Jan Lysý
8060a513ad Fix hitting metadata cache for proxy's interfaces
[MAILPOET-3533]
2021-05-12 14:42:22 +02:00
Pavel Dohnal
abca6729e8 Turn off ansi quotes directive
[MAILPOET-3579]
2021-04-28 09:36:01 +02:00
Jan Lysý
5af29f8aac Use Carbon::instance method in DateTimeTzToStringType
[MAILPOET-3032]
2021-04-12 14:26:36 +02:00
Jan Lysý
4631fb7320 Add SubscriberIP entity and repository
[MAILPOET-3032]
2021-04-12 14:26:36 +02:00
wxa
e55fa5e0b8 Remove unused imports
[MAILPOET-3420]
2021-03-29 15:40:30 +02:00
Pavel Dohnal
2360fe0a5a Check existence panels shen creating debugger
[MAILPOET-3420]
2021-03-29 15:40:30 +02:00
Jan Lysý
5045dd6aa7 Skip setting created at when is not empty in TimestampListener
[MAILPOET-3031]
2021-03-29 15:22:53 +02:00
Jan Lysý
fd5a9904c0 Add listener for updating lastSubscribedAt
[MAILPOET-3031]
2021-03-29 15:22:53 +02:00
Jan Lysý
7b893dfb51 Move multi insert functionality to a special repository
[MAILPOET-3378]
2021-02-18 10:13:44 +01:00
Jan Lysý
78d87120f3 Add method for multi insert or update to Repository
[MAILPOET-3378]
2021-02-18 10:13:44 +01:00
Jan Lysý
4390a1932d Remove phpstan errors from the rest of the code
[MAILPOET-3235]
2021-01-18 14:39:42 +01:00
Rostislav Wolny
35a25e119f Remove unnecessary type checks
These were added during initial testing of php8 compatibility using PHPStan and were false positive due PHPStan issues.
[MAILPOET-2837]
2021-01-04 12:28:53 +01:00
Rostislav Wolny
16a0d54a31 Remove unsecure string from error message
[MAILPOET-3296]
2020-12-07 11:36:01 +01:00
Rostislav Wolny
d13f63b3e2 Fix other minor type issues in libs
[MAILPOET-3926]
2020-12-07 11:36:01 +01:00
Rostislav Wolny
82f666c488 Fix type issues in Doctrine Driver
[MAILPOET-3296]
2020-12-07 11:36:01 +01:00
Rostislav Wolny
386f0c66b4 Don't use transactions for statements with implicit commit
[MAILPOET-3926]
2020-12-07 11:36:01 +01:00
Rostislav Wolny
12cc818f8b Fix required after optional parameter in doctrine config factory
[MAILPOET-3296]
2020-12-07 11:36:01 +01:00
Pavel Dohnal
a751a2a459 Add custom Doctrine Driver
[MAILPOET-3150]
2020-11-16 09:41:13 +01:00
Pavel Dohnal
fcbfd6fb68 Refactor shortcode categories to doctrine
[MAILPOET-2993]
2020-11-11 11:34:55 +01:00
Pavel Dohnal
95cf33b176 Create a PSR cache for validator
[MAILPOET-3241]
2020-10-28 09:55:55 +01:00
Pavel Dohnal
e2d6fb77ce Create a PSR cache for validator
[MAILPOET-3241]
2020-10-28 09:55:55 +01:00
Pavel Dohnal
79d90514e2 Update symfony validator
[MAILPOET-3241]
2020-10-28 09:55:55 +01:00
Rostislav Wolny
2f1ea71e73 Fix Doctrine deprecation warnings in lib
[MAILPOET-3146]
2020-10-08 15:59:05 +02:00
Rostislav Wolny
bf7bd6d2d9 Fix other phpstan errors in lib
[MAILPOET-3146]
2020-10-08 15:59:05 +02:00
Rostislav Wolny
96f2bfaa20 Add entity lifecycle listener for emoji sanitisation
[MAILPOET-3196]
2020-10-06 17:36:44 +02:00
Rostislav Wolny
fab74d82dc Disable ONLY_FULL_GROUP_BY mode for db connection
[MAILPOET-3115]
2020-08-27 13:56:57 +02:00
Rostislav Wolny
a7650bf22c Keep ONLY_FULL_GROUP_BY restriction for plugin DB connection
[MAILPOET-2630]
2020-07-29 13:50:54 +02:00
Rostislav Wolny
a8d11bf045 Replace Newsletter delete,trash,replace by new bulkMethods
[MAILPOET-2898][MAILPOET-2758]
2020-06-17 14:37:06 +02:00
Pavel Dohnal
2371913473 Add more details to a json parse error
[MAILPOET-2935]
2020-06-08 15:37:07 +02:00
Jan Jakeš
e69188c5a0 Map bigint DB type to "int" (not as DBAL historically does to "string")
[MAILPOET-2945]
2020-05-27 13:40:41 +02:00
Jan Jakeš
86a24ad674 Use PHPStan generics
[MAILPOET-2900]
2020-05-25 17:49:07 +02:00
Pavel Dohnal
489fe25fdd Make sure the values have correct types
[MAILPOET-2716]
2020-04-24 11:44:09 +02:00
Jan Jakeš
770a831d3d Add SafeToOneAssociationLoadTrait
[MAILPOET-2793]
2020-03-18 18:24:38 +01:00
Pavel Dohnal
521b473755 Sanitize database values before they are decoded
[MAILPOET-2674]
2020-03-11 16:38:52 +00:00
Jan Jakeš
b39dac75d6 Autofix number of newlines between methods
[MAILPOET-2715]
2020-02-19 19:12:53 +00:00