Commit 80bdeb6b authored by Mat's avatar Mat
Browse files

Entités Info et Lettre, les champs et leurs annotations

parent 09001bbf
......@@ -9,6 +9,7 @@ use Doctrine\ORM\Mapping as ORM;
*
* @ORM\Table(name="info")
* @ORM\Entity(repositoryClass="PotageBundle\Repository\InfoRepository")
* @ORM\HasLifecycleCallbacks()
*/
class Info
{
......@@ -20,8 +21,88 @@ class Info
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
* @ORM\Column(name="title", type="string", length=150)
*/
private $title;
/**
* @var string
* @ORM\Column(name="subtitle", type="string", length=150)
*/
private $subtitle;
/**
* @var string
* @ORM\Column(name="text", type="text")
*/
private $text;
/**
* @var string
* @ORM\Column(name="is_post", type="boolean")
*/
private $isPost;
/**
* @var string
* @ORM\Column(name="status", type="string", columnDefinition="enum('draft', 'posted', 'trash')")
*/
private $status;
/**
* @var string
* @ORM\Column(name="color", length=10)
*/
private $color;
/**
* @var \DateTime;
* @ORM\Column(name="posted_at", type="datetime", nullable=true)
*/
private $postedAt;
/**
* @var \DateTime;
* @ORM\Column(name="created_at", type="datetime")
*/
private $createdAt;
/**
* @var \DateTime;
* @ORM\Column(name="updated_at", type="datetime", nullable=true)
*/
private $updatedAt;
/**
* Lettre constructor.
*/
public function __construct()
{
}
/**
* @ORM\PrePersist()
*/
public function prePersist()
{
$this->createdAt = new \DateTime();
}
/**
* @ORM\PreUpdate()
*/
public function preUpdate()
{
$this->updatedAt = new \DateTime();
}
/**
* Get id
*
......@@ -31,5 +112,220 @@ class Info
{
return $this->id;
}
}
/**
* Set title
*
* @param string $title
*
* @return Info
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set subtitle
*
* @param string $subtitle
*
* @return Info
*/
public function setSubtitle($subtitle)
{
$this->subtitle = $subtitle;
return $this;
}
/**
* Get subtitle
*
* @return string
*/
public function getSubtitle()
{
return $this->subtitle;
}
/**
* Set text
*
* @param string $text
*
* @return Info
*/
public function setText($text)
{
$this->text = $text;
return $this;
}
/**
* Get text
*
* @return string
*/
public function getText()
{
return $this->text;
}
/**
* Set isPost
*
* @param boolean $isPost
*
* @return Info
*/
public function setIsPost($isPost)
{
$this->isPost = $isPost;
return $this;
}
/**
* Get isPost
*
* @return boolean
*/
public function getIsPost()
{
return $this->isPost;
}
/**
* Set status
*
* @param string $status
*
* @return Info
*/
public function setStatus($status)
{
$this->status = $status;
return $this;
}
/**
* Get status
*
* @return string
*/
public function getStatus()
{
return $this->status;
}
/**
* Set color
*
* @param string $color
*
* @return Info
*/
public function setColor($color)
{
$this->color = $color;
return $this;
}
/**
* Get color
*
* @return string
*/
public function getColor()
{
return $this->color;
}
/**
* Set postedAt
*
* @param \DateTime $postedAt
*
* @return Info
*/
public function setPostedAt($postedAt)
{
$this->postedAt = $postedAt;
return $this;
}
/**
* Get postedAt
*
* @return \DateTime
*/
public function getPostedAt()
{
return $this->postedAt;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
*
* @return Info
*/
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 Info
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
}
......@@ -9,6 +9,7 @@ use Doctrine\ORM\Mapping as ORM;
*
* @ORM\Table(name="lettre")
* @ORM\Entity(repositoryClass="PotageBundle\Repository\LettreRepository")
* @ORM\HasLifecycleCallbacks()
*/
class Lettre
{
......@@ -20,8 +21,76 @@ class Lettre
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
* @ORM\Column(name="reference", type="string", length=16, unique=true)
*/
private $reference;
/**
* @var string
* @ORM\Column(name="subject", type="string", length=150)
*/
private $subject;
/**
* @var \DateTime
* @ORM\Column(name="started_at", type="datetime")
*/
private $startedAt;
/**
* @var \DateTime
* @ORM\Column(name="ended_at", type="datetime")
*/
private $endedAt;
/**
* @var string
* @ORM\Column(name="status", type="string", columnDefinition="enum('draft', 'current', 'sent', 'closed', 'trash')")
*/
private $status;
/**
* @var \DateTime
* @ORM\Column(name="created_at", type="datetime")
*/
private $createdAt;
/**
* @var \DateTime
* @ORM\Column(name="updated_at", type="datetime", nullable=true)
*/
private $updatedAt;
/**
* Lettre constructor.
*/
public function __construct()
{
}
/**
* @ORM\PrePersist()
*/
public function prePersist()
{
$this->createdAt = new \DateTime();
}
/**
* @ORM\PreUpdate()
*/
public function preUpdate()
{
$this->updatedAt = new \DateTime();
}
/**
* Get id
*
......@@ -31,5 +100,172 @@ class Lettre
{
return $this->id;
}
}
/**
* Set reference
*
* @param string $reference
*
* @return Lettre
*/
public function setReference($reference)
{
$this->reference = $reference;
return $this;
}
/**
* Get reference
*
* @return string
*/
public function getReference()
{
return $this->reference;
}
/**
* Set subject
*
* @param string $subject
*
* @return Lettre
*/
public function setSubject($subject)
{
$this->subject = $subject;
return $this;
}
/**
* Get subject
*
* @return string
*/
public function getSubject()
{
return $this->subject;
}
/**
* Set startedAt
*
* @param \DateTime $startedAt
*
* @return Lettre
*/
public function setStartedAt($startedAt)
{
$this->startedAt = $startedAt;
return $this;
}
/**
* Get startedAt
*
* @return \DateTime
*/
public function getStartedAt()
{
return $this->startedAt;
}
/**
* Set endedAt
*
* @param \DateTime $endedAt
*
* @return Lettre
*/
public function setEndedAt($endedAt)
{
$this->endedAt = $endedAt;
return $this;
}
/**
* Get endedAt
*
* @return \DateTime
*/
public function getEndedAt()
{
return $this->endedAt;
}
/**
* Set status
*
* @param string $status
*
* @return Lettre
*/
public function setStatus($status)
{
$this->status = $status;
return $this;
}
/**
* Get status
*
* @return string
*/
public function getStatus()
{
return $this->status;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
*
* @return Lettre
*/
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 Lettre
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment