src/Entity/Notice.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Gedmo\Timestampable\Traits\TimestampableEntity;
  7. use App\Entity\Traits\IdTrait;
  8. use App\Entity\Traits\NameTrait;
  9. use App\Entity\Traits\ContentTrait;
  10. use App\Entity\Traits\PublishedAtTrait;
  11. use App\Entity\Traits\BatchMethodTrait;
  12. /**
  13.  *
  14.  * @ORM\Entity(repositoryClass="App\Repository\NoticeRepository")
  15.  *
  16.  * @author wendell.zheng <wxzheng@ustc.edu.cn>
  17.  */
  18. class Notice
  19. {
  20.     use IdTraitNameTraitContentTraitPublishedAtTraitTimestampableEntityBatchMethodTrait;
  21.     const NAME '通知';
  22.     /**
  23.      *
  24.      * @ORM\ManyToOne(targetEntity="Batch", inversedBy="notices")
  25.      */
  26.     protected $batch;
  27.     /**
  28.      *
  29.      * @ORM\OneToMany(targetEntity="NoticeAttachment", mappedBy="notice")
  30.      */
  31.     protected $attachments;
  32.     public function __construct()
  33.     {
  34.         $this->publishedAt = new \DateTime();
  35.         $this->attachments = new ArrayCollection();
  36.     }
  37.     /**
  38.      *
  39.      * @return Collection|NoticeAttachment[]
  40.      */
  41.     public function getAttachments(): Collection
  42.     {
  43.         return $this->attachments;
  44.     }
  45. }