src/Daikin/BaseBundle/Entity/AbstractBaseEntity.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Daikin\BaseBundle\Entity;
  3. use \DateTime;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Gedmo\Mapping\Annotation as Gedmo;
  6. /**
  7.  * @ORM\MappedSuperclass
  8.  */
  9. abstract class AbstractBaseEntity extends AbstractDeleteableEntity
  10. {
  11.     /**
  12.      * @ORM\Id
  13.      * @ORM\Column(type="integer", options={"unsigned"=true})
  14.      * @ORM\GeneratedValue(strategy="AUTO")
  15.      */
  16.     protected $id;
  17.     /**
  18.      * @Gedmo\Timestampable(on="create")
  19.      * @ORM\Column(name="createdAt", type="datetime")
  20.      */
  21.     protected $createdAt;
  22.     /**
  23.      * \@Gedmo\Timestampable(on="update")
  24.      * @ORM\Column(name="updatedAt", type="integer", nullable=true)
  25.      */
  26.     protected $updatedAt;
  27.     public function __construct()
  28.     {
  29.         parent::__construct();
  30.         $this->deletestatus 0;
  31.         $this->createdAt = new DateTime;
  32.         $this->updatedAt $this->createdAt->format('U');
  33.     }
  34.     /**
  35.      * get id
  36.      *
  37.      * @return integer
  38.      */
  39.     public function getId()
  40.     {
  41.         return $this->id;
  42.     }
  43.     /**
  44.      * Set created_at
  45.      *
  46.      * @param \DateTime $createdAt
  47.      * @return AbstractBaseEntity
  48.      */
  49.     public function setCreatedAt(DateTime $createdAt)
  50.     {
  51.         $this->createdAt $createdAt;
  52.         return $this;
  53.     }
  54.     /**
  55.      * Get created_at
  56.      *
  57.      * @return \DateTime
  58.      */
  59.     public function getCreatedAt()
  60.     {
  61.         return $this->createdAt;
  62.     }
  63.     /**
  64.      * Set updated_at
  65.      *
  66.      * @param integer $updatedAt
  67.      * @return AbstractBaseEntity
  68.      */
  69.     public function setUpdatedAt($updatedAt)
  70.     {
  71.         $this->updatedAt = (int)$updatedAt;
  72.         return $this;
  73.     }
  74.     /**
  75.      * Get updated_at
  76.      *
  77.      * @return integer
  78.      */
  79.     public function getUpdatedAt()
  80.     {
  81.         return $this->updatedAt;
  82.     }
  83. }