Browse Source

Ajout section par defaut

feature/ticket
Fab 3 years ago
parent
commit
8df84035c7
2 changed files with 34 additions and 2 deletions
  1. +31
    -0
      migrations/Version20210603141914.php
  2. +3
    -2
      src/Controller/Section/SectionAdminController.php

+ 31
- 0
migrations/Version20210603141914.php View File

<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20210603141914 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE section ADD is_default TINYINT(1) DEFAULT NULL');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE section DROP is_default');
}
}

+ 3
- 2
src/Controller/Section/SectionAdminController.php View File

use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\CaracoleBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Field\BooleanField; use Lc\SovBundle\Field\BooleanField;
use Lc\SovBundle\Field\CKEditorField; use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\StatusField; use Lc\SovBundle\Field\StatusField;
[ [
FormField::addPanel('general'), FormField::addPanel('general'),
TextField::new('title'), TextField::new('title'),
AssociationField::new('merchant'),
//AssociationField::new('merchant'),
ChoiceField::new('cycle') ChoiceField::new('cycle')
->setRequired(true) ->setRequired(true)
->setChoices( ->setChoices(
CKEditorField::new('description') CKEditorField::new('description')
->hideOnIndex(), ->hideOnIndex(),
StatusField::new('status'), StatusField::new('status'),
BooleanField::new('isDefault', 'Section par défaut'),
], ],
$panel $panel
); );

Loading…
Cancel
Save