Refactor listing handler to reusable service

[MAILPOET-1689]
This commit is contained in:
Rostislav Wolny
2018-12-12 18:49:15 +01:00
parent fd4bcee5f5
commit a69ae0eea7
8 changed files with 132 additions and 144 deletions

View File

@@ -36,12 +36,8 @@ class Segments extends APIEndpoint {
}
function listing($data = array()) {
$listing = new Listing\Handler(
'\MailPoet\Models\Segment',
$data
);
$listing_data = $listing->get();
$listing = new Listing\Handler();
$listing_data = $listing->get('\MailPoet\Models\Segment', $data);
$data = array();
foreach($listing_data['items'] as $segment) {