app/Plugin/EventsManagerPlugin/Entity/TjoEvent.php line 20

Open in your IDE?
  1. <?php
  2. namespace Plugin\EventsManagerPlugin\Entity;
  3. use DateTime;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\Common\Collections\Criteria;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Eccube\Entity\AbstractEntity;
  9. use Plugin\CourcesManagerPlugin\Entity\TjoCourse;
  10. /**
  11.  * @ORM\Entity
  12.  * @ORM\Table(name="tjo_event")
  13.  * @ORM\InheritanceType("SINGLE_TABLE")
  14.  * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
  15.  * @ORM\Entity(repositoryClass="Plugin\EventsManagerPlugin\Repository\TjoEventRepository")
  16.  */
  17. class TjoEvent extends AbstractEntity
  18. {
  19.     /**
  20.      * @var Collection
  21.      * @ORM\OneToMany(targetEntity="Plugin\EventsManagerPlugin\Entity\TjoSchedule", mappedBy="Event", cascade={"persist", "remove"}, orphanRemoval=true)
  22.      */
  23.     private $Schedules;
  24.     
  25.     public function __construct(){
  26.         $this->Schedules = new ArrayCollection();
  27.     }
  28.     /**
  29.      * Get Schedules
  30.      * @var Collection
  31.      */
  32.     public function getSchedules(): Collection{
  33.         return $this->Schedules->matching(
  34.             Criteria::create()
  35.                 ->orderBy(['day' => Criteria::ASC'id' => Criteria::ASC])
  36.         );
  37.         return $this->Schedules;
  38.     }
  39.     /**
  40.      * Add Schedules
  41.      * @param TjoSchedule $Schedules
  42.      * @return self
  43.      */
  44.     public function addSchedule(TjoSchedule $Schedule): self{
  45.         if (!$this->Schedules->contains($Schedule)) {
  46.             $this->Schedules[] = $Schedule;
  47.             $Schedule->setTjoCourse($this);
  48.         }
  49.         return $this;
  50.     }
  51.     /**
  52.      * Remove Schedules
  53.      * @param TjoSchedule $Schedules
  54.      * @return self
  55.      */
  56.     public function removeSchedule(TjoSchedule $Schedule): self{
  57.         if ($this->Schedules->contains($Schedule)) {
  58.             $this->Schedules->removeElement($Schedule);
  59.             if ($Schedule->getTjoCourse() === $this) {
  60.                 $Schedule->setTjoCourse(null);
  61.             }
  62.         }
  63.         return $this;
  64.     }
  65.     // ID
  66.     /**
  67.      * @ORM\Id
  68.      * @ORM\Column(type="integer")
  69.      * @ORM\GeneratedValue(strategy="IDENTITY")
  70.      */
  71.     private $id;
  72.     /**
  73.      * @var string
  74.      * @ORM\Column(name="recept_no", type="string", length=255)
  75.      * 受付番号
  76.      */
  77.     private $recept_no;
  78.     /**
  79.      * @var string
  80.      * @ORM\Column(name="name", type="string", length=255)
  81.      * イベント名
  82.      */
  83.     private $name;
  84.     /**
  85.      * @var string
  86.      * @ORM\Column(name="sub_title", type="string", length=255,nullable=true)
  87.      * サブタイトル
  88.      */
  89.     private $sub_title;
  90.     
  91.     /**
  92.      * @var \DateTime
  93.      * @ORM\Column(name="day_start", type="datetimetz",nullable=true)
  94.      * イベント開始日
  95.      */
  96.     private $day_start;
  97.     /**
  98.      * @var \DateTime
  99.      * @ORM\Column(name="day_end", type="datetimetz",nullable=true)
  100.      * イベント終了日
  101.      */
  102.     private $day_end;
  103.     /**
  104.      * @var \DateTime
  105.      * @ORM\Column(name="day_agreement", type="datetimetz",nullable=true)
  106.      * 承認日
  107.      */
  108.     private $day_agreement;
  109.     /**
  110.      * @var \DateTime
  111.      * @ORM\Column(name="day_payment", type="datetimetz",nullable=true)
  112.      * 入金日
  113.      */
  114.     private $day_payment;
  115.     
  116.     /**
  117.      * @var string
  118.      * @ORM\Column(name="url1", type="string", length=255,nullable=true)
  119.      * イベント名
  120.      */
  121.     private $url1;
  122.     /**
  123.      * @var string
  124.      * @ORM\Column(name="url2", type="string", length=255,nullable=true)
  125.      * イベント名
  126.      */
  127.     private $url2;
  128.     /**
  129.      * @var string
  130.      * @ORM\Column(name="image",type="string",length="255",nullable="true"))
  131.      * 前半画像
  132.      */
  133.     private $image;
  134.     /**
  135.     * @ORM\ManyToOne(targetEntity="Plugin\CourcesManagerPlugin\Entity\TjoCourse")
  136.     * @ORM\JoinColumn(name="tjo_course_id", referencedColumnName="id")
  137.     * コース
  138.     */
  139.     private $Course;
  140.     /** @return int|null */
  141.     public function getId() : int|null {return $this->id;}
  142.     /** @return string|null */
  143.     public function getReceptNo() : ?string {return $this->recept_no;}
  144.     /**
  145.      * @param string $recept_no
  146.      * @return $this;
  147.      */
  148.     public function setReceptNo($recept_no) : self {
  149.         $this->recept_no $recept_no;
  150.         return $this;
  151.     }
  152.     
  153.     /** @return string */
  154.     public function getName() : string {return $this->name;}
  155.     /**
  156.      * @param string $name
  157.      * @return $this;
  158.      */
  159.     public function setName($name) : self {
  160.         $this->name $name;
  161.         return $this;
  162.     }
  163.     /** @return string|null */
  164.     public function getSubTitle() : ?string {return $this->sub_title;}
  165.     /**
  166.      * @param string $sub_title
  167.      * @return $this;
  168.      */
  169.     public function setSubTitle($sub_title) : self {
  170.         $this->sub_title $sub_title;
  171.         return $this;
  172.     }
  173.     /** @return DateTime|null */
  174.     public function getDayStart() : DateTime|null {return $this->day_start;}
  175.     /**
  176.      * @param string $day_start
  177.      * @return $this;
  178.      */
  179.     public function setDayStart($day_start) : self {
  180.         $this->day_start $day_start;
  181.         return $this;
  182.     }
  183.     /** @return DateTime|null */
  184.     public function getDayEnd() : DateTime|null {return $this->day_end;}
  185.     /**
  186.      * @param string $day_end
  187.      * @return $this;
  188.      */
  189.     public function setDayEnd($day_end) : self {
  190.         $this->day_end $day_end;
  191.         return $this;
  192.     }
  193.     /** @return DateTime|null */
  194.     public function getDayAgreement() : DateTime|null {return $this->day_agreement;}
  195.     /**
  196.      * @param string $day_agreement
  197.      * @return $this;
  198.      */
  199.     public function setDayAgreement($day_agreement) : self {
  200.         $this->day_agreement $day_agreement;
  201.         return $this;
  202.     }
  203.     
  204.     /** @return DateTime|null */
  205.     public function getDayPayment() : DateTime|null {return $this->day_payment;}
  206.     /**
  207.      * @param string $day_payment
  208.      * @return $this;
  209.      */
  210.     public function setDayPayment($day_payment) : self {
  211.         $this->day_payment $day_payment;
  212.         return $this;
  213.     }
  214.     /** @return string */
  215.     public function getUrl1() : ?string {return $this->url1;}
  216.     /**
  217.      * @param string $url1
  218.      * @return $this;
  219.      */
  220.     public function setUrl1($url1) : self {
  221.         $this->url1 $url1;
  222.         return $this;
  223.     }
  224.     /** @return string */
  225.     public function getUrl2() : ?string {return $this->url2;}
  226.     /**
  227.      * @param string $url2
  228.      * @return $this;
  229.      */
  230.     public function setUrl2($url2) : self {
  231.         $this->url2 $url2;
  232.         return $this;
  233.     }
  234.     /** @return string|null */
  235.     public function getImage() : string|null {return $this->image;}
  236.     /**
  237.      * @param string $image
  238.      * @return $this;
  239.      */
  240.     public function setImage($image) : self {
  241.         $this->image $image;
  242.         return $this;
  243.     }
  244.     
  245.     /**
  246.      * Get Course
  247.      * @return TjoCourse|null
  248.      */
  249.     public function getCourse(): ?TjoCourse{return $this->Course;}
  250.     /**
  251.      * Set Course
  252.      * @param TjoCourse $Course
  253.      * @return self
  254.      */
  255.     public function setCourse(?TjoCourse $Course): self{
  256.         $this->Course $Course;
  257.         return $this;
  258.     }
  259. }