Browse Source

Section commune

packProduct
Guillaume 3 years ago
parent
commit
4b18a5fcc6
4 changed files with 29 additions and 3 deletions
  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 View File

] ]
), ),
TextField::new('color') TextField::new('color')
->setRequired(true)
->hideOnIndex(),
->setRequired(true),
NumberField::new('position') NumberField::new('position')
->hideOnForm() ->hideOnForm()
->hideOnIndex(), ->hideOnIndex(),
CKEditorField::new('description') CKEditorField::new('description')
->hideOnIndex(), ->hideOnIndex(),
BooleanField::new('isDefault', 'Section par défaut'),
BooleanField::new('isDefault'),
BooleanField::new('isCommon'),
StatusField::new('status'), StatusField::new('status'),
], ],
$this->getSeoPanel(), $this->getSeoPanel(),

+ 19
- 0
Model/Section/SectionModel.php View File

*/ */
abstract class SectionModel extends AbstractFullEntity implements FilterMerchantInterface abstract class SectionModel extends AbstractFullEntity implements FilterMerchantInterface
{ {
const DEVALIAS_COMMON = 'common';

/** /**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="sections") * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="sections")
* @ORM\JoinColumn(nullable=false) * @ORM\JoinColumn(nullable=false)
*/ */
protected $openings; protected $openings;


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

public function __construct() public function __construct()
{ {
$this->productFamilies = new ArrayCollection(); $this->productFamilies = new ArrayCollection();


return $this; 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 View File

fields: fields:
cycle: Cycle de vente cycle: Cycle de vente
isDefault: Section par défaut isDefault: Section par défaut
isCommon: Section commune
TaxRate: TaxRate:
label: Règle de taxe label: Règle de taxe
label_plurial: Règles de taxes label_plurial: Règles de taxes

+ 6
- 0
Solver/Section/SectionSolver.php View File

namespace Lc\CaracoleBundle\Solver\Section; namespace Lc\CaracoleBundle\Solver\Section;


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


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

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

Loading…
Cancel
Save