You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
248 lines
5.5 KiB
PHP
248 lines
5.5 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use DateTimeInterface;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
/**
|
|
* @ORM\Entity(repositoryClass="App\Repository\WishRepository")
|
|
*/
|
|
class Wish {
|
|
/**
|
|
* @ORM\Id()
|
|
* @ORM\GeneratedValue()
|
|
* @ORM\Column(type="integer")
|
|
*/
|
|
private $id;
|
|
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="App\Entity\TargetGroup", inversedBy="wishes")
|
|
* @ORM\JoinColumn(nullable=false)
|
|
*/
|
|
private $target;
|
|
|
|
/**
|
|
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="ownedWishes")
|
|
* @ORM\JoinColumn(nullable=false)
|
|
*/
|
|
private $owner;
|
|
|
|
/**
|
|
* @ORM\Column(type="datetime")
|
|
*/
|
|
private $date;
|
|
|
|
/**
|
|
* @ORM\Column(type="string", length=255)
|
|
*/
|
|
private $name;
|
|
|
|
/**
|
|
* @ORM\Column(type="text", nullable=true)
|
|
*/
|
|
private $description;
|
|
|
|
/**
|
|
* @ORM\Column(type="boolean")
|
|
*/
|
|
private $visible;
|
|
|
|
/**
|
|
* @ORM\Column(type="decimal", precision=11, scale=2, nullable=true)
|
|
*/
|
|
private $price_estimated;
|
|
|
|
/**
|
|
* @ORM\Column(type="decimal", precision=11, scale=2, nullable=true)
|
|
*/
|
|
private $price_real;
|
|
|
|
/**
|
|
* @ORM\Column(type="boolean")
|
|
*/
|
|
private $crowdfunding;
|
|
|
|
/**
|
|
* @ORM\Column(type="datetime", nullable=true)
|
|
*/
|
|
private $finished;
|
|
|
|
/**
|
|
* @ORM\OneToMany(targetEntity="App\Entity\Participant", mappedBy="wish", orphanRemoval=true)
|
|
*/
|
|
private $participants;
|
|
|
|
/**
|
|
* @ORM\OneToMany(targetEntity="App\Entity\Comment", mappedBy="wish", orphanRemoval=true)
|
|
*/
|
|
private $comments;
|
|
|
|
public function __construct () {
|
|
$this->participants = new ArrayCollection();
|
|
$this->comments = new ArrayCollection();
|
|
}
|
|
|
|
public function getId (): ?int {
|
|
return $this->id;
|
|
}
|
|
|
|
public function getTarget (): ?TargetGroup {
|
|
return $this->target;
|
|
}
|
|
|
|
public function setTarget (?TargetGroup $target): self {
|
|
$this->target = $target;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getOwner (): ?User {
|
|
return $this->owner;
|
|
}
|
|
|
|
public function setOwner (?User $owner): self {
|
|
$this->owner = $owner;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDate (): ?DateTimeInterface {
|
|
return $this->date;
|
|
}
|
|
|
|
public function setDate (DateTimeInterface $date): self {
|
|
$this->date = $date;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getName (): ?string {
|
|
return $this->name;
|
|
}
|
|
|
|
public function setName (string $name): self {
|
|
$this->name = $name;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDescription (): ?string {
|
|
return $this->description;
|
|
}
|
|
|
|
public function setDescription (?string $description): self {
|
|
$this->description = $description;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getVisible (): ?bool {
|
|
return $this->visible;
|
|
}
|
|
|
|
public function setVisible (bool $visible): self {
|
|
$this->visible = $visible;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getPriceEstimated (): ?string {
|
|
return $this->price_estimated;
|
|
}
|
|
|
|
public function setPriceEstimated (?string $price_estimated): self {
|
|
$this->price_estimated = $price_estimated;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getPriceReal (): ?string {
|
|
return $this->price_real;
|
|
}
|
|
|
|
public function setPriceReal (?string $price_real): self {
|
|
$this->price_real = $price_real;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCrowdfunding (): ?bool {
|
|
return $this->crowdfunding;
|
|
}
|
|
|
|
public function setCrowdfunding (bool $crowdfunding): self {
|
|
$this->crowdfunding = $crowdfunding;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getFinished (): ?DateTimeInterface {
|
|
return $this->finished;
|
|
}
|
|
|
|
public function setFinished (?DateTimeInterface $finished): self {
|
|
$this->finished = $finished;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection|Participant[]
|
|
*/
|
|
public function getParticipants (): Collection {
|
|
return $this->participants;
|
|
}
|
|
|
|
public function addParticipant (Participant $participant): self {
|
|
if (!$this->participants->contains($participant)) {
|
|
$this->participants[] = $participant;
|
|
$participant->setWish($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeParticipant (Participant $participant): self {
|
|
if ($this->participants->contains($participant)) {
|
|
$this->participants->removeElement($participant);
|
|
// set the owning side to null (unless already changed)
|
|
if ($participant->getWish() === $this) {
|
|
$participant->setWish(null);
|
|
}
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection|Comment[]
|
|
*/
|
|
public function getComments (): Collection {
|
|
return $this->comments;
|
|
}
|
|
|
|
public function addComment (Comment $comment): self {
|
|
if (!$this->comments->contains($comment)) {
|
|
$this->comments[] = $comment;
|
|
$comment->setWish($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeComment (Comment $comment): self {
|
|
if ($this->comments->contains($comment)) {
|
|
$this->comments->removeElement($comment);
|
|
// set the owning side to null (unless already changed)
|
|
if ($comment->getWish() === $this) {
|
|
$comment->setWish(null);
|
|
}
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
}
|