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
P
potage
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
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
potage
Commits
eb37a19f
Commit
eb37a19f
authored
Jun 06, 2018
by
Mat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
complète les entités Offre et OffreLegumes: jointure, annotation, persist/update
parent
410a0805
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
564 additions
and
8 deletions
+564
-8
src/PotageBundle/Entity/Offre.php
src/PotageBundle/Entity/Offre.php
+69
-4
src/PotageBundle/Entity/OffreLegumes.php
src/PotageBundle/Entity/OffreLegumes.php
+495
-4
No files found.
src/PotageBundle/Entity/Offre.php
View file @
eb37a19f
...
...
@@ -20,7 +20,13 @@ class Offre
* @ORM\GeneratedValue(strategy="AUTO")
*/
private
$id
;
/**
* @var OffreLegumes[]
* @ORM\OneToMany(targetEntity="PotageBundle\Entity\OffreLegumes", mappedBy="offre")
*/
private
$offreLegumes
;
/**
* @var string
*
...
...
@@ -45,7 +51,7 @@ class Offre
/**
* @var array
*
* @ORM\Column(name="statut", type="s
imple_array
")
* @ORM\Column(name="statut", type="s
tring", columnDefinition="enum('draft', 'current', 'closed', 'trash')
")
*/
private
$statut
;
...
...
@@ -55,7 +61,26 @@ class Offre
* @ORM\Column(name="endedAt", type="datetime")
*/
private
$endedAt
;
/**
*
* @ORM\PrePersist()
*/
public
function
prePersist
()
{
$this
->
createdAt
=
new
\
DateTime
();
//$this->updatedAt = new \DateTime();
}
/**
*
* @ORM\PreUpdate()
*/
public
function
preUpdate
()
{
$this
->
updatedAt
=
new
\
DateTime
();
}
/**
* Get id
...
...
@@ -186,5 +211,45 @@ class Offre
{
return
$this
->
endedAt
;
}
}
/**
* Constructor
*/
public
function
__construct
()
{
$this
->
offreLegumes
=
new
\
Doctrine\Common\Collections\ArrayCollection
();
}
/**
* Add offreLegume
*
* @param \PotageBundle\Entity\OffreLegumes $offreLegume
*
* @return Offre
*/
public
function
addOffreLegume
(
\
PotageBundle\Entity\OffreLegumes
$offreLegume
)
{
$this
->
offreLegumes
[]
=
$offreLegume
;
return
$this
;
}
/**
* Remove offreLegume
*
* @param \PotageBundle\Entity\OffreLegumes $offreLegume
*/
public
function
removeOffreLegume
(
\
PotageBundle\Entity\OffreLegumes
$offreLegume
)
{
$this
->
offreLegumes
->
removeElement
(
$offreLegume
);
}
/**
* Get offreLegumes
*
* @return \Doctrine\Common\Collections\Collection
*/
public
function
getOffreLegumes
()
{
return
$this
->
offreLegumes
;
}
}
src/PotageBundle/Entity/OffreLegumes.php
View file @
eb37a19f
...
...
@@ -3,12 +3,18 @@
namespace
PotageBundle\Entity
;
use
Doctrine\ORM\Mapping
as
ORM
;
use
Symfony\Component\HttpFoundation\File\File
;
use
Vich\UploaderBundle\Mapping\Annotation
as
Vich
;
/**
* OffreLegumes
*
* @ORM\Table(name="offre_legumes")
* @ORM\Entity(repositoryClass="PotageBundle\Repository\OffreLegumesRepository")
* @ORM\HasLifecycleCallbacks()
* @Vich\Uploadable
*
*/
class
OffreLegumes
{
...
...
@@ -20,11 +26,119 @@ class OffreLegumes
* @ORM\GeneratedValue(strategy="AUTO")
*/
private
$id
;
/**
* @var int
* @ORM\ManyToOne(targetEntity="PotageBundle\Entity\Offre", inversedBy="offreLegumes")
* @ORM\JoinColumn(name="id_offre", nullable=false)
*/
private
$offre
;
/**
* @var string
*
* @ORM\Column(name="reference", type="string", length=16, unique=true)
*/
private
$reference
;
/**
* @var \DateTime
*
* @ORM\Column(name="createdAt", type="datetime")
*/
private
$createdAt
;
/**
* @var \DateTime
*
* @ORM\Column(name="updatedAt", type="datetime")
*/
private
$updatedAt
;
/**
* @var string
*
* @ORM\Column(name="nom", type="string", length=100)
*/
private
$nom
;
/**
* @var string
*
* @ORM\Column(name="description", type="text")
*/
private
$description
;
/**
* @var boolean
* @ORM\Column(name="is_fruit", type="boolean")
*/
private
$fruit
;
/**
* @var boolean
* @ORM\Column(name="is_revente", type="boolean")
*/
private
$revente
;
/**
* @var string
*
* @ORM\Column(name="origine", type="string", length=100, nullable=true)
*/
private
$origine
;
/**
* @var float
*
* @ORM\Column(name="prix_unitaire", type="float")
*/
private
$prixUnitaire
;
/**
* @var string
*
* @ORM\Column(name="unite", type="string", length=25)
*/
private
$unite
;
/**
* @var float
*
* @ORM\Column(name="volume_max", type="float")
* @ORM\Column(name="quantite_min", type="float", nullable=true)
*/
private
$quantiteMin
;
/**
* @var float
*
* @ORM\Column(name="quantite_max", type="float", nullable=true)
*/
private
$quantiteMax
;
/**
* @var float
*
* @ORM\Column(name="quantite_step", type="float", nullable=true)
*/
private
$quantiteStep
;
/**
* @ORM\Column(type="string", length=255)
* @var string
*/
private
$image
;
/**
* @Vich\UploadableField(mapping="legume_images", fileNameProperty="image")
* @var File
*/
private
$imageFile
;
/**
* @var float
*
* @ORM\Column(name="volume_max", type="float", nullable=true)
*/
private
$volumeMax
;
...
...
@@ -41,7 +155,25 @@ class OffreLegumes
* @ORM\Column(name="promo", type="string", length=100, nullable=true)
*/
private
$promo
;
/**
*
* @ORM\PrePersist()
*/
public
function
prePersist
()
{
$this
->
createdAt
=
new
\
DateTime
();
}
/**
*
* @ORM\PreUpdate()
*/
public
function
preUpdate
()
{
$this
->
updatedAt
=
new
\
DateTime
();
}
/**
* Get id
...
...
@@ -124,5 +256,364 @@ class OffreLegumes
{
return
$this
->
promo
;
}
}
/**
* Set reference
*
* @param string $reference
*
* @return OffreLegumes
*/
public
function
setReference
(
$reference
)
{
$this
->
reference
=
$reference
;
return
$this
;
}
/**
* Get reference
*
* @return string
*/
public
function
getReference
()
{
return
$this
->
reference
;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
*
* @return OffreLegumes
*/
public
function
setCreatedAt
(
$createdAt
)
{
$this
->
createdAt
=
$createdAt
;
return
$this
;
}
/**
* Get createdAt
*
* @return \DateTime
*/
public
function
getCreatedAt
()
{
return
$this
->
createdAt
;
}
/**
* Set updatedAt
*
* @param \DateTime $updatedAt
*
* @return OffreLegumes
*/
public
function
setUpdatedAt
(
$updatedAt
)
{
$this
->
updatedAt
=
$updatedAt
;
return
$this
;
}
/**
* Get updatedAt
*
* @return \DateTime
*/
public
function
getUpdatedAt
()
{
return
$this
->
updatedAt
;
}
/**
* Set nom
*
* @param string $nom
*
* @return OffreLegumes
*/
public
function
setNom
(
$nom
)
{
$this
->
nom
=
$nom
;
return
$this
;
}
/**
* Get nom
*
* @return string
*/
public
function
getNom
()
{
return
$this
->
nom
;
}
/**
* Set description
*
* @param string $description
*
* @return OffreLegumes
*/
public
function
setDescription
(
$description
)
{
$this
->
description
=
$description
;
return
$this
;
}
/**
* Get description
*
* @return string
*/
public
function
getDescription
()
{
return
$this
->
description
;
}
/**
* Set fruit
*
* @param boolean $fruit
*
* @return OffreLegumes
*/
public
function
setFruit
(
$fruit
)
{
$this
->
fruit
=
$fruit
;
return
$this
;
}
/**
* Get fruit
*
* @return boolean
*/
public
function
getFruit
()
{
return
$this
->
fruit
;
}
/**
* Set revente
*
* @param boolean $revente
*
* @return OffreLegumes
*/
public
function
setRevente
(
$revente
)
{
$this
->
revente
=
$revente
;
return
$this
;
}
/**
* Get revente
*
* @return boolean
*/
public
function
getRevente
()
{
return
$this
->
revente
;
}
/**
* Set origine
*
* @param string $origine
*
* @return OffreLegumes
*/
public
function
setOrigine
(
$origine
)
{
$this
->
origine
=
$origine
;
return
$this
;
}
/**
* Get origine
*
* @return string
*/
public
function
getOrigine
()
{
return
$this
->
origine
;
}
/**
* Set prixUnitaire
*
* @param float $prixUnitaire
*
* @return OffreLegumes
*/
public
function
setPrixUnitaire
(
$prixUnitaire
)
{
$this
->
prixUnitaire
=
$prixUnitaire
;
return
$this
;
}
/**
* Get prixUnitaire
*
* @return float
*/
public
function
getPrixUnitaire
()
{
return
$this
->
prixUnitaire
;
}
/**
* Set unite
*
* @param string $unite
*
* @return OffreLegumes
*/
public
function
setUnite
(
$unite
)
{
$this
->
unite
=
$unite
;
return
$this
;
}
/**
* Get unite
*
* @return string
*/
public
function
getUnite
()
{
return
$this
->
unite
;
}
/**
* Set quantiteMin
*
* @param float $quantiteMin
*
* @return OffreLegumes
*/
public
function
setQuantiteMin
(
$quantiteMin
)
{
$this
->
quantiteMin
=
$quantiteMin
;
return
$this
;
}
/**
* Get quantiteMin
*
* @return float
*/
public
function
getQuantiteMin
()
{
return
$this
->
quantiteMin
;
}
/**
* Set quantiteMax
*
* @param float $quantiteMax
*
* @return OffreLegumes
*/
public
function
setQuantiteMax
(
$quantiteMax
)
{
$this
->
quantiteMax
=
$quantiteMax
;
return
$this
;
}
/**
* Get quantiteMax
*
* @return float
*/
public
function
getQuantiteMax
()
{
return
$this
->
quantiteMax
;
}
/**
* Set quantiteStep
*
* @param float $quantiteStep
*
* @return OffreLegumes
*/
public
function
setQuantiteStep
(
$quantiteStep
)
{
$this
->
quantiteStep
=
$quantiteStep
;
return
$this
;
}
/**
* Get quantiteStep
*
* @return float
*/
public
function
getQuantiteStep
()
{
return
$this
->
quantiteStep
;
}
/**
* Set image
*
* @param string $image
*
* @return OffreLegumes
*/
public
function
setImage
(
$image
)
{
$this
->
image
=
$image
;
return
$this
;
}
/**
* Get image
*
* @return string
*/
public
function
getImage
()
{
return
$this
->
image
;
}
/**
* Set offre
*
* @param \PotageBundle\Entity\Offre $offre
*
* @return OffreLegumes
*/
public
function
setOffre
(
\
PotageBundle\Entity\Offre
$offre
)
{
$this
->
offre
=
$offre
;
return
$this
;
}
/**
* Get offre
*
* @return \PotageBundle\Entity\Offre
*/
public
function
getOffre
()
{
return
$this
->
offre
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment