Use doctrine for latest post fetching

[MAILPOET-2899]
This commit is contained in:
Pavel Dohnal
2020-05-27 09:49:19 +02:00
committed by Veljko V
parent 7b0c5e61fe
commit c63c49af89
6 changed files with 78 additions and 35 deletions

View File

@ -10,9 +10,4 @@ namespace MailPoet\Models;
class NewsletterPost extends Model {
public static $_table = MP_NEWSLETTER_POSTS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public static function getNewestNewsletterPost($newsletterId) {
return self::where('newsletter_id', $newsletterId)
->orderByDesc('created_at')
->findOne();
}
}