Browse Source

[Backend] News : correctif filtre merchant Newsletter

packProduct
Guillaume 2 years ago
parent
commit
d6f2545a3e
3 changed files with 13 additions and 1 deletions
  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 View File

@@ -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 View File

@@ -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 View File

@@ -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;
}

Loading…
Cancel
Save