date-poll-api/src/Entity/Comment.php

87 lines
1.4 KiB
PHP
Raw Normal View History

2019-11-06 14:54:04 +01:00
<?php
namespace App\Entity;
2019-11-12 11:26:19 +01:00
use DateTimeInterface;
2019-11-06 14:54:04 +01:00
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\CommentRepository")
*/
class Comment {
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Owner", inversedBy="comments")
2019-11-06 14:54:04 +01:00
*/
private $owner;
/**
* @ORM\Column(type="text")
*/
private $text;
/**
* @ORM\Column(type="datetime")
*/
private $createdAt;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Poll", inversedBy="comments")
*/
private $poll;
2019-11-27 16:14:49 +01:00
function __construct() {
2019-11-27 16:39:52 +01:00
$this->setCreatedAt( new \DateTime() );
2019-11-27 16:14:49 +01:00
}
2019-11-06 14:54:04 +01:00
public function getId(): ?int {
return $this->id;
}
public function getOwner(): ?Owner {
return $this->owner;
}
public function setOwner( ?Owner $owner ): self {
$this->owner = $owner;
return $this;
}
public function getText(): ?string {
return $this->text;
}
public function setText( string $text ): self {
$this->text = $text;
return $this;
}
2019-11-12 11:26:19 +01:00
public function getCreatedAt(): ?DateTimeInterface {
2019-11-06 14:54:04 +01:00
return $this->createdAt;
}
2019-11-12 11:26:19 +01:00
public function setCreatedAt( DateTimeInterface $createdAt ): self {
2019-11-06 14:54:04 +01:00
$this->createdAt = $createdAt;
return $this;
}
public function getPoll(): ?Poll {
return $this->poll;
}
public function setPoll( ?Poll $poll ): self {
$this->poll = $poll;
return $this;
}
}