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

return $this; return $this;
} }


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

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



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


*/ */
abstract class PageModel extends SovPageModel implements FilterSectionInterface 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\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface", inversedBy="pages")
* @ORM\JoinColumn(nullable=false)
* @ORM\JoinColumn(nullable=true)
*/ */
protected $section; protected $section;


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

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

return $this;
}

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


return $this; return $this;
} }

} }

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



namespace Lc\CaracoleBundle\Repository\Site; namespace Lc\CaracoleBundle\Repository\Site;


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


class PageRepositoryQuery extends SovPageRepositoryQuery class PageRepositoryQuery extends SovPageRepositoryQuery
{ {
use MerchantRepositoryQueryTrait;
use SectionRepositoryQueryTrait; use SectionRepositoryQueryTrait;

} }

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

namespace Lc\CaracoleBundle\Repository\Site; namespace Lc\CaracoleBundle\Repository\Site;


use Lc\CaracoleBundle\Model\Section\SectionInterface; use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\CaracoleBundle\Repository\SectionStoreTrait; use Lc\CaracoleBundle\Repository\SectionStoreTrait;
use Lc\SovBundle\Model\Site\PageInterface; use Lc\SovBundle\Model\Site\PageInterface;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;


class PageStore extends SovPageStore class PageStore extends SovPageStore
{ {
use MerchantStoreTrait;
use SectionStoreTrait; use SectionStoreTrait;


public function __construct(PageRepositoryQuery $query) public function __construct(PageRepositoryQuery $query)


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

return parent::filtersDefault($query); return parent::filtersDefault($query);
} }



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



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

} }

Loading…
Cancel
Save