Commit 705bb256 by Julien Jorry

Fix doc faq rubrique news BO + add rubriques fixtures

parent 37c4180b
...@@ -84,6 +84,7 @@ App\Entity\Adherent: ...@@ -84,6 +84,7 @@ App\Entity\Adherent:
ecompte: '<randomFloat(2, 0, 50)>' ecompte: '<randomFloat(2, 0, 50)>'
# user (unique): '@user<numberBetween(1,10)>' # user (unique): '@user<numberBetween(1,10)>'
App\Entity\Prestataire: App\Entity\Prestataire:
prestataire{1..21}: prestataire{1..21}:
raison: '<text(10)>' raison: '<text(10)>'
...@@ -111,6 +112,13 @@ App\Entity\Prestataire: ...@@ -111,6 +112,13 @@ App\Entity\Prestataire:
prestataireGroup: '@groupe<numberBetween(1, 4)>' prestataireGroup: '@groupe<numberBetween(1, 4)>'
horaires: "<dayOfWeek()> de <time('H')>h à <time('H')>h" horaires: "<dayOfWeek()> de <time('H')>h à <time('H')>h"
App\Entity\Rubrique:
rubrique{1..20}:
name: <text(10)>
content: <text(50)>
enabled: true
prestataires: '<numberBetween(1, 8)>x @prestataire<numberBetween(1, 32)>'
App\Entity\User: App\Entity\User:
usersuperadmin: usersuperadmin:
username: 'adminuser' username: 'adminuser'
......
...@@ -2,17 +2,19 @@ ...@@ -2,17 +2,19 @@
namespace App\Admin; namespace App\Admin;
use App\Entity\User;
use FOS\CKEditorBundle\Form\Type\CKEditorType; use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Sonata\AdminBundle\Admin\AbstractAdmin; use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Show\ShowMapper; use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\MediaBundle\Form\Type\MediaType; use Sonata\MediaBundle\Form\Type\MediaType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
class DocumentAdmin extends AbstractAdmin class DocumentAdmin extends AbstractAdmin
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -20,14 +22,29 @@ class DocumentAdmin extends AbstractAdmin ...@@ -20,14 +22,29 @@ class DocumentAdmin extends AbstractAdmin
{ {
$document = $this->getSubject(); $document = $this->getSubject();
$formMapper $formMapper
->add('user', HiddenType::class, array(
'data' => $this->getConfigurationPool()->getContainer()->get('security.token_storage')->getToken()->getUser()->getId(),
'data_class' => null,
'entity_class' => User::class,
'em' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager()
))
->add('media', MediaType::class, array(
'provider' => 'sonata.media.provider.file',
'context' => 'document',
'label' => 'Document'
))
->add('name', TextType::class, array( ->add('name', TextType::class, array(
'label' => 'Titre :' 'label' => 'Titre :'
)) ))
->add('text', CKEditorType::class, array( ->add('content', CKEditorType::class, array(
'label' => 'Texte', 'label' => 'Texte',
'required' => false, 'required' => false,
)) ))
->add('media', MediaType::class, array('provider' => 'sonata.media.provider.image', 'context' => 'document')) ->add('enabled', CheckboxType::class, array(
'label' => 'Activé ?',
'required' => false,
'label_attr' => array('class' => 'checkbox-inline')
))
; ;
} }
...@@ -39,8 +56,9 @@ class DocumentAdmin extends AbstractAdmin ...@@ -39,8 +56,9 @@ class DocumentAdmin extends AbstractAdmin
unset($this->listModes['mosaic']); unset($this->listModes['mosaic']);
$listMapper $listMapper
->addIdentifier('name', null, array('label' => 'Titre')) ->addIdentifier('name', null, array('label' => 'Titre'))
->addIdentifier('text', 'html', array('label' => 'Text')) ->addIdentifier('content', 'html', array('truncate' => array('length' => 80), 'label' => 'Description'))
->addIdentifier('media', null, array('label' => 'Fichier')) ->addIdentifier('media', null, array('label' => 'Fichier'))
->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.Document', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'))
; ;
} }
} }
...@@ -9,6 +9,8 @@ use Sonata\AdminBundle\Datagrid\ListMapper; ...@@ -9,6 +9,8 @@ use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Show\ShowMapper; use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\MediaBundle\Form\Type\MediaType; use Sonata\MediaBundle\Form\Type\MediaType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
class FaqAdmin extends AbstractAdmin class FaqAdmin extends AbstractAdmin
...@@ -32,10 +34,23 @@ class FaqAdmin extends AbstractAdmin ...@@ -32,10 +34,23 @@ class FaqAdmin extends AbstractAdmin
)) ))
->add('text', CKEditorType::class, array( ->add('text', CKEditorType::class, array(
'label' => 'Texte', 'label' => 'Texte',
'required' => false, 'required' => false
))
->add('fichier', MediaType::class, array(
'provider' => 'sonata.media.provider.file',
'context' => 'faq',
'required' => false
))
->add('image', MediaType::class, array(
'provider' => 'sonata.media.provider.image',
'context' => 'faq',
'required' => false
))
->add('enabled', CheckboxType::class, array(
'label' => 'Activé ?',
'label_attr' => array('class' => 'checkbox-inline'),
'required' => false
)) ))
->add('fichier', MediaType::class, array('provider' => 'sonata.media.provider.file', 'context' => 'faq'))
->add('image', MediaType::class, array('provider' => 'sonata.media.provider.image', 'context' => 'faq'))
; ;
} }
...@@ -50,6 +65,8 @@ class FaqAdmin extends AbstractAdmin ...@@ -50,6 +65,8 @@ class FaqAdmin extends AbstractAdmin
->addIdentifier('text', 'html', array('label' => 'Text')) ->addIdentifier('text', 'html', array('label' => 'Text'))
->addIdentifier('fichier', null, array('label' => 'Fichier')) ->addIdentifier('fichier', null, array('label' => 'Fichier'))
->addIdentifier('image', null, array('label' => 'Image')) ->addIdentifier('image', null, array('label' => 'Image'))
->addIdentifier('user', null, array('label' => 'Utilisateur'))
->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.Document', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'))
; ;
} }
} }
...@@ -38,7 +38,7 @@ class GroupeAdmin extends AbstractAdmin ...@@ -38,7 +38,7 @@ class GroupeAdmin extends AbstractAdmin
{ {
$groupe = $this->getSubject(); $groupe = $this->getSubject();
$formMapper $formMapper
->with("Creation d'un groupe") ->with("Création d'un groupe")
->add('siege', HiddenType::class, array( ->add('siege', HiddenType::class, array(
'data' => 1, 'data' => 1,
'data_class' => null, 'data_class' => null,
......
...@@ -39,6 +39,10 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -39,6 +39,10 @@ class GroupeprestataireAdmin extends AbstractAdmin
'label' => 'Nom du groupe :', 'label' => 'Nom du groupe :',
'required' => true 'required' => true
)) ))
->add('content', CKEditorType::class, array(
'label' => 'Texte',
'required' => false,
))
->add('horaires', TextareaType::class, array( ->add('horaires', TextareaType::class, array(
'label' => 'Horaires :', 'label' => 'Horaires :',
'required' => false 'required' => false
......
...@@ -5,6 +5,7 @@ namespace App\Admin; ...@@ -5,6 +5,7 @@ namespace App\Admin;
use App\Entity\Comptoir; use App\Entity\Comptoir;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\Siege; use App\Entity\Siege;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Sonata\AdminBundle\Admin\AbstractAdmin; use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Form\FormMapper;
...@@ -37,11 +38,15 @@ class RubriqueAdmin extends AbstractAdmin ...@@ -37,11 +38,15 @@ class RubriqueAdmin extends AbstractAdmin
{ {
$groupe = $this->getSubject(); $groupe = $this->getSubject();
$formMapper $formMapper
->with("Creation d'une rubrique") ->with("Création d'une rubrique")
->add('name', TextType::class, array( ->add('name', TextType::class, array(
'label' => 'Nom :', 'label' => 'Nom :',
'required' => true 'required' => true
)) ))
->add('content', CKEditorType::class, array(
'label' => 'Description :',
'required' => false,
))
->add('prestataires', CollectionType::class, array( ->add('prestataires', CollectionType::class, array(
'label' => 'Prestataires', 'label' => 'Prestataires',
'entry_type' => EntityType::class, 'entry_type' => EntityType::class,
...@@ -78,6 +83,7 @@ class RubriqueAdmin extends AbstractAdmin ...@@ -78,6 +83,7 @@ class RubriqueAdmin extends AbstractAdmin
unset($this->listModes['mosaic']); unset($this->listModes['mosaic']);
$listMapper $listMapper
->addIdentifier('name', null, array('label' => 'Nom du groupe')) ->addIdentifier('name', null, array('label' => 'Nom du groupe'))
->addIdentifier('content', 'html', array('truncate' => array('length' => 80), 'label' => 'Description'))
->add( ->add(
'getPrestatairesCount', 'getPrestatairesCount',
null, null,
......
...@@ -39,7 +39,6 @@ class Comptoir ...@@ -39,7 +39,6 @@ class Comptoir
/** /**
* @var \Application\Sonata\MediaBundle\Entity\Media * @var \Application\Sonata\MediaBundle\Entity\Media
* @Assert\NotBlank()
* @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY") * @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY")
* @ORM\JoinColumn(name="media_id", referencedColumnName="id") * @ORM\JoinColumn(name="media_id", referencedColumnName="id")
*/ */
......
...@@ -45,11 +45,6 @@ class Document ...@@ -45,11 +45,6 @@ class Document
private $user; private $user;
/** /**
* @ORM\Column(type="text", nullable=true)
*/
private $text;
/**
* @return int * @return int
*/ */
public function getId(): int public function getId(): int
...@@ -94,18 +89,6 @@ class Document ...@@ -94,18 +89,6 @@ class Document
return $this; return $this;
} }
public function getText(): ?string
{
return $this->text;
}
public function setText(?string $text): self
{
$this->text = $text;
return $this;
}
public function __toString(): string public function __toString(): string
{ {
return $this->getTitle()?$this->getTitle():'Document'; return $this->getTitle()?$this->getTitle():'Document';
......
...@@ -35,17 +35,15 @@ class Faq ...@@ -35,17 +35,15 @@ class Faq
/** /**
* @var \Application\Sonata\MediaBundle\Entity\Media * @var \Application\Sonata\MediaBundle\Entity\Media
* @Assert\NotBlank()
* @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY") * @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY")
* @ORM\JoinColumn(name="media_id", referencedColumnName="id") * @ORM\JoinColumn(name="media_id", referencedColumnName="id", nullable=true)
*/ */
protected $fichier; protected $fichier;
/** /**
* @var \Application\Sonata\MediaBundle\Entity\Media * @var \Application\Sonata\MediaBundle\Entity\Media
* @Assert\NotBlank()
* @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY") * @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY")
* @ORM\JoinColumn(name="media_id", referencedColumnName="id") * @ORM\JoinColumn(name="media_id", referencedColumnName="id", nullable=true)
*/ */
protected $image; protected $image;
......
...@@ -33,7 +33,6 @@ class News ...@@ -33,7 +33,6 @@ class News
/** /**
* @var \Application\Sonata\MediaBundle\Entity\Media * @var \Application\Sonata\MediaBundle\Entity\Media
* @Assert\NotBlank()
* @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY") * @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY")
* @ORM\JoinColumn(name="media_id", referencedColumnName="id") * @ORM\JoinColumn(name="media_id", referencedColumnName="id")
*/ */
......
...@@ -153,6 +153,7 @@ class Prestataire ...@@ -153,6 +153,7 @@ class Prestataire
{ {
$this->users = new ArrayCollection(); $this->users = new ArrayCollection();
$this->groupeprestataires = new ArrayCollection(); $this->groupeprestataires = new ArrayCollection();
$this->rubriques = new ArrayCollection();
} }
/** /**
......
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
namespace App\Entity; namespace App\Entity;
use App\Entity\Adherent; use App\Entity\Adherent;
use App\Entity\Document;
use App\Entity\EmailToken; use App\Entity\EmailToken;
use App\Entity\Faq;
use App\Entity\Flux; use App\Entity\Flux;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
...@@ -59,11 +61,25 @@ class User extends BaseUser ...@@ -59,11 +61,25 @@ class User extends BaseUser
/** /**
* @var ArrayCollection|Cotisation[] * @var ArrayCollection|Cotisation[]
* *
* @ORM\OneToMany(targetEntity="Cotisation", mappedBy="user", cascade={"persist"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="Cotisation", mappedBy="user", cascade={"persist"})
*/ */
private $cotisations; private $cotisations;
/** /**
* @var ArrayCollection|Document[]
*
* @ORM\OneToMany(targetEntity="Document", mappedBy="user", cascade={"persist"})
*/
private $documents;
/**
* @var ArrayCollection|Faq[]
*
* @ORM\OneToMany(targetEntity="Faq", mappedBy="user", cascade={"persist"})
*/
private $faqs;
/**
* @ORM\OneToMany(targetEntity="Flux", mappedBy="operateur") * @ORM\OneToMany(targetEntity="Flux", mappedBy="operateur")
*/ */
protected $flux; protected $flux;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment