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