src/Entity/Forum/Thread.php line 17
<?php
namespace App\Entity\Forum;
use App\Entity\Common\Owner;
use App\Entity\Traits\TrackerFields;
use App\Entity\Traits\UserCreatedInterface;
use App\Entity\Traits\UserUpdatedInterface;
use App\Model\Common\HaveOwnerInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'forum_thread')]
#[ORM\Entity(repositoryClass: 'App\Repository\Forum\ThreadRepository')]
#[ORM\HasLifecycleCallbacks]
class Thread implements UserCreatedInterface, UserUpdatedInterface, HaveOwnerInterface
{
use TrackerFields;
/**
* @var int|null
*/
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
#[ORM\Column(type: 'integer')]
private $id;
/**
* @var string|null
*/
#[ORM\Column(type: 'string')]
private $caption;
/**
* @var Owner
*/
#[ORM\Embedded(class: 'App\Entity\Common\Owner')]
private $owner;
/**
* @var Post|null
*/
#[ORM\ManyToOne(targetEntity: 'App\Entity\Forum\Post', cascade: ['persist'])]
#[ORM\JoinColumn(nullable: true)]
private $lastMessage;
/**
* @var Collection
*/
#[ORM\OneToMany(targetEntity: 'App\Entity\Forum\Post', mappedBy: 'thread')]
#[ORM\OrderBy(['created_at' => 'ASC'])]
private $messages;
public function __construct()
{
$this->owner = new Owner();
$this->messages = new ArrayCollection();
}
/**
* @return Owner
*/
public function getOwner(): Owner
{
return $this->owner;
}
/**
* @param Owner $owner
*/
public function setOwner(Owner $owner): void
{
$this->owner = $owner;
}
/**
* @return int|null
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @param int|null $id
*/
public function setId(?int $id): void
{
$this->id = $id;
}
/**
* @return string|null
*/
public function getCaption(): ?string
{
return $this->caption;
}
/**
* @param string|null $caption
*/
public function setCaption(?string $caption): void
{
$this->caption = $caption;
}
/**
* @return Post|null
*/
public function getLastMessage(): ?Post
{
return $this->lastMessage;
}
/**
* @param Post|null $lastMessage
*/
public function setLastMessage(?Post $lastMessage): void
{
$this->lastMessage = $lastMessage;
}
/**
* @return Collection
*/
public function getMessages(): Collection
{
return $this->messages;
}
/**
* @param Collection $messages
*/
public function setMessages(Collection $messages): void
{
$this->messages = $messages;
}
}