diff --git a/0ne/orig/ajax/biere.html b/0ne/orig/ajax/biere.html new file mode 100755 index 0000000000000000000000000000000000000000..6faacfd1ee8373f792f4ceddba3041817f98eff2 --- /dev/null +++ b/0ne/orig/ajax/biere.html @@ -0,0 +1,47 @@ + + + + + Bière + + +

Bière

+
+ +
+ +
+ +
+ +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/src/Api2Bundle/Controller/BiereController.php b/src/Api2Bundle/Controller/BiereController.php new file mode 100755 index 0000000000000000000000000000000000000000..bbe6768c73a59891340ce0c1fc964b947d38a13f --- /dev/null +++ b/src/Api2Bundle/Controller/BiereController.php @@ -0,0 +1,29 @@ +createForm(BiereType::class, $biere); + $form->handleRequest($request); + + dump($biere); + return 0; + } +} diff --git a/src/Api2Bundle/Entity/Biere.php b/src/Api2Bundle/Entity/Biere.php index aa10287b6bdb0a071965a25f850f578010ab04fb..4da19c61ca043e503a11f64f8ce5c4c22bdbc79e 100755 --- a/src/Api2Bundle/Entity/Biere.php +++ b/src/Api2Bundle/Entity/Biere.php @@ -3,6 +3,7 @@ namespace Api2Bundle\Entity; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\HttpFoundation\File\UploadedFile; /** * Biere @@ -24,7 +25,7 @@ class Biere /** * @var Categorie * @ORM\ManyToOne(targetEntity="Api2Bundle\Entity\Categorie") - * @ORM\JoinColumn(name="id_categorie", nullable=false) + * @ORM\JoinColumn(name="id_categorie", nullable=true) */ private $categorie; @@ -58,7 +59,12 @@ class Biere * @ORM\Column(name="image", type="string", length=255, nullable=true, unique=true) */ private $image; - + + /** + * @var UploadedFile + * + */ + private $file; /** * Get id @@ -178,5 +184,23 @@ class Biere return $this; } + /** + * @return UploadedFile + */ + public function getFile() + { + return $this->file; + } + + /** + * @param UploadedFile $file + * @return Biere + */ + public function setFile($file) + { + $this->file = $file; + return $this; + } + } diff --git a/src/Api2Bundle/Form/BiereType.php b/src/Api2Bundle/Form/BiereType.php new file mode 100755 index 0000000000000000000000000000000000000000..d866e277614e90cbc106e85d2ad0454cc74766f2 --- /dev/null +++ b/src/Api2Bundle/Form/BiereType.php @@ -0,0 +1,43 @@ +add('nom') + ->add('degre') + ->add('capacite') + ->add('file') + ->add('brasserie'); + + + }/** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults(array( + 'data_class' => 'Api2Bundle\Entity\Biere' + )); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return ''; + } + + +}