crud serie of festival
This commit is contained in:
parent
bb7f8680fc
commit
bee4a85673
@ -69,6 +69,22 @@
|
|||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="btn {% if app.request.attributes.get('_route') == 'seriefestival_index' %}
|
||||||
|
btn-success
|
||||||
|
{% else %}
|
||||||
|
btn-default
|
||||||
|
{% endif %}
|
||||||
|
" href='{{ path('seriefestival_index') }}'
|
||||||
|
>
|
||||||
|
<i class="fa fa-th-large"></i>
|
||||||
|
|
||||||
|
{% trans %}menu.series{% endtrans %}
|
||||||
|
<span class="badge">
|
||||||
|
{{ app.user.seriesFestivals|length }}
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="btn {% if app.request.attributes.get('_route') == 'history' %}
|
<a class="btn {% if app.request.attributes.get('_route') == 'history' %}
|
||||||
btn-success
|
btn-success
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{% verbatim %}
|
{% verbatim %}
|
||||||
<div id="not_loaded" ng-if="!initLoadDone">
|
<div id="not_loaded" ng-if="!initLoadDone">
|
||||||
<div class="well">
|
<div class="well text-center">
|
||||||
<i class="fa fa-refresh fa-spin fa-3x"></i> Chargement en cours de vos produits
|
<i class="fa fa-refresh fa-spin fa-3x"></i> Chargement en cours de vos produits
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
21
app/Resources/views/seriefestival/edit.html.twig
Normal file
21
app/Resources/views/seriefestival/edit.html.twig
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h1>Seriefestival edit</h1>
|
||||||
|
|
||||||
|
{{ form_start(edit_form) }}
|
||||||
|
{{ form_widget(edit_form) }}
|
||||||
|
<input type="submit" value="Edit" />
|
||||||
|
{{ form_end(edit_form) }}
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('seriefestival_index') }}">Back to the list</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
{{ form_start(delete_form) }}
|
||||||
|
<input type="submit" value="Delete">
|
||||||
|
{{ form_end(delete_form) }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{% endblock %}
|
55
app/Resources/views/seriefestival/index.html.twig
Normal file
55
app/Resources/views/seriefestival/index.html.twig
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<div class="row heading-of-list">
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<h1>Série de Festivals</h1>
|
||||||
|
<div class="well">
|
||||||
|
une série de festival vous permet d'obtenir des statistiques sur plusieurs évènements à la fois. et de comparer
|
||||||
|
des coûts et bénéfices d'une édition à une autre.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<a class="btn btn-primary" href="{{ path('seriefestival_new') }}">Nouvelle série</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Id</th>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Datecreation</th>
|
||||||
|
<th>Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for serieFestival in serieFestivals %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="{{ path('seriefestival_show', { 'id': serieFestival.id }) }}">{{ serieFestival.id }}</a>
|
||||||
|
</td>
|
||||||
|
<td>{{ serieFestival.name }}</td>
|
||||||
|
<td>{% if serieFestival.dateCreation %}{{ serieFestival.dateCreation|date('Y-m-d H:i:s') }}{% endif %}</td>
|
||||||
|
<td>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('seriefestival_show', { 'id': serieFestival.id }) }}">show</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('seriefestival_edit', { 'id': serieFestival.id }) }}">edit</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a class="btn btn-primary" href="{{ path('seriefestival_new') }}">Nouvelle série</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{% endblock %}
|
16
app/Resources/views/seriefestival/new.html.twig
Normal file
16
app/Resources/views/seriefestival/new.html.twig
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h1>Création de série de festival</h1>
|
||||||
|
|
||||||
|
{{ form_start(form) }}
|
||||||
|
{{ form_widget(form) }}
|
||||||
|
<input type="submit" value="Create"/>
|
||||||
|
{{ form_end(form) }}
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('seriefestival_index') }}">Retour à la liste</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{% endblock %}
|
36
app/Resources/views/seriefestival/show.html.twig
Normal file
36
app/Resources/views/seriefestival/show.html.twig
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h1>Seriefestival</h1>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th>Id</th>
|
||||||
|
<td>{{ serieFestival.id }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<td>{{ serieFestival.name }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Datecreation</th>
|
||||||
|
<td>{% if serieFestival.dateCreation %}{{ serieFestival.dateCreation|date('Y-m-d H:i:s') }}{% endif %}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('seriefestival_index') }}">Back to the list</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('seriefestival_edit', { 'id': serieFestival.id }) }}">Edit</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
{{ form_start(delete_form) }}
|
||||||
|
<input type="submit" value="Delete">
|
||||||
|
{{ form_end(delete_form) }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{% endblock %}
|
@ -1,3 +1,7 @@
|
|||||||
|
app_serie_festival:
|
||||||
|
resource: "@AppBundle/Controller/SerieFestivalController.php"
|
||||||
|
type: annotation
|
||||||
|
|
||||||
|
|
||||||
fos_user_profile:
|
fos_user_profile:
|
||||||
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
|
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
|
||||||
|
@ -91,3 +91,7 @@
|
|||||||
margin-left: 1em;
|
margin-left: 1em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#not_loaded{
|
||||||
|
width: 100%;
|
||||||
|
height: 75vh;
|
||||||
|
}
|
||||||
|
@ -64,9 +64,10 @@ body {
|
|||||||
height: 4em;
|
height: 4em;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
position: absolute;
|
position: static;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
thead {
|
thead {
|
||||||
|
140
src/AppBundle/Controller/SerieFestivalController.php
Normal file
140
src/AppBundle/Controller/SerieFestivalController.php
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace AppBundle\Controller;
|
||||||
|
|
||||||
|
use AppBundle\Entity\SerieFestival;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
|
||||||
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Seriefestival controller.
|
||||||
|
*
|
||||||
|
* @Route("seriefestival")
|
||||||
|
*/
|
||||||
|
class SerieFestivalController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Lists all serieFestival entities.
|
||||||
|
*
|
||||||
|
* @Route("/", name="seriefestival_index")
|
||||||
|
* @Method("GET")
|
||||||
|
*/
|
||||||
|
public function indexAction()
|
||||||
|
{
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
$serieFestivals = $em->getRepository('AppBundle:SerieFestival')->findAll();
|
||||||
|
|
||||||
|
return $this->render('seriefestival/index.html.twig', array(
|
||||||
|
'serieFestivals' => $serieFestivals,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new serieFestival entity.
|
||||||
|
*
|
||||||
|
* @Route("/new", name="seriefestival_new")
|
||||||
|
* @Method({"GET", "POST"})
|
||||||
|
*/
|
||||||
|
public function newAction(Request $request)
|
||||||
|
{
|
||||||
|
$usr= $this->getUser();
|
||||||
|
|
||||||
|
$serieFestival = new Seriefestival();
|
||||||
|
$serieFestival->setUser($usr);
|
||||||
|
|
||||||
|
$form = $this->createForm('AppBundle\Form\SerieFestivalType', $serieFestival);
|
||||||
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
$em->persist($serieFestival);
|
||||||
|
$em->flush();
|
||||||
|
|
||||||
|
return $this->redirectToRoute('seriefestival_show', array('id' => $serieFestival->getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('seriefestival/new.html.twig', array(
|
||||||
|
'serieFestival' => $serieFestival,
|
||||||
|
'form' => $form->createView(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds and displays a serieFestival entity.
|
||||||
|
*
|
||||||
|
* @Route("/{id}", name="seriefestival_show")
|
||||||
|
* @Method("GET")
|
||||||
|
*/
|
||||||
|
public function showAction(SerieFestival $serieFestival)
|
||||||
|
{
|
||||||
|
$deleteForm = $this->createDeleteForm($serieFestival);
|
||||||
|
|
||||||
|
return $this->render('seriefestival/show.html.twig', array(
|
||||||
|
'serieFestival' => $serieFestival,
|
||||||
|
'delete_form' => $deleteForm->createView(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a form to edit an existing serieFestival entity.
|
||||||
|
*
|
||||||
|
* @Route("/{id}/edit", name="seriefestival_edit")
|
||||||
|
* @Method({"GET", "POST"})
|
||||||
|
*/
|
||||||
|
public function editAction(Request $request, SerieFestival $serieFestival)
|
||||||
|
{
|
||||||
|
$deleteForm = $this->createDeleteForm($serieFestival);
|
||||||
|
$editForm = $this->createForm('AppBundle\Form\SerieFestivalType', $serieFestival);
|
||||||
|
$editForm->handleRequest($request);
|
||||||
|
|
||||||
|
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
||||||
|
$this->getDoctrine()->getManager()->flush();
|
||||||
|
|
||||||
|
return $this->redirectToRoute('seriefestival_edit', array('id' => $serieFestival->getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('seriefestival/edit.html.twig', array(
|
||||||
|
'serieFestival' => $serieFestival,
|
||||||
|
'edit_form' => $editForm->createView(),
|
||||||
|
'delete_form' => $deleteForm->createView(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a serieFestival entity.
|
||||||
|
*
|
||||||
|
* @Route("/{id}", name="seriefestival_delete")
|
||||||
|
* @Method("DELETE")
|
||||||
|
*/
|
||||||
|
public function deleteAction(Request $request, SerieFestival $serieFestival)
|
||||||
|
{
|
||||||
|
$form = $this->createDeleteForm($serieFestival);
|
||||||
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
$em->remove($serieFestival);
|
||||||
|
$em->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirectToRoute('seriefestival_index');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a form to delete a serieFestival entity.
|
||||||
|
*
|
||||||
|
* @param SerieFestival $serieFestival The serieFestival entity
|
||||||
|
*
|
||||||
|
* @return \Symfony\Component\Form\Form The form
|
||||||
|
*/
|
||||||
|
private function createDeleteForm(SerieFestival $serieFestival)
|
||||||
|
{
|
||||||
|
return $this->createFormBuilder()
|
||||||
|
->setAction($this->generateUrl('seriefestival_delete', array('id' => $serieFestival->getId())))
|
||||||
|
->setMethod('DELETE')
|
||||||
|
->getForm()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
@ -87,7 +87,11 @@ class Festival {
|
|||||||
private $fraisRepas;
|
private $fraisRepas;
|
||||||
|
|
||||||
|
|
||||||
/**
|
public function __toString() {
|
||||||
|
return $this->getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getSerieFestival()
|
public function getSerieFestival()
|
||||||
@ -130,7 +134,7 @@ class Festival {
|
|||||||
'fondDeCaisseApres' => $this->getFondDeCaisseApres(),
|
'fondDeCaisseApres' => $this->getFondDeCaisseApres(),
|
||||||
'sold' => $soldItems,
|
'sold' => $soldItems,
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
public function recalculateChiffreAffaire() {
|
public function recalculateChiffreAffaire() {
|
||||||
$sellings = $this->getSellRecords();
|
$sellings = $this->getSellRecords();
|
||||||
|
@ -12,7 +12,13 @@ class FestivalType extends AbstractType {
|
|||||||
*/
|
*/
|
||||||
public function buildForm( FormBuilderInterface $builder, array $options ) {
|
public function buildForm( FormBuilderInterface $builder, array $options ) {
|
||||||
$builder
|
$builder
|
||||||
->add( 'name' )
|
->add( 'name',
|
||||||
|
null,
|
||||||
|
[
|
||||||
|
'attr' => [
|
||||||
|
'autofocus' => true,
|
||||||
|
],
|
||||||
|
] )
|
||||||
->add( 'fraisInscription' )
|
->add( 'fraisInscription' )
|
||||||
->add( 'fraisTransport' )
|
->add( 'fraisTransport' )
|
||||||
->add( 'fraisHebergement' )
|
->add( 'fraisHebergement' )
|
||||||
|
@ -6,33 +6,36 @@ use Symfony\Component\Form\AbstractType;
|
|||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
class ProductCategoryType extends AbstractType
|
class ProductCategoryType extends AbstractType {
|
||||||
{
|
/**
|
||||||
/**
|
* {@inheritdoc}
|
||||||
* {@inheritdoc}
|
*/
|
||||||
*/
|
public function buildForm( FormBuilderInterface $builder, array $options ) {
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
$builder->add( 'name',
|
||||||
{
|
null,
|
||||||
$builder->add('name')
|
[
|
||||||
// ->add('users')
|
'attr' => [
|
||||||
;
|
'autofocus' => true,
|
||||||
}/**
|
],
|
||||||
* {@inheritdoc}
|
] )// ->add('users')
|
||||||
*/
|
;
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
}
|
||||||
{
|
|
||||||
$resolver->setDefaults(array(
|
|
||||||
'data_class' => 'AppBundle\Entity\ProductCategory'
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function getBlockPrefix()
|
public function configureOptions( OptionsResolver $resolver ) {
|
||||||
{
|
$resolver->setDefaults( [
|
||||||
return 'appbundle_productcategory';
|
'data_class' => 'AppBundle\Entity\ProductCategory',
|
||||||
}
|
] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getBlockPrefix() {
|
||||||
|
return 'appbundle_productcategory';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,13 +23,20 @@ class ProductType extends AbstractType {
|
|||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function buildForm( FormBuilderInterface $builder, array $options ) {
|
public function buildForm( FormBuilderInterface $builder, array $options ) {
|
||||||
$builder->add( 'name' , null, ['label'=>'Nom'])
|
$builder->add( 'name',
|
||||||
|
null,
|
||||||
|
[
|
||||||
|
'label' => 'Nom',
|
||||||
|
'attr' => [
|
||||||
|
'autofocus' => true,
|
||||||
|
],
|
||||||
|
] )
|
||||||
->add( 'image',
|
->add( 'image',
|
||||||
null,
|
null,
|
||||||
[ 'label' => 'URL pour image' ] )
|
[ 'label' => 'URL pour image' ] )
|
||||||
->add( 'stockCount', null, ['label'=>'En stock'] )
|
->add( 'stockCount', null, [ 'label' => 'En stock' ] )
|
||||||
->add( 'price', null, ['label'=>'Prix en euros'])
|
->add( 'price', null, [ 'label' => 'Prix en euros' ] )
|
||||||
->add( 'comment', null, ['label'=>'Commentaire']);
|
->add( 'comment', null, [ 'label' => 'Commentaire' ] );
|
||||||
$user = $this->security->getUser();
|
$user = $this->security->getUser();
|
||||||
if ( ! $user ) {
|
if ( ! $user ) {
|
||||||
throw new \LogicException(
|
throw new \LogicException(
|
||||||
@ -46,10 +53,10 @@ class ProductType extends AbstractType {
|
|||||||
$form->add( 'category',
|
$form->add( 'category',
|
||||||
EntityType::class,
|
EntityType::class,
|
||||||
[
|
[
|
||||||
'class' => 'AppBundle:ProductCategory',
|
'class' => 'AppBundle:ProductCategory',
|
||||||
'placeholder' => '--- catégories ---',
|
'placeholder' => '--- catégories ---',
|
||||||
'choices' => $categories,
|
'choices' => $categories,
|
||||||
'label' => 'Catégorie',
|
'label' => 'Catégorie',
|
||||||
] );
|
] );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
@ -22,7 +22,14 @@ class SellRecordType extends AbstractType {
|
|||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function buildForm( FormBuilderInterface $builder, array $options ) {
|
public function buildForm( FormBuilderInterface $builder, array $options ) {
|
||||||
$builder->add( 'products' );
|
$builder->add( 'products' )
|
||||||
|
->add('comment',
|
||||||
|
null,
|
||||||
|
[
|
||||||
|
'attr' => [
|
||||||
|
'autofocus' => true,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
51
src/AppBundle/Form/SerieFestivalType.php
Normal file
51
src/AppBundle/Form/SerieFestivalType.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace AppBundle\Form;
|
||||||
|
|
||||||
|
use AppBundle\Entity\Festival;
|
||||||
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
|
class SerieFestivalType extends AbstractType {
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function buildForm( FormBuilderInterface $builder, array $options ) {
|
||||||
|
$builder->add( 'name',
|
||||||
|
null,
|
||||||
|
[
|
||||||
|
'attr' => [
|
||||||
|
'autofocus' => true,
|
||||||
|
],
|
||||||
|
] )
|
||||||
|
->add( 'dateCreation',
|
||||||
|
DateType::class,
|
||||||
|
[
|
||||||
|
// renders it as a single text box
|
||||||
|
'widget' => 'single_text',
|
||||||
|
] )
|
||||||
|
->add( 'festivals', EntityType::class, [ 'class' => Festival::class, 'multiple' => true ] )
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function configureOptions( OptionsResolver $resolver ) {
|
||||||
|
$resolver->setDefaults( [
|
||||||
|
'data_class' => 'AppBundle\Entity\SerieFestival',
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getBlockPrefix() {
|
||||||
|
return 'appbundle_seriefestival';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace AppBundle\Tests\Controller;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
|
class SerieFestivalControllerTest extends WebTestCase
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
public function testCompleteScenario()
|
||||||
|
{
|
||||||
|
// Create a new client to browse the application
|
||||||
|
$client = static::createClient();
|
||||||
|
|
||||||
|
// Create a new entry in the database
|
||||||
|
$crawler = $client->request('GET', '/seriefestival/');
|
||||||
|
$this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /seriefestival/");
|
||||||
|
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
|
||||||
|
|
||||||
|
// Fill in the form and submit it
|
||||||
|
$form = $crawler->selectButton('Create')->form(array(
|
||||||
|
'appbundle_seriefestival[field_name]' => 'Test',
|
||||||
|
// ... other fields to fill
|
||||||
|
));
|
||||||
|
|
||||||
|
$client->submit($form);
|
||||||
|
$crawler = $client->followRedirect();
|
||||||
|
|
||||||
|
// Check data in the show view
|
||||||
|
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
|
||||||
|
|
||||||
|
// Edit the entity
|
||||||
|
$crawler = $client->click($crawler->selectLink('Edit')->link());
|
||||||
|
|
||||||
|
$form = $crawler->selectButton('Update')->form(array(
|
||||||
|
'appbundle_seriefestival[field_name]' => 'Foo',
|
||||||
|
// ... other fields to fill
|
||||||
|
));
|
||||||
|
|
||||||
|
$client->submit($form);
|
||||||
|
$crawler = $client->followRedirect();
|
||||||
|
|
||||||
|
// Check the element contains an attribute with value equals "Foo"
|
||||||
|
$this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
|
||||||
|
|
||||||
|
// Delete the entity
|
||||||
|
$client->submit($crawler->selectButton('Delete')->form());
|
||||||
|
$crawler = $client->followRedirect();
|
||||||
|
|
||||||
|
// Check the entity has been delete on the list
|
||||||
|
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
}
|
@ -8,6 +8,7 @@ menu:
|
|||||||
history: History
|
history: History
|
||||||
import: Import
|
import: Import
|
||||||
festivals: Festivals
|
festivals: Festivals
|
||||||
|
series: Séries
|
||||||
products: Products
|
products: Products
|
||||||
categories: Categories
|
categories: Categories
|
||||||
future: Forecast
|
future: Forecast
|
||||||
|
@ -7,6 +7,7 @@ menu:
|
|||||||
history: Historique
|
history: Historique
|
||||||
import: Importer
|
import: Importer
|
||||||
festivals: Festivals
|
festivals: Festivals
|
||||||
|
series: Séries
|
||||||
products: Produits
|
products: Produits
|
||||||
categories: Catégories
|
categories: Catégories
|
||||||
future: Prévisionnel
|
future: Prévisionnel
|
||||||
|
Loading…
Reference in New Issue
Block a user