set current user by default
This commit is contained in:
parent
0d7b46f5f1
commit
80b334cf85
|
@ -30,6 +30,13 @@
|
|||
Produits
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-default" href="{{ path('festival_index') }}"
|
||||
data-toggle="tab">
|
||||
<i class="fa fa-hat"></i>
|
||||
Festivals
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form) }}
|
||||
<input type="submit" value="Create" />
|
||||
<input class="btn btn-primary btn-block" type="submit" value="Créer" />
|
||||
{{ form_end(form) }}
|
||||
|
||||
<ul>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</h2>
|
||||
<button ng-repeat="p in c.products track by p.id"
|
||||
class="btn btn-default"
|
||||
ng-class="{ 'btn-primary' : activeItemsSold.indexOf(p.id)}"
|
||||
ng-class="{ 'btn-primary' : activeItemsSold.indexOf(p.id) !==-1}"
|
||||
ng-click="addProduct( p )">
|
||||
<span class="product-name">
|
||||
{{ p.name }}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form) }}
|
||||
<input type="submit" value="Create"/>
|
||||
<input type="submit" class="btn btn-primary btn-block" value="Créer"/>
|
||||
{{ form_end(form) }}
|
||||
|
||||
<ul>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form) }}
|
||||
<input type="submit" value="Create" />
|
||||
<input type="submit" class="btn btn-primary btn-block" value="Créer" />
|
||||
{{ form_end(form) }}
|
||||
|
||||
<ul>
|
||||
|
|
|
@ -4,13 +4,16 @@
|
|||
<h1>Sellrecord creation</h1>
|
||||
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form) }}
|
||||
<input type="submit" value="Create" />
|
||||
{{ form_widget(form) }}
|
||||
<input type="submit" class="btn btn-primary btn-block" value="Créer"/>
|
||||
{{ form_end(form) }}
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<a class="btn btn-primary" href="{{ path('sellrecord_index') }}"> <i class="fa fa-arrow-left"></i>Retour à la liste</a>
|
||||
<a class="btn btn-primary" href="{{ path('sellrecord_index') }}">
|
||||
<i class="fa fa-arrow-left"></i>
|
||||
Retour à la liste
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
|
|
@ -22,3 +22,8 @@ thead {
|
|||
ul {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
label {
|
||||
min-width: 20em;
|
||||
display: inline-block;
|
||||
}
|
||||
|
|
|
@ -3,134 +3,133 @@
|
|||
namespace AppBundle\Controller;
|
||||
|
||||
use AppBundle\Entity\Festival;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use Symfony\Component\HttpFoundation\Request;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Festival controller.
|
||||
*
|
||||
* @Route("festival")
|
||||
*/
|
||||
class FestivalController extends Controller
|
||||
{
|
||||
/**
|
||||
* Lists all festival entities.
|
||||
*
|
||||
* @Route("/", name="festival_index")
|
||||
* @Method("GET")
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
class FestivalController extends Controller {
|
||||
/**
|
||||
* Lists all festival entities.
|
||||
*
|
||||
* @Route("/", name="festival_index")
|
||||
* @Method("GET")
|
||||
*/
|
||||
public function indexAction() {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$festivals = $em->getRepository('AppBundle:Festival')->findAll();
|
||||
$festivals = $em->getRepository( 'AppBundle:Festival' )->findByUser($this->getUser() );
|
||||
|
||||
return $this->render('festival/index.html.twig', array(
|
||||
'festivals' => $festivals,
|
||||
));
|
||||
}
|
||||
return $this->render( 'festival/index.html.twig',
|
||||
[
|
||||
'festivals' => $festivals,
|
||||
] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new festival entity.
|
||||
*
|
||||
* @Route("/new", name="festival_new")
|
||||
* @Method({"GET", "POST"})
|
||||
*/
|
||||
public function newAction(Request $request)
|
||||
{
|
||||
$festival = new Festival();
|
||||
$form = $this->createForm('AppBundle\Form\FestivalType', $festival);
|
||||
$form->handleRequest($request);
|
||||
/**
|
||||
* Creates a new festival entity.
|
||||
*
|
||||
* @Route("/new", name="festival_new")
|
||||
* @Method({"GET", "POST"})
|
||||
*/
|
||||
public function newAction( Request $request ) {
|
||||
$festival = new Festival();
|
||||
$festival->setUser( $this->getUser() );
|
||||
$festival->setDateCreation(new \DateTime());
|
||||
$form = $this->createForm( 'AppBundle\Form\FestivalType', $festival );
|
||||
$form->handleRequest( $request );
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($festival);
|
||||
$em->flush();
|
||||
if ( $form->isSubmitted() && $form->isValid() ) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist( $festival );
|
||||
$em->flush();
|
||||
|
||||
return $this->redirectToRoute('festival_show', array('id' => $festival->getId()));
|
||||
}
|
||||
return $this->redirectToRoute( 'festival_show', [ 'id' => $festival->getId() ] );
|
||||
}
|
||||
|
||||
return $this->render('festival/new.html.twig', array(
|
||||
'festival' => $festival,
|
||||
'form' => $form->createView(),
|
||||
));
|
||||
}
|
||||
return $this->render( 'festival/new.html.twig',
|
||||
[
|
||||
'festival' => $festival,
|
||||
'form' => $form->createView(),
|
||||
] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds and displays a festival entity.
|
||||
*
|
||||
* @Route("/{id}", name="festival_show")
|
||||
* @Method("GET")
|
||||
*/
|
||||
public function showAction(Festival $festival)
|
||||
{
|
||||
$deleteForm = $this->createDeleteForm($festival);
|
||||
/**
|
||||
* Finds and displays a festival entity.
|
||||
*
|
||||
* @Route("/{id}", name="festival_show")
|
||||
* @Method("GET")
|
||||
*/
|
||||
public function showAction( Festival $festival ) {
|
||||
$deleteForm = $this->createDeleteForm( $festival );
|
||||
|
||||
return $this->render('festival/show.html.twig', array(
|
||||
'festival' => $festival,
|
||||
'delete_form' => $deleteForm->createView(),
|
||||
));
|
||||
}
|
||||
return $this->render( 'festival/show.html.twig',
|
||||
[
|
||||
'festival' => $festival,
|
||||
'delete_form' => $deleteForm->createView(),
|
||||
] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a form to edit an existing festival entity.
|
||||
*
|
||||
* @Route("/{id}/edit", name="festival_edit")
|
||||
* @Method({"GET", "POST"})
|
||||
*/
|
||||
public function editAction(Request $request, Festival $festival)
|
||||
{
|
||||
$deleteForm = $this->createDeleteForm($festival);
|
||||
$editForm = $this->createForm('AppBundle\Form\FestivalType', $festival);
|
||||
$editForm->handleRequest($request);
|
||||
/**
|
||||
* Displays a form to edit an existing festival entity.
|
||||
*
|
||||
* @Route("/{id}/edit", name="festival_edit")
|
||||
* @Method({"GET", "POST"})
|
||||
*/
|
||||
public function editAction( Request $request, Festival $festival ) {
|
||||
$deleteForm = $this->createDeleteForm( $festival );
|
||||
$editForm = $this->createForm( 'AppBundle\Form\FestivalType', $festival );
|
||||
$editForm->handleRequest( $request );
|
||||
|
||||
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
||||
$this->getDoctrine()->getManager()->flush();
|
||||
if ( $editForm->isSubmitted() && $editForm->isValid() ) {
|
||||
$this->getDoctrine()->getManager()->flush();
|
||||
|
||||
return $this->redirectToRoute('festival_edit', array('id' => $festival->getId()));
|
||||
}
|
||||
return $this->redirectToRoute( 'festival_edit', [ 'id' => $festival->getId() ] );
|
||||
}
|
||||
|
||||
return $this->render('festival/edit.html.twig', array(
|
||||
'festival' => $festival,
|
||||
'edit_form' => $editForm->createView(),
|
||||
'delete_form' => $deleteForm->createView(),
|
||||
));
|
||||
}
|
||||
return $this->render( 'festival/edit.html.twig',
|
||||
[
|
||||
'festival' => $festival,
|
||||
'edit_form' => $editForm->createView(),
|
||||
'delete_form' => $deleteForm->createView(),
|
||||
] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a festival entity.
|
||||
*
|
||||
* @Route("/{id}", name="festival_delete")
|
||||
* @Method("DELETE")
|
||||
*/
|
||||
public function deleteAction(Request $request, Festival $festival)
|
||||
{
|
||||
$form = $this->createDeleteForm($festival);
|
||||
$form->handleRequest($request);
|
||||
/**
|
||||
* Deletes a festival entity.
|
||||
*
|
||||
* @Route("/{id}", name="festival_delete")
|
||||
* @Method("DELETE")
|
||||
*/
|
||||
public function deleteAction( Request $request, Festival $festival ) {
|
||||
$form = $this->createDeleteForm( $festival );
|
||||
$form->handleRequest( $request );
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->remove($festival);
|
||||
$em->flush();
|
||||
}
|
||||
if ( $form->isSubmitted() && $form->isValid() ) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->remove( $festival );
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('festival_index');
|
||||
}
|
||||
return $this->redirectToRoute( 'festival_index' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a form to delete a festival entity.
|
||||
*
|
||||
* @param Festival $festival The festival entity
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form The form
|
||||
*/
|
||||
private function createDeleteForm(Festival $festival)
|
||||
{
|
||||
return $this->createFormBuilder()
|
||||
->setAction($this->generateUrl('festival_delete', array('id' => $festival->getId())))
|
||||
->setMethod('DELETE')
|
||||
->getForm()
|
||||
;
|
||||
}
|
||||
/**
|
||||
* Creates a form to delete a festival entity.
|
||||
*
|
||||
* @param Festival $festival The festival entity
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form The form
|
||||
*/
|
||||
private function createDeleteForm( Festival $festival ) {
|
||||
return $this->createFormBuilder()
|
||||
->setAction( $this->generateUrl( 'festival_delete', [ 'id' => $festival->getId() ] ) )
|
||||
->setMethod( 'DELETE' )
|
||||
->getForm();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ class ProductCategoryController extends Controller {
|
|||
*/
|
||||
public function newAction( Request $request ) {
|
||||
$productCategory = new Productcategory();
|
||||
$productCategory->setUsers($this->getUser());
|
||||
$form = $this->createForm( 'AppBundle\Form\ProductCategoryType', $productCategory );
|
||||
$form->handleRequest( $request );
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class ProductController extends Controller
|
|||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$products = $em->getRepository('AppBundle:Product')->findAll();
|
||||
$products = $em->getRepository('AppBundle:Product')->findByUser($this->getUser() );
|
||||
|
||||
return $this->render('product/index.html.twig', array(
|
||||
'products' => $products,
|
||||
|
@ -40,6 +40,7 @@ class ProductController extends Controller
|
|||
public function newAction(Request $request)
|
||||
{
|
||||
$product = new Product();
|
||||
$product->setUser($this->getUser());
|
||||
$form = $this->createForm('AppBundle\Form\ProductType', $product);
|
||||
$form->handleRequest($request);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class SellRecordController extends Controller
|
|||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$sellRecords = $em->getRepository('AppBundle:SellRecord')->findAll();
|
||||
$sellRecords = $em->getRepository('AppBundle:SellRecord')->findByUser($this->getUser() );
|
||||
|
||||
return $this->render('sellrecord/index.html.twig', array(
|
||||
'sellRecords' => $sellRecords,
|
||||
|
@ -40,6 +40,7 @@ class SellRecordController extends Controller
|
|||
public function newAction(Request $request)
|
||||
{
|
||||
$sellRecord = new Sellrecord();
|
||||
$sellRecord->setUser($this->getUser());
|
||||
$form = $this->createForm('AppBundle\Form\SellRecordType', $sellRecord);
|
||||
$form->handleRequest($request);
|
||||
|
||||
|
|
|
@ -41,6 +41,10 @@ class Festival {
|
|||
*/
|
||||
private $sellRecords;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="festivals")
|
||||
*/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
|
@ -116,35 +120,55 @@ class Festival {
|
|||
public function getSellRecords() {
|
||||
return $this->sellRecords;
|
||||
}
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->sellRecords = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*
|
||||
* @return Festival
|
||||
*/
|
||||
public function addSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
|
||||
{
|
||||
$this->sellRecords[] = $sellRecord;
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->sellRecords = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Add sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*
|
||||
* @return Festival
|
||||
*/
|
||||
public function addSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
|
||||
$this->sellRecords[] = $sellRecord;
|
||||
|
||||
/**
|
||||
* Remove sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*/
|
||||
public function removeSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
|
||||
{
|
||||
$this->sellRecords->removeElement($sellRecord);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*/
|
||||
public function removeSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
|
||||
$this->sellRecords->removeElement( $sellRecord );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set user.
|
||||
*
|
||||
* @param \AppBundle\Entity\User|null $user
|
||||
*
|
||||
* @return Festival
|
||||
*/
|
||||
public function setUser( \AppBundle\Entity\User $user = null ) {
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user.
|
||||
*
|
||||
* @return \AppBundle\Entity\User|null
|
||||
*/
|
||||
public function getUser() {
|
||||
return $this->user;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,10 @@ class Festival {
|
|||
*/
|
||||
private $sellRecords;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="festivals")
|
||||
*/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
|
@ -116,35 +120,33 @@ class Festival {
|
|||
public function getSellRecords() {
|
||||
return $this->sellRecords;
|
||||
}
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->sellRecords = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*
|
||||
* @return Festival
|
||||
*/
|
||||
public function addSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
|
||||
{
|
||||
$this->sellRecords[] = $sellRecord;
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->sellRecords = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* Add sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*
|
||||
* @return Festival
|
||||
*/
|
||||
public function addSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
|
||||
$this->sellRecords[] = $sellRecord;
|
||||
|
||||
/**
|
||||
* Remove sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*/
|
||||
public function removeSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
|
||||
{
|
||||
$this->sellRecords->removeElement($sellRecord);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*/
|
||||
public function removeSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
|
||||
$this->sellRecords->removeElement( $sellRecord );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,27 +119,25 @@ class ProductCategory {
|
|||
$this->products->removeElement( $product );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add user
|
||||
*
|
||||
* @param \AppBundle\Entity\User $user
|
||||
*
|
||||
* @return ProductCategory
|
||||
*/
|
||||
public function addUser(\AppBundle\Entity\User $user)
|
||||
{
|
||||
$this->users[] = $user;
|
||||
/**
|
||||
* Add user
|
||||
*
|
||||
* @param \AppBundle\Entity\User $user
|
||||
*
|
||||
* @return ProductCategory
|
||||
*/
|
||||
public function addUser( \AppBundle\Entity\User $user ) {
|
||||
$this->users[] = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove user
|
||||
*
|
||||
* @param \AppBundle\Entity\User $user
|
||||
*/
|
||||
public function removeUser(\AppBundle\Entity\User $user)
|
||||
{
|
||||
$this->users->removeElement($user);
|
||||
}
|
||||
/**
|
||||
* Remove user
|
||||
*
|
||||
* @param \AppBundle\Entity\User $user
|
||||
*/
|
||||
public function removeUser( \AppBundle\Entity\User $user ) {
|
||||
$this->users->removeElement( $user );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,14 +22,13 @@ class ProductSold {
|
|||
*/
|
||||
private $name;
|
||||
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=256)
|
||||
*/
|
||||
private $image;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="products")
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="productsSold")
|
||||
*/
|
||||
private $user;
|
||||
|
||||
|
@ -92,4 +91,79 @@ class ProductSold {
|
|||
public function getProduct() {
|
||||
return $this->product;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return ProductSold
|
||||
*/
|
||||
public function setName( $name ) {
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set image.
|
||||
*
|
||||
* @param string $image
|
||||
*
|
||||
* @return ProductSold
|
||||
*/
|
||||
public function setImage( $image ) {
|
||||
$this->image = $image;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getImage() {
|
||||
return $this->image;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set user.
|
||||
*
|
||||
* @param \AppBundle\Entity\User|null $user
|
||||
*
|
||||
* @return ProductSold
|
||||
*/
|
||||
public function setUser( \AppBundle\Entity\User $user = null ) {
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user.
|
||||
*
|
||||
* @return \AppBundle\Entity\User|null
|
||||
*/
|
||||
public function getUser() {
|
||||
return $this->user;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,11 @@ class User extends BaseUser {
|
|||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="user")
|
||||
*/
|
||||
private $productsSold;
|
||||
/**
|
||||
* variabilised products sold
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Festival", mappedBy="user")
|
||||
*/
|
||||
private $festivals;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\ProductCategory", inversedBy="users")
|
||||
|
@ -165,85 +170,114 @@ class User extends BaseUser {
|
|||
return $this->googleId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add product
|
||||
*
|
||||
* @param \AppBundle\Entity\Product $product
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function addProduct( \AppBundle\Entity\Product $product ) {
|
||||
$this->products[] = $product;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove product
|
||||
*
|
||||
* @param \AppBundle\Entity\Product $product
|
||||
*/
|
||||
public function removeProduct( \AppBundle\Entity\Product $product ) {
|
||||
$this->products->removeElement( $product );
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove productsSold
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductSold $productsSold
|
||||
*/
|
||||
public function removeProductsSold( \AppBundle\Entity\ProductSold $productsSold ) {
|
||||
$this->productsSold->removeElement( $productsSold );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add category
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductCategory $category
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function addCategory( \AppBundle\Entity\ProductCategory $category ) {
|
||||
$this->categories[] = $category;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove category
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductCategory $category
|
||||
*/
|
||||
public function removeCategory( \AppBundle\Entity\ProductCategory $category ) {
|
||||
$this->categories->removeElement( $category );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function addSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
|
||||
$this->sellRecords[] = $sellRecord;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*/
|
||||
public function removeSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
|
||||
$this->sellRecords->removeElement( $sellRecord );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add product
|
||||
* Add festival.
|
||||
*
|
||||
* @param \AppBundle\Entity\Product $product
|
||||
* @param \AppBundle\Entity\Festival $festival
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function addProduct(\AppBundle\Entity\Product $product)
|
||||
public function addFestival(\AppBundle\Entity\Festival $festival)
|
||||
{
|
||||
$this->products[] = $product;
|
||||
$this->festivals[] = $festival;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove product
|
||||
* Remove festival.
|
||||
*
|
||||
* @param \AppBundle\Entity\Product $product
|
||||
* @param \AppBundle\Entity\Festival $festival
|
||||
*
|
||||
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
|
||||
*/
|
||||
public function removeProduct(\AppBundle\Entity\Product $product)
|
||||
public function removeFestival(\AppBundle\Entity\Festival $festival)
|
||||
{
|
||||
$this->products->removeElement($product);
|
||||
return $this->festivals->removeElement($festival);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove productsSold
|
||||
* Get festivals.
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductSold $productsSold
|
||||
* @return \Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function removeProductsSold(\AppBundle\Entity\ProductSold $productsSold)
|
||||
public function getFestivals()
|
||||
{
|
||||
$this->productsSold->removeElement($productsSold);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add category
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductCategory $category
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function addCategory(\AppBundle\Entity\ProductCategory $category)
|
||||
{
|
||||
$this->categories[] = $category;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove category
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductCategory $category
|
||||
*/
|
||||
public function removeCategory(\AppBundle\Entity\ProductCategory $category)
|
||||
{
|
||||
$this->categories->removeElement($category);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function addSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
|
||||
{
|
||||
$this->sellRecords[] = $sellRecord;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*/
|
||||
public function removeSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
|
||||
{
|
||||
$this->sellRecords->removeElement($sellRecord);
|
||||
return $this->festivals;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,11 @@ class User extends BaseUser {
|
|||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="user")
|
||||
*/
|
||||
private $productsSold;
|
||||
/**
|
||||
* variabilised products sold
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Festival", mappedBy="user")
|
||||
*/
|
||||
private $festivals;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\ProductCategory", inversedBy="users")
|
||||
|
@ -165,85 +170,78 @@ class User extends BaseUser {
|
|||
return $this->googleId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add product
|
||||
*
|
||||
* @param \AppBundle\Entity\Product $product
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function addProduct(\AppBundle\Entity\Product $product)
|
||||
{
|
||||
$this->products[] = $product;
|
||||
/**
|
||||
* Add product
|
||||
*
|
||||
* @param \AppBundle\Entity\Product $product
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function addProduct( \AppBundle\Entity\Product $product ) {
|
||||
$this->products[] = $product;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove product
|
||||
*
|
||||
* @param \AppBundle\Entity\Product $product
|
||||
*/
|
||||
public function removeProduct(\AppBundle\Entity\Product $product)
|
||||
{
|
||||
$this->products->removeElement($product);
|
||||
}
|
||||
/**
|
||||
* Remove product
|
||||
*
|
||||
* @param \AppBundle\Entity\Product $product
|
||||
*/
|
||||
public function removeProduct( \AppBundle\Entity\Product $product ) {
|
||||
$this->products->removeElement( $product );
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove productsSold
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductSold $productsSold
|
||||
*/
|
||||
public function removeProductsSold(\AppBundle\Entity\ProductSold $productsSold)
|
||||
{
|
||||
$this->productsSold->removeElement($productsSold);
|
||||
}
|
||||
/**
|
||||
* Remove productsSold
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductSold $productsSold
|
||||
*/
|
||||
public function removeProductsSold( \AppBundle\Entity\ProductSold $productsSold ) {
|
||||
$this->productsSold->removeElement( $productsSold );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add category
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductCategory $category
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function addCategory(\AppBundle\Entity\ProductCategory $category)
|
||||
{
|
||||
$this->categories[] = $category;
|
||||
/**
|
||||
* Add category
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductCategory $category
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function addCategory( \AppBundle\Entity\ProductCategory $category ) {
|
||||
$this->categories[] = $category;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove category
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductCategory $category
|
||||
*/
|
||||
public function removeCategory(\AppBundle\Entity\ProductCategory $category)
|
||||
{
|
||||
$this->categories->removeElement($category);
|
||||
}
|
||||
/**
|
||||
* Remove category
|
||||
*
|
||||
* @param \AppBundle\Entity\ProductCategory $category
|
||||
*/
|
||||
public function removeCategory( \AppBundle\Entity\ProductCategory $category ) {
|
||||
$this->categories->removeElement( $category );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function addSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
|
||||
{
|
||||
$this->sellRecords[] = $sellRecord;
|
||||
/**
|
||||
* Add sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function addSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
|
||||
$this->sellRecords[] = $sellRecord;
|
||||
|
||||
return $this;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*/
|
||||
public function removeSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
|
||||
{
|
||||
$this->sellRecords->removeElement($sellRecord);
|
||||
}
|
||||
/**
|
||||
* Remove sellRecord
|
||||
*
|
||||
* @param \AppBundle\Entity\SellRecord $sellRecord
|
||||
*/
|
||||
public function removeSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
|
||||
$this->sellRecords->removeElement( $sellRecord );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,31 +6,30 @@ use Symfony\Component\Form\AbstractType;
|
|||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class FestivalType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->add('name')->add('dateCreation');
|
||||
}/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'AppBundle\Entity\Festival'
|
||||
));
|
||||
}
|
||||
class FestivalType extends AbstractType {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm( FormBuilderInterface $builder, array $options ) {
|
||||
$builder->add( 'name' )// ->add('dateCreation')
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix()
|
||||
{
|
||||
return 'appbundle_festival';
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions( OptionsResolver $resolver ) {
|
||||
$resolver->setDefaults( [
|
||||
'data_class' => 'AppBundle\Entity\Festival',
|
||||
] );
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBlockPrefix() {
|
||||
return 'appbundle_festival';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,9 @@ class ProductCategoryType extends AbstractType
|
|||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->add('name')->add('users');
|
||||
$builder->add('name')
|
||||
// ->add('users')
|
||||
;
|
||||
}/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue