src/Entity/BannedUserEntity.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\App;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
  8. /**
  9.  * @ORM\Entity(repositoryClass="App\Repository\BannedUserRepository")
  10.  * @ORM\Table(name="banned_user")
  11.  * @ORM\HasLifecycleCallbacks()
  12.  */
  13. class BannedUserEntity
  14. {
  15.     /**
  16.      * @ORM\Column(type="bigint")
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue(strategy="AUTO")
  19.      */
  20.     protected $id;
  21.     /**
  22.      * @ORM\Column(name="created_by", type="string", length=50)
  23.      */
  24.     protected $createdBy;
  25.     /**
  26.      * @ORM\Column(name="created_at", type="datetime")
  27.      */
  28.     protected $createdAt;
  29.     /**
  30.      * @ORM\Column(name="updated_by", type="string", length=50)
  31.      */
  32.     protected $updatedBy;
  33.     /**
  34.      * @ORM\Column(name="updated_at", type="datetime")
  35.      */
  36.     protected $updatedAt;
  37.     /**
  38.      * @ORM\ManyToOne(targetEntity="UserEntity", inversedBy="bannedUsers")
  39.      * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
  40.      */
  41.     protected $user;
  42.     /**
  43.      * Set createdAt
  44.      *
  45.      * @ORM\PrePersist
  46.      */
  47.     public function setCreatedAtValue()
  48.     {
  49.         $this->createdBy = isset($_COOKIE['username']) ? $_COOKIE['username'] : 'System';
  50.         $this->createdAt = new \DateTime();
  51.         $this->updatedBy = isset($_COOKIE['username']) ? $_COOKIE['username'] : 'System';
  52.         $this->updatedAt = new \DateTime();
  53.     }
  54.     /**
  55.      * Set updatedAt
  56.      *
  57.      * @ORM\PreUpdate
  58.      */
  59.     public function setUpdatedAtValue()
  60.     {
  61.         $this->updatedBy = isset($_COOKIE['username']) ? $_COOKIE['username'] : 'System';
  62.         $this->updatedAt = new \DateTime();
  63.     }
  64.     public function __construct($data=null)
  65.     {
  66.         if(!is_null($data)) {
  67.         }
  68.     }
  69.     /*--------------------------------------------------------------------------------------------------------*/
  70.     /*                    User Defined Setters and Getters                                                      */
  71.     /*--------------------------------------------------------------------------------------------------------*/
  72.     /*--------------------------------------------------------------------------------------------------------*/
  73.     /*                    Setters and Getters                                                                      */
  74.     /*--------------------------------------------------------------------------------------------------------*/
  75.     
  76.     /**
  77.      * Get id.
  78.      *
  79.      * @return int
  80.      */
  81.     public function getId()
  82.     {
  83.         return $this->id;
  84.     }
  85.     /**
  86.      * Set createdBy.
  87.      *
  88.      * @param string $createdBy
  89.      *
  90.      * @return BannedUserEntity
  91.      */
  92.     public function setCreatedBy($createdBy)
  93.     {
  94.         $this->createdBy $createdBy;
  95.         return $this;
  96.     }
  97.     /**
  98.      * Get createdBy.
  99.      *
  100.      * @return string
  101.      */
  102.     public function getCreatedBy()
  103.     {
  104.         return $this->createdBy;
  105.     }
  106.     /**
  107.      * Set createdAt.
  108.      *
  109.      * @param \DateTime $createdAt
  110.      *
  111.      * @return BannedUserEntity
  112.      */
  113.     public function setCreatedAt($createdAt)
  114.     {
  115.         $this->createdAt $createdAt;
  116.         return $this;
  117.     }
  118.     /**
  119.      * Get createdAt.
  120.      *
  121.      * @return \DateTime
  122.      */
  123.     public function getCreatedAt()
  124.     {
  125.         return $this->createdAt;
  126.     }
  127.     /**
  128.      * Set updatedBy.
  129.      *
  130.      * @param string $updatedBy
  131.      *
  132.      * @return BannedUserEntity
  133.      */
  134.     public function setUpdatedBy($updatedBy)
  135.     {
  136.         $this->updatedBy $updatedBy;
  137.         return $this;
  138.     }
  139.     /**
  140.      * Get updatedBy.
  141.      *
  142.      * @return string
  143.      */
  144.     public function getUpdatedBy()
  145.     {
  146.         return $this->updatedBy;
  147.     }
  148.     /**
  149.      * Set updatedAt.
  150.      *
  151.      * @param \DateTime $updatedAt
  152.      *
  153.      * @return BannedUserEntity
  154.      */
  155.     public function setUpdatedAt($updatedAt)
  156.     {
  157.         $this->updatedAt $updatedAt;
  158.         return $this;
  159.     }
  160.     /**
  161.      * Get updatedAt.
  162.      *
  163.      * @return \DateTime
  164.      */
  165.     public function getUpdatedAt()
  166.     {
  167.         return $this->updatedAt;
  168.     }
  169.     /**
  170.      * Set user.
  171.      *
  172.      * @param \App\Entity\UserEntity|null $user
  173.      *
  174.      * @return BannedUserEntity
  175.      */
  176.     public function setUser(\App\Entity\UserEntity $user null)
  177.     {
  178.         $this->user $user;
  179.         return $this;
  180.     }
  181.     /**
  182.      * Get user.
  183.      *
  184.      * @return \App\Entity\UserEntity|null
  185.      */
  186.     public function getUser()
  187.     {
  188.         return $this->user;
  189.     }
  190. }