src/Daikin/BaseBundle/Entity/AbstractLivingEntity.php line 13

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. use EHC\HTMLIdableBundle\Interfaces\HTMLIdableInterface;
  7. /**
  8.  * @ORM\MappedSuperclass
  9.  */
  10. abstract class AbstractLivingEntity extends AbstractActivatableEntity implements HTMLIdableInterface
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\Column(type="integer", options={"unsigned"=true})
  15.      * @ORM\GeneratedValue(strategy="AUTO")
  16.      */
  17.     protected $id;
  18.     /**
  19.      * @Gedmo\Timestampable(on="create")
  20.      * @ORM\Column(name="createdAt", type="datetime")
  21.      */
  22.     protected $createdAt;
  23.     /**
  24.      * @Gedmo\Timestampable(on="update")
  25.      * @ORM\Column(name="updatedAt", type="integer", nullable=true)
  26.      */
  27.     protected $updatedAt;
  28.     public function __construct()
  29.     {
  30.         parent::__construct();
  31.         $this->active true;
  32.         $this->activated time();
  33.         $this->deletestatus 0;
  34.         $this->createdAt = new DateTime;
  35.         $this->updatedAt $this->createdAt->format('U');
  36.     }
  37.     /**
  38.      * get id
  39.      *
  40.      * @return integer
  41.      */
  42.     public function getId()
  43.     {
  44.         return $this->id;
  45.     }
  46.     /**
  47.      * Set created_at
  48.      *
  49.      * @param \DateTime $createdAt
  50.      * @return AbstractLivingEntity
  51.      */
  52.     public function setCreatedAt(DateTime $createdAt)
  53.     {
  54.         $this->createdAt $createdAt;
  55.         return $this;
  56.     }
  57.     /**
  58.      * Get created_at
  59.      *
  60.      * @return \DateTime
  61.      */
  62.     public function getCreatedAt()
  63.     {
  64.         return $this->createdAt;
  65.     }
  66.     /**
  67.      * Set updated_at
  68.      *
  69.      * @param integer $updatedAt
  70.      * @return AbstractLivingEntity
  71.      */
  72.     public function setUpdatedAt($updatedAt)
  73.     {
  74.         $this->updatedAt = (int)$updatedAt;
  75.         return $this;
  76.     }
  77.     /**
  78.      * Get updated_at
  79.      *
  80.      * @return integer
  81.      */
  82.     public function getUpdatedAt()
  83.     {
  84.         return $this->updatedAt;
  85.     }
  86. }