Replace usages of StatisticsForms with Doctrine
[MAILPOET-3032]
This commit is contained in:
@ -3,11 +3,18 @@
|
||||
namespace MailPoet\API\JSON\ResponseBuilders;
|
||||
|
||||
use MailPoet\Entities\FormEntity;
|
||||
use MailPoet\Models\StatisticsForms;
|
||||
use MailPoet\Statistics\StatisticsFormsRepository;
|
||||
|
||||
class FormsResponseBuilder {
|
||||
const DATE_FORMAT = 'Y-m-d H:i:s';
|
||||
|
||||
/** @var StatisticsFormsRepository */
|
||||
private $statisticsFormsRepository;
|
||||
|
||||
public function __construct(StatisticsFormsRepository $statisticsFormsRepository) {
|
||||
$this->statisticsFormsRepository = $statisticsFormsRepository;
|
||||
}
|
||||
|
||||
public function build(FormEntity $form) {
|
||||
return [
|
||||
'id' => (string)$form->getId(), // (string) for BC
|
||||
@ -27,7 +34,7 @@ class FormsResponseBuilder {
|
||||
|
||||
foreach ($forms as $form) {
|
||||
$form = $this->build($form);
|
||||
$form['signups'] = StatisticsForms::getTotalSignups($form['id']);
|
||||
$form['signups'] = $this->statisticsFormsRepository->getTotalSignups($form['id']);
|
||||
$form['segments'] = (
|
||||
!empty($form['settings']['segments'])
|
||||
? $form['settings']['segments']
|
||||
|
Reference in New Issue
Block a user