Remove old code

[MAILPOET-3168]
This commit is contained in:
Pavel Dohnal
2021-01-05 14:47:47 +01:00
committed by Veljko V
parent 6f0171373c
commit 761e57bdd2
2 changed files with 1 additions and 42 deletions

View File

@@ -100,16 +100,10 @@ class Segments extends APIEndpoint {
// $data = []; // $data = [];
// foreach ($listingData['items'] as $segment) { // foreach ($listingData['items'] as $segment) {
// $scheduledNewsletterSubjectsMap = $this->newsletterSegmentRepository->getScheduledNewsletterSubjectsBySegmentIds($segmendIds);
// $segment->subscribersUrl = WPFunctions::get()->adminUrl(
// 'admin.php?page=mailpoet-subscribers#/filter[segment=' . $segment->id . ']'
// );
// //
// $segmentData = $segment // $segmentData = $segment
// ->withSubscribersCount() // ->withSubscribersCount()
// ->withAutomatedEmailsSubjects()
// ->asArray(); // ->asArray();
// $segmentData['scheduled_emails_subjects'] = $scheduledNewsletterSubjectsMap[$segment->id] ?? [];
//$data[] = $segmentData; //$data[] = $segmentData;
// } // }

View File

@@ -126,29 +126,6 @@ class Segment extends Model {
return $this; return $this;
} }
public function withAutomatedEmailsSubjects() {
$automatedEmails = NewsletterSegment::tableAlias('relation')
->where('relation.segment_id', $this->id)
->join(
MP_NEWSLETTERS_TABLE,
'newsletters.id = relation.newsletter_id',
'newsletters'
)
->whereIn('newsletters.type', [
NewsletterEntity::TYPE_AUTOMATIC,
NewsletterEntity::TYPE_WELCOME,
NewsletterEntity::TYPE_NOTIFICATION,
])
->select('newsletters.subject')
->findMany();
$this->automatedEmailsSubjects = array_map(function($email) {
return $email->subject;
}, $automatedEmails);
return $this;
}
public static function getWPSegment() { public static function getWPSegment() {
$wpSegment = self::where('type', self::TYPE_WP_USERS)->findOne(); $wpSegment = self::where('type', self::TYPE_WP_USERS)->findOne();
@@ -212,10 +189,7 @@ class Segment extends Model {
return $types; return $types;
} }
public static function search($orm, $search = '') { // TODO REMOVE
return $orm->whereLike('name', '%' . $search . '%');
}
public static function groups() { public static function groups() {
$allQuery = Segment::getPublished(); $allQuery = Segment::getPublished();
$allQuery->whereNotEqual('type', DynamicSegment::TYPE_DYNAMIC); $allQuery->whereNotEqual('type', DynamicSegment::TYPE_DYNAMIC);
@@ -306,15 +280,6 @@ class Segment extends Model {
)->findArray(); )->findArray();
} }
public static function listingQuery(array $data = []) {
$query = self::select('*');
$query->whereIn('type', Segment::getSegmentTypes());
if (isset($data['group'])) {
$query->filter('groupBy', $data['group']);
}
return $query;
}
public static function getPublic() { public static function getPublic() {
return self::getPublished()->where('type', self::TYPE_DEFAULT)->orderByAsc('name'); return self::getPublished()->where('type', self::TYPE_DEFAULT)->orderByAsc('name');
} }