src/Entity/UserGroupStat.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use JMS\Serializer\Annotation\Groups;
  5. /**
  6.  * @ORM\Table("UsergroupStat")
  7.  *
  8.  * @ORM\HasLifecycleCallbacks()
  9.  *
  10.  * @ORM\Entity(repositoryClass="App\Repository\UserGroupStatRepository")
  11.  */
  12. class UserGroupStat
  13. {
  14.     /**
  15.      * @Groups({"grouplist"})
  16.      *
  17.      * @ORM\Id()
  18.      *
  19.      * @ORM\GeneratedValue()
  20.      *
  21.      * @ORM\Column(type="integer")
  22.      */
  23.     private $id;
  24.     /**
  25.      * @ORM\OneToOne(targetEntity="App\Entity\UserGroup", inversedBy="userGroupStat", cascade={"persist", "remove"})
  26.      *
  27.      * @ORM\JoinColumn(name="group_id", referencedColumnName="id", nullable=false)
  28.      */
  29.     private $userGroup;
  30.     /**
  31.      * @Groups({"groupdetails", "membergrouplist"})
  32.      *
  33.      * @ORM\Column(type="integer")
  34.      */
  35.     private $post_count 0;
  36.     /**
  37.      * @Groups({"groupdetails", "membergrouplist"})
  38.      *
  39.      * @ORM\Column(type="integer")
  40.      */
  41.     private $member_count 0;
  42.     /**
  43.      * @Groups({"grouplist"})
  44.      *
  45.      * @ORM\Column(type="datetime", nullable=true)
  46.      */
  47.     private $last_post_at;
  48.     /**
  49.      * @ORM\Column(type="datetime")
  50.      */
  51.     private $created_at;
  52.     /**
  53.      * @ORM\PrePersist()
  54.      */
  55.     public function prePersistValues()
  56.     {
  57.         if (!$this->getCreatedAt()) {
  58.             $this->setCreatedAt(new \DateTime());
  59.         }
  60.     }
  61.     public function getId(): ?int
  62.     {
  63.         return $this->id;
  64.     }
  65.     public function getUserGroup(): ?UserGroup
  66.     {
  67.         return $this->userGroup;
  68.     }
  69.     public function setUserGroup(UserGroup $userGroup): self
  70.     {
  71.         $this->userGroup $userGroup;
  72.         return $this;
  73.     }
  74.     public function getPostCount(): ?int
  75.     {
  76.         return $this->post_count;
  77.     }
  78.     public function setPostCount(int $post_count): self
  79.     {
  80.         $this->post_count $post_count;
  81.         return $this;
  82.     }
  83.     public function getMemberCount(): ?int
  84.     {
  85.         return $this->member_count;
  86.     }
  87.     public function setMemberCount(int $member_count): self
  88.     {
  89.         $this->member_count $member_count;
  90.         return $this;
  91.     }
  92.     public function getLastPostAt(): ?\DateTimeInterface
  93.     {
  94.         return $this->last_post_at;
  95.     }
  96.     public function setLastPostAt(?\DateTimeInterface $last_post_at): self
  97.     {
  98.         $this->last_post_at $last_post_at;
  99.         return $this;
  100.     }
  101.     public function getCreatedAt(): ?\DateTimeInterface
  102.     {
  103.         return $this->created_at;
  104.     }
  105.     public function setCreatedAt(\DateTimeInterface $created_at): self
  106.     {
  107.         $this->created_at $created_at;
  108.         return $this;
  109.     }
  110. }