Przeglądaj źródła

[Backend] News : correctif filtre merchant Newsletter

packProduct
Guillaume 2 lat temu
rodzic
commit
d6f2545a3e
3 zmienionych plików z 13 dodań i 1 usunięć
  1. +5
    -1
      Definition/Field/Site/NewsFieldDefinition.php
  2. +5
    -0
      Model/Newsletter/NewsletterModel.php
  3. +3
    -0
      Repository/Newsletter/NewsletterStore.php

+ 5
- 1
Definition/Field/Site/NewsFieldDefinition.php Wyświetl plik

@@ -36,7 +36,11 @@ class NewsFieldDefinition extends SovNewsFieldDefinition
{
$fieldArray = parent::configureFields();

$newsletterArray = $this->newsletterStore->setSection($this->section)->get();
$newsletterArray = $this->newsletterStore
->setSection($this->section)
->setMerchant($this->merchant)
->get();

$fieldArray['newsletter']->setFormTypeOption('choices', $newsletterArray);

return $fieldArray;

+ 5
- 0
Model/Newsletter/NewsletterModel.php Wyświetl plik

@@ -17,6 +17,11 @@ abstract class NewsletterModel extends SovNewsletterModel implements FilterSecti
*/
protected $section;

public function __toString()
{
return $this->getTitle(). ' - '.$this->getSection()->getMerchant()->getTitle();
}

public function getSection(): SectionInterface
{
return $this->section;

+ 3
- 0
Repository/Newsletter/NewsletterStore.php Wyświetl plik

@@ -3,6 +3,7 @@
namespace Lc\CaracoleBundle\Repository\Newsletter;

use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\CaracoleBundle\Repository\StoreTrait;
use Lc\SovBundle\Repository\Newsletter\NewsletterStore as SovNewsletterStore;
@@ -12,6 +13,7 @@ class NewsletterStore extends SovNewsletterStore
{
use StoreTrait;
use SectionStoreTrait;
use MerchantStoreTrait;

public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
@@ -22,6 +24,7 @@ class NewsletterStore extends SovNewsletterStore
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
$this->addFilterBySectionOptionnal($query);
$this->addFilterByMerchantViaSectionOptionnal($query);
$query->filterIsOnlineAndOffline();
return $query;
}

Ładowanie…
Anuluj
Zapisz