Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
technobel.sf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mathieu
technobel.sf
Commits
a6465cc1
Commit
a6465cc1
authored
Jan 25, 2019
by
Mat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajoute une copie de GarageBundle (projet 180529_eval) pour la mettre sur le dépôt
parent
3410649b
Pipeline
#54
failed with stages
Changes
29
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
2023 additions
and
0 deletions
+2023
-0
src/GarageBundle/Controller/CategorieController.php
src/GarageBundle/Controller/CategorieController.php
+96
-0
src/GarageBundle/Controller/DefaultController.php
src/GarageBundle/Controller/DefaultController.php
+13
-0
src/GarageBundle/Controller/GarageController.php
src/GarageBundle/Controller/GarageController.php
+106
-0
src/GarageBundle/Controller/VoitureController.php
src/GarageBundle/Controller/VoitureController.php
+110
-0
src/GarageBundle/Entity/Categorie.php
src/GarageBundle/Entity/Categorie.php
+194
-0
src/GarageBundle/Entity/Garage.php
src/GarageBundle/Entity/Garage.php
+262
-0
src/GarageBundle/Entity/Voiture.php
src/GarageBundle/Entity/Voiture.php
+372
-0
src/GarageBundle/Form/CategorieType.php
src/GarageBundle/Form/CategorieType.php
+40
-0
src/GarageBundle/Form/GarageType.php
src/GarageBundle/Form/GarageType.php
+51
-0
src/GarageBundle/Form/VoitureType.php
src/GarageBundle/Form/VoitureType.php
+78
-0
src/GarageBundle/GarageBundle.php
src/GarageBundle/GarageBundle.php
+9
-0
src/GarageBundle/Repository/CategorieRepository.php
src/GarageBundle/Repository/CategorieRepository.php
+55
-0
src/GarageBundle/Repository/GarageRepository.php
src/GarageBundle/Repository/GarageRepository.php
+70
-0
src/GarageBundle/Repository/VoitureRepository.php
src/GarageBundle/Repository/VoitureRepository.php
+56
-0
src/GarageBundle/Resources/config/routing.yml
src/GarageBundle/Resources/config/routing.yml
+97
-0
src/GarageBundle/Resources/config/services.yml
src/GarageBundle/Resources/config/services.yml
+4
-0
src/GarageBundle/Resources/views/Categorie/create.html.twig
src/GarageBundle/Resources/views/Categorie/create.html.twig
+16
-0
src/GarageBundle/Resources/views/Categorie/read.html.twig
src/GarageBundle/Resources/views/Categorie/read.html.twig
+51
-0
src/GarageBundle/Resources/views/Categorie/update.html.twig
src/GarageBundle/Resources/views/Categorie/update.html.twig
+16
-0
src/GarageBundle/Resources/views/Default/footer.html.twig
src/GarageBundle/Resources/views/Default/footer.html.twig
+1
-0
src/GarageBundle/Resources/views/Default/index.html.twig
src/GarageBundle/Resources/views/Default/index.html.twig
+74
-0
src/GarageBundle/Resources/views/Default/navbar.html.twig
src/GarageBundle/Resources/views/Default/navbar.html.twig
+15
-0
src/GarageBundle/Resources/views/Garage/create.html.twig
src/GarageBundle/Resources/views/Garage/create.html.twig
+16
-0
src/GarageBundle/Resources/views/Garage/read.html.twig
src/GarageBundle/Resources/views/Garage/read.html.twig
+57
-0
src/GarageBundle/Resources/views/Garage/update.html.twig
src/GarageBundle/Resources/views/Garage/update.html.twig
+16
-0
src/GarageBundle/Resources/views/Voiture/create.html.twig
src/GarageBundle/Resources/views/Voiture/create.html.twig
+16
-0
src/GarageBundle/Resources/views/Voiture/read.html.twig
src/GarageBundle/Resources/views/Voiture/read.html.twig
+61
-0
src/GarageBundle/Resources/views/Voiture/update.html.twig
src/GarageBundle/Resources/views/Voiture/update.html.twig
+16
-0
src/GarageBundle/Resources/views/layout.html.twig
src/GarageBundle/Resources/views/layout.html.twig
+55
-0
No files found.
src/GarageBundle/Controller/CategorieController.php
0 → 100644
View file @
a6465cc1
<?php
namespace
GarageBundle\Controller
;
use
GarageBundle\Entity\Categorie
;
use
GarageBundle\Form\CategorieType
;
use
Symfony\Bundle\FrameworkBundle\Controller\Controller
;
use
Symfony\Component\HttpFoundation\Request
;
class
CategorieController
extends
Controller
{
/**
* @param Request $request
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
*/
public
function
createAction
(
Request
$request
)
{
$categorie
=
new
Categorie
();
$form
=
$this
->
createForm
(
CategorieType
::
class
,
$categorie
);
$form
->
handleRequest
(
$request
);
if
(
$form
->
isSubmitted
()
&&
$form
->
isValid
())
{
$em
=
$this
->
getDoctrine
()
->
getManager
();
$em
->
persist
(
$categorie
);
$em
->
flush
();
$this
->
addFlash
(
'success'
,
"La catégorie a bien été créée"
);
return
$this
->
redirectToRoute
(
'garage_categorie_read'
);
}
return
$this
->
render
(
'GarageBundle:Categorie:create.html.twig'
,
array
(
'formCategorie'
=>
$form
->
createView
()
));
}
/**
* @return \Symfony\Component\HttpFoundation\Response
*/
public
function
readAction
()
{
$em
=
$this
->
getDoctrine
()
->
getManager
();
$categories
=
$em
->
getRepository
(
'GarageBundle:Categorie'
)
->
findAllForRead
();
return
$this
->
render
(
'@Garage/Categorie/read.html.twig'
,
array
(
'categories'
=>
$categories
));
}
/**
* @param Request $request
* @param $id
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
* @throws \Doctrine\ORM\NonUniqueResultException
*/
public
function
updateAction
(
Request
$request
,
$id
)
{
$em
=
$this
->
getDoctrine
()
->
getManager
();
$categorie
=
$em
->
getRepository
(
'GarageBundle:Categorie'
)
->
findOneForUpdate
(
$id
);
if
(
$categorie
===
null
)
{
throw
$this
->
createNotFoundException
();
}
$form
=
$this
->
createForm
(
CategorieType
::
class
,
$categorie
);
$form
->
handleRequest
(
$request
);
if
(
$form
->
isSubmitted
()
&&
$form
->
isValid
())
{
$em
->
flush
();
$this
->
addFlash
(
'success'
,
"La catégorie a bien été modifiée"
);
return
$this
->
redirectToRoute
(
'garage_categorie_read'
);
}
return
$this
->
render
(
'GarageBundle:Categorie:update.html.twig'
,
array
(
'id'
=>
$id
,
'formCategorie'
=>
$form
->
createView
()
));
}
/**
* @param $id
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @throws \Doctrine\ORM\NonUniqueResultException
*/
public
function
deleteAction
(
$id
)
{
$em
=
$this
->
getDoctrine
()
->
getManager
();
$categorie
=
$em
->
getRepository
(
'GarageBundle:Categorie'
)
->
findOneForDelete
(
$id
);
if
(
$categorie
!==
null
)
{
$em
->
remove
(
$categorie
);
$this
->
addFlash
(
'success'
,
"La catégorie a bien été supprimée"
);
$em
->
flush
();
}
return
$this
->
redirectToRoute
(
'garage_categorie_read'
);
}
}
src/GarageBundle/Controller/DefaultController.php
0 → 100755
View file @
a6465cc1
<?php
namespace
GarageBundle\Controller
;
use
Symfony\Bundle\FrameworkBundle\Controller\Controller
;
class
DefaultController
extends
Controller
{
public
function
indexAction
()
{
return
$this
->
render
(
'GarageBundle:Default:index.html.twig'
);
}
}
src/GarageBundle/Controller/GarageController.php
0 → 100755
View file @
a6465cc1
<?php
namespace
GarageBundle\Controller
;
use
GarageBundle\Entity\Garage
;
use
GarageBundle\Form\GarageType
;
use
Symfony\Bundle\FrameworkBundle\Controller\Controller
;
use
Symfony\Component\HttpFoundation\Request
;
class
GarageController
extends
Controller
{
/**
* @param Request $request
* @return \Symfony\Component\HttpFoundation\Response
*/
public
function
createAction
(
Request
$request
)
{
$garage
=
new
Garage
();
$form
=
$this
->
createForm
(
GarageType
::
class
,
$garage
);
$form
->
handleRequest
(
$request
);
if
(
$form
->
isSubmitted
()
&&
$form
->
isValid
())
{
$em
=
$this
->
getDoctrine
()
->
getManager
();
$em
->
persist
(
$garage
);
$em
->
flush
();
$this
->
addFlash
(
'success'
,
'Votre garage a bien été sauvegardé.'
);
return
$this
->
redirectToRoute
(
'garage_read'
);
}
return
$this
->
render
(
'@Garage/Garage/create.html.twig'
,
array
(
'formGarage'
=>
$form
->
createView
()
));
}
/**
* @return \Symfony\Component\HttpFoundation\Response
*/
public
function
readAction
()
{
$em
=
$this
->
getDoctrine
()
->
getManager
();
$garages
=
$em
->
getRepository
(
'GarageBundle:Garage'
)
->
findAllForRead
();
return
$this
->
render
(
'@Garage/Garage/read.html.twig'
,
array
(
'garages'
=>
$garages
));
}
/**
* @param Request $request
* @param $id
* @return \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* @throws \Doctrine\ORM\NonUniqueResultException
*/
public
function
updateAction
(
Request
$request
,
$id
)
{
$em
=
$this
->
getDoctrine
()
->
getManager
();
$garage
=
$em
->
getRepository
(
'GarageBundle:Garage'
)
->
findOneForUpdate
(
$id
);
if
(
$garage
===
null
)
{
throw
$this
->
createNotFoundException
();
}
$form
=
$this
->
createForm
(
GarageType
::
class
,
$garage
);
$form
->
handleRequest
(
$request
);
if
(
$form
->
isSubmitted
()
&&
$form
->
isValid
())
{
$em
->
flush
();
$this
->
addFlash
(
'success'
,
'Votre garage a bien été modifié.'
);
return
$this
->
redirectToRoute
(
'garage_read'
);
}
return
$this
->
render
(
'@Garage/Garage/update.html.twig'
,
array
(
'id'
=>
$id
,
'formGarage'
=>
$form
->
createView
()
));
}
/**
* @param $id
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @throws \Doctrine\ORM\NonUniqueResultException
*/
public
function
deleteAction
(
$id
)
{
$em
=
$this
->
getDoctrine
()
->
getManager
();
$garage
=
$em
->
getRepository
(
'GarageBundle:Garage'
)
->
findOneForDelete
(
$id
);
if
(
$garage
!==
null
)
{
$em
->
remove
(
$garage
);
$em
->
flush
();
$this
->
addFlash
(
'success'
,
'Votre garage a bien été supprimé.'
);
}
return
$this
->
redirectToRoute
(
'garage_read'
);
}
}
src/GarageBundle/Controller/VoitureController.php
0 → 100755
View file @
a6465cc1
<?php
namespace
GarageBundle\Controller
;
use
GarageBundle\Entity\Voiture
;
use
GarageBundle\Form\VoitureType
;
use
Symfony\Bundle\FrameworkBundle\Controller\Controller
;
use
Symfony\Component\HttpFoundation\Request
;
class
VoitureController
extends
Controller
{
/**
* @param Request $request
* @return \Symfony\Component\HttpFoundation\Response
*/
public
function
createAction
(
Request
$request
)
{
$voiture
=
new
Voiture
();
$em
=
$this
->
getDoctrine
()
->
getManager
();
$garageDispo
=
$em
->
getRepository
(
'GarageBundle:Garage'
)
->
findAvailable
();
dump
(
$garageDispo
);
$form
=
$this
->
createForm
(
VoitureType
::
class
,
$voiture
);
//, array('garageDispo' => $garageDispo)
$form
->
handleRequest
(
$request
);
if
(
$form
->
isSubmitted
()
&&
$form
->
isValid
())
{
$em
->
persist
(
$voiture
);
$em
->
flush
();
$this
->
addFlash
(
'success'
,
'Votre voiture a bien été sauvegardée.'
);
return
$this
->
redirectToRoute
(
'garage_voiture_read'
);
}
return
$this
->
render
(
'@Garage/Voiture/create.html.twig'
,
array
(
'formVoiture'
=>
$form
->
createView
()
));
}
/**
* @return \Symfony\Component\HttpFoundation\Response
*/
public
function
readAction
()
{
$em
=
$this
->
getDoctrine
()
->
getManager
();
$voitures
=
$em
->
getRepository
(
'GarageBundle:Voiture'
)
->
findAllForRead
();
return
$this
->
render
(
'@Garage/Voiture/read.html.twig'
,
array
(
'voitures'
=>
$voitures
));
}
/**
* @param Request $request
* @param $id
* @return \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* @throws \Doctrine\ORM\NonUniqueResultException
*/
public
function
updateAction
(
Request
$request
,
$id
)
{
$em
=
$this
->
getDoctrine
()
->
getManager
();
$voiture
=
$em
->
getRepository
(
'GarageBundle:Voiture'
)
->
findOneForUpdate
(
$id
);
if
(
$voiture
===
null
)
{
throw
$this
->
createNotFoundException
();
}
$form
=
$this
->
createForm
(
VoitureType
::
class
,
$voiture
);
$form
->
handleRequest
(
$request
);
if
(
$form
->
isSubmitted
()
&&
$form
->
isValid
())
{
$em
->
flush
();
$this
->
addFlash
(
'success'
,
'Votre voiture a bien été modifiée.'
);
return
$this
->
redirectToRoute
(
'garage_voiture_read'
);
}
return
$this
->
render
(
'@Garage/Voiture/update.html.twig'
,
array
(
'id'
=>
$id
,
'formVoiture'
=>
$form
->
createView
()
));
}
/**
* @param $id
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @throws \Doctrine\ORM\NonUniqueResultException
*/
public
function
deleteAction
(
$id
)
{
$em
=
$this
->
getDoctrine
()
->
getManager
();
$voiture
=
$em
->
getRepository
(
'GarageBundle:Voiture'
)
->
findOneForDelete
(
$id
);
if
(
$voiture
!==
null
)
{
$em
->
remove
(
$voiture
);
$em
->
flush
();
$this
->
addFlash
(
'success'
,
'Votre voiture a bien été supprimée.'
);
}
return
$this
->
redirectToRoute
(
'garage_voiture_read'
);
}
}
src/GarageBundle/Entity/Categorie.php
0 → 100644
View file @
a6465cc1
<?php
namespace
GarageBundle\Entity
;
use
Doctrine\Common\Collections\ArrayCollection
;
use
Doctrine\ORM\Mapping
as
ORM
;
/**
* Categorie
*
* @ORM\Table(name="categorie")
* @ORM\Entity(repositoryClass="GarageBundle\Repository\CategorieRepository")
* @ORM\HasLifecycleCallbacks()
*/
class
Categorie
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private
$id
;
/**
* @var \DateTime
*
* @ORM\Column(name="createdAt", type="datetime", nullable=true)
*/
private
$createdAt
;
/**
* @var \DateTime
*
* @ORM\Column(name="modifiedAt", type="datetime", nullable=true)
*/
private
$modifiedAt
;
/**
* @var string
*
* @ORM\Column(name="nom", type="string", length=255)
*/
private
$nom
;
/**
* @var ArrayCollection
* @ORM\OneToMany(targetEntity="GarageBundle\Entity\Voiture", mappedBy="categorie")
*/
private
$voitures
;
/**
*
* @ORM\PrePersist()
*/
public
function
prePersist
()
{
$this
->
createdAt
=
new
\DateTime
();
$this
->
modifiedAt
=
new
\DateTime
();
}
/**
*
* @ORM\PreUpdate()
*/
public
function
preUpdate
()
{
$this
->
modifiedAt
=
new
\DateTime
();
}
/**
* Get id
*
* @return int
*/
public
function
getId
()
{
return
$this
->
id
;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
*
* @return Categorie
*/
public
function
setCreatedAt
(
$createdAt
)
{
$this
->
createdAt
=
$createdAt
;
return
$this
;
}
/**
* Get createdAt
*
* @return \DateTime
*/
public
function
getCreatedAt
()
{
return
$this
->
createdAt
;
}
/**
* Set modifiedAt
*
* @param \DateTime $modifiedAt
*
* @return Categorie
*/
public
function
setModifiedAt
(
$modifiedAt
)
{
$this
->
modifiedAt
=
$modifiedAt
;
return
$this
;
}
/**
* Get modifiedAt
*
* @return \DateTime
*/
public
function
getModifiedAt
()
{
return
$this
->
modifiedAt
;
}
/**
* Set nom
*
* @param string $nom
*
* @return Categorie
*/
public
function
setNom
(
$nom
)
{
$this
->
nom
=
$nom
;
return
$this
;
}
/**
* Get nom
*
* @return string
*/
public
function
getNom
()
{
return
$this
->
nom
;
}
/**
* Constructor
*/
public
function
__construct
()
{
$this
->
voitures
=
new
\Doctrine\Common\Collections\ArrayCollection
();
}
/**
* Add voiture
*
* @param \GarageBundle\Entity\Voiture $voiture
*
* @return Categorie
*/
public
function
addVoiture
(
\GarageBundle\Entity\Voiture
$voiture
)
{
$this
->
voitures
[]
=
$voiture
;
return
$this
;
}
/**
* Remove voiture
*
* @param \GarageBundle\Entity\Voiture $voiture
*/
public
function
removeVoiture
(
\GarageBundle\Entity\Voiture
$voiture
)
{
$this
->
voitures
->
removeElement
(
$voiture
);
}
/**
* Get voitures
*
* @return \Doctrine\Common\Collections\Collection
*/
public
function
getVoitures
()
{
return
$this
->
voitures
;
}
}
src/GarageBundle/Entity/Garage.php
0 → 100644
View file @
a6465cc1
<?php
namespace
GarageBundle\Entity
;
use
Doctrine\Common\Collections\ArrayCollection
;
use
Doctrine\ORM\Mapping
as
ORM
;
/**
* Garage
*
* @ORM\Table(name="garage")
* @ORM\Entity(repositoryClass="GarageBundle\Repository\GarageRepository")
* @ORM\HasLifecycleCallbacks()
*/
class
Garage
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private
$id
;
/**
* @var \DateTime
*
* @ORM\Column(name="createdAt", type="datetime", nullable=true)
*/
private
$createdAt
;
/**
* @var \DateTime
*
* @ORM\Column(name="modifiedAt", type="datetime", nullable=true)
*/
private
$modifiedAt
;
/**
* @var int
*
* @ORM\Column(name="capacite", type="integer", length=100)
*/
private
$capacite
;
/**
* @var string
*
* @ORM\Column(name="nom", type="string", length=255)
*/
private
$nom
;
/**
* @var string
*
* @ORM\Column(name="lieu", type="string", length=255)
*/
private
$lieu
;
/**
* @var ArrayCollection
*
* @ORM\OneToMany(targetEntity="GarageBundle\Entity\Voiture", mappedBy="garage")
*/
private
$voitures
;
/**
*
* @ORM\PrePersist()
*/
public
function
prePersist
()
{
$this
->
createdAt
=
new
\DateTime
();
$this
->
modifiedAt
=
new
\DateTime
();
}
/**
*
* @ORM\PreUpdate()
*/
public
function
preUpdate
()
{
$this
->
modifiedAt
=
new
\DateTime
();
}
/**
* Get id
*
* @return int
*/
public
function
getId
()
{
return
$this
->
id
;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
*
* @return Garage
*/
public
function
setCreatedAt
(
$createdAt
)
{
$this
->
createdAt
=
$createdAt
;