Browse Source

Admin : suppression des initQueryBuilder()

packProduct
Guillaume 3 years ago
parent
commit
83921b99f3
5 changed files with 30 additions and 6 deletions
  1. +3
    -0
      Field/AssociationField.php
  2. +19
    -2
      Model/Site/PageModel.php
  3. +2
    -1
      Repository/Site/PageRepositoryQuery.php
  4. +5
    -1
      Repository/Site/PageStore.php
  5. +1
    -2
      Repository/User/GroupUserStore.php

+ 3
- 0
Field/AssociationField.php View File

@@ -119,6 +119,9 @@ final class AssociationField implements FieldInterface
return $this;
}

/**
* @deprecated Utiliser setFormTypeOption('choices', $choices) avec $choices issu d'un Store.
*/
public function initQueryBuilder(): self
{
$param = $this->queryBuilderParameters;

+ 19
- 2
Model/Site/PageModel.php View File

@@ -4,6 +4,7 @@ namespace Lc\CaracoleBundle\Model\Site;

use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\SovBundle\Model\Site\PageModel as SovPageModel;

@@ -12,13 +13,30 @@ use Lc\SovBundle\Model\Site\PageModel as SovPageModel;
*/
abstract class PageModel extends SovPageModel implements FilterSectionInterface
{
/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface", inversedBy="pages")
* @ORM\JoinColumn(nullable=false)
* @ORM\JoinColumn(nullable=true)
*/
protected $section;

public function getMerchant(): ?MerchantInterface
{
return $this->merchant;
}

public function setMerchant(?MerchantInterface $merchant): self
{
$this->merchant = $merchant;

return $this;
}

public function getSection(): SectionInterface
{
return $this->section;
@@ -30,5 +48,4 @@ abstract class PageModel extends SovPageModel implements FilterSectionInterface

return $this;
}

}

+ 2
- 1
Repository/Site/PageRepositoryQuery.php View File

@@ -2,11 +2,12 @@

namespace Lc\CaracoleBundle\Repository\Site;

use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait;
use Lc\CaracoleBundle\Repository\SectionRepositoryQueryTrait;
use Lc\SovBundle\Repository\Site\PageRepositoryQuery as SovPageRepositoryQuery;

class PageRepositoryQuery extends SovPageRepositoryQuery
{
use MerchantRepositoryQueryTrait;
use SectionRepositoryQueryTrait;

}

+ 5
- 1
Repository/Site/PageStore.php View File

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

use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\SovBundle\Model\Site\PageInterface;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
@@ -10,6 +11,7 @@ use Lc\SovBundle\Repository\Site\PageStore as SovPageStore;

class PageStore extends SovPageStore
{
use MerchantStoreTrait;
use SectionStoreTrait;

public function __construct(PageRepositoryQuery $query)
@@ -19,7 +21,9 @@ class PageStore extends SovPageStore

public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
$query->filterBySection($this->section);
$this->addFilterByMerchantOptionnal($query);
$this->addFilterBySectionOptionnal($query);

return parent::filtersDefault($query);
}


+ 1
- 2
Repository/User/GroupUserStore.php View File

@@ -12,8 +12,7 @@ class GroupUserStore extends SovGroupUserStore

public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
$query->filterByMerchant($this->merchant);
$this->addFilterByMerchantOptionnal($query);
return parent::filtersDefault($query);
}

}

Loading…
Cancel
Save