Ver código fonte

Section commune

packProduct
Guillaume 3 anos atrás
pai
commit
4b18a5fcc6
4 arquivos alterados com 29 adições e 3 exclusões
  1. +3
    -3
      Controller/Section/SectionAdminController.php
  2. +19
    -0
      Model/Section/SectionModel.php
  3. +1
    -0
      Resources/translations/admin.fr.yaml
  4. +6
    -0
      Solver/Section/SectionSolver.php

+ 3
- 3
Controller/Section/SectionAdminController.php Ver arquivo

@@ -42,14 +42,14 @@ abstract class SectionAdminController extends AbstractAdminController
]
),
TextField::new('color')
->setRequired(true)
->hideOnIndex(),
->setRequired(true),
NumberField::new('position')
->hideOnForm()
->hideOnIndex(),
CKEditorField::new('description')
->hideOnIndex(),
BooleanField::new('isDefault', 'Section par défaut'),
BooleanField::new('isDefault'),
BooleanField::new('isCommon'),
StatusField::new('status'),
],
$this->getSeoPanel(),

+ 19
- 0
Model/Section/SectionModel.php Ver arquivo

@@ -21,6 +21,8 @@ use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;
*/
abstract class SectionModel extends AbstractFullEntity implements FilterMerchantInterface
{
const DEVALIAS_COMMON = 'common';

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="sections")
* @ORM\JoinColumn(nullable=false)
@@ -87,6 +89,11 @@ abstract class SectionModel extends AbstractFullEntity implements FilterMerchant
*/
protected $openings;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $isCommon;

public function __construct()
{
$this->productFamilies = new ArrayCollection();
@@ -394,4 +401,16 @@ abstract class SectionModel extends AbstractFullEntity implements FilterMerchant

return $this;
}

public function getIsCommon(): ?bool
{
return $this->isCommon;
}

public function setIsCommon(?bool $isCommon): self
{
$this->isCommon = $isCommon;

return $this;
}
}

+ 1
- 0
Resources/translations/admin.fr.yaml Ver arquivo

@@ -93,6 +93,7 @@ entity:
fields:
cycle: Cycle de vente
isDefault: Section par défaut
isCommon: Section commune
TaxRate:
label: Règle de taxe
label_plurial: Règles de taxes

+ 6
- 0
Solver/Section/SectionSolver.php Ver arquivo

@@ -3,9 +3,15 @@
namespace Lc\CaracoleBundle\Solver\Section;

use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Model\Section\SectionModel;

class SectionSolver
{
public function isSectionCommon(SectionInterface $section)
{
return $section->getDevAlias() == SectionModel::DEVALIAS_COMMON;
}

// @TODO : à voir si pertinent
public function getNewsletter(SectionInterface $section)
{

Carregando…
Cancelar
Salvar