src/Acme/OffresBundle/Entity/CategoriesOffres.php line 15

Open in your IDE?
  1. <?php
  2. namespace Acme\OffresBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Validator\Constraints as Assert;
  5. /**
  6.  * CategoriesOffres
  7.  *
  8.  * @ORM\Table(name="categoriesoffres")
  9.  * @ORM\Entity(repositoryClass="Acme\OffresBundle\Repository\CategoriesOffresRepository")
  10.  * @ORM\HasLifecycleCallbacks
  11.  */
  12. class CategoriesOffres
  13. {
  14.     /**
  15.      * @var int
  16.      *
  17.      * @ORM\Column(name="id", type="integer")
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue(strategy="AUTO")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @var string
  24.      *
  25.      * @ORM\Column(name="designation", type="string", length=100)
  26.      */
  27.     private $designation;
  28.     /**
  29.      * @var \DateTime
  30.      *
  31.      * @ORM\Column(name="datecreation", type="date")
  32.      */
  33.     private $datecreation;
  34.     public function __toString() {
  35.         return $this->getDesignation();
  36.     }   
  37.     
  38.     /**
  39.      * Get id
  40.      *
  41.      * @return int
  42.      */
  43.     public function getId()
  44.     {
  45.         return $this->id;
  46.     }
  47.     /**
  48.      * Set designation
  49.      *
  50.      * @param string $designation
  51.      *
  52.      * @return CategoriesOffres
  53.      */
  54.     public function setDesignation($designation)
  55.     {
  56.         $this->designation $designation;
  57.         return $this;
  58.     }
  59.     /**
  60.      * Get designation
  61.      *
  62.      * @return string
  63.      */
  64.     public function getDesignation()
  65.     {
  66.         return $this->designation;
  67.     }
  68.     /**
  69.      * Set datecreation
  70.      *
  71.      * @ORM\PrePersist
  72.      */
  73.     public function setDatecreation()
  74.     {
  75.        if(!$this->getDatecreation()){
  76.             $this->datecreation = new \DateTime();
  77.         }
  78.     }
  79.     /**
  80.      * Get datecreation
  81.      *
  82.      * @return \DateTime
  83.      */
  84.     public function getDatecreation()
  85.     {
  86.         return $this->datecreation;
  87.     }
  88. }