<?php
namespace App\Entity;
use DateTime;
use DateTimeInterface;
use Doctrine\ORM\Mapping as ORM;
use function date_format;
/**
* UserComments
*
* @ORM\Table(
* name="user_comments",
* indexes={
* @ORM\Index(name="comment", columns={"comment"}),
* @ORM\Index(name="ip_address", columns={"ip_address"}),
* @ORM\Index(name="user_name", columns={"user_name","ip_address"})
* }
* )
* @ORM\Entity
*/
class UserComments
{
/**
* @var int
*
* @ORM\Column(type="integer", name="id", options={"comment":"Id of the comment."})
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private int $id;
/**
* @var int
*
* @ORM\Column(type="integer", name="hymn_id", options={"comment":"Id of the hymn that the comment is about."})
*/
private int $hymnId;
/**
* @var DateTime
*
* @ORM\Column(
* type="datetime",
* nullable=false,
* name="comment_date",
* options={"comment":"The date and time the comment was made."}
* )
*/
private DateTime $commentDate;
/**
* @var int
*
* @ORM\Column(type="integer", name="user_id", options={"comment":"Id of the user that made the comment."})
*/
private int $userId;
/**
* @var string|null
*
* @ORM\Column(
* type="string",
* length=50,
* nullable=true,
* name="user_name",
* options={"comment":"User name of person making the comment."}
* )
*/
private ?string $userName;
/**
* @var string
*
* @ORM\Column(
* type="string",
* length=16,
* nullable=false,
* name="ip_address",
* options={"comment":"The IP that the user made the comment from."}
* )
*/
private string $ipAddress;
/**
* @var string
*
* @ORM\Column(
* type="text",
* length=65535,
* nullable=false,
* name="comment",
* options={"comment":"The comment for the hymn."}
* )
*/
private string $comment;
/**
* @var string
*
* @ORM\Column(type="string", length=250, nullable=false, name="Referring_URL")
*/
private string $referringUrl;
/**
* @var string
*
* @ORM\Column(type="string", length=500, nullable=false, name="HTTP_Agent")
*/
private string $httpAgent;
/**
* @var string
*
* @ORM\Column(type="string", length=250, nullable=false, name="email", options={"comment":"User's email address"})
*/
private string $email;
/**
* @var string
*/
private string $strCommentDate;
/**
* @return string
*/
public function getStrCommentDate(): string
{
return $this->strCommentDate;
}
/**
* @param DateTimeInterface $cDate
*/
public function setStrCommentDate(DateTimeInterface $cDate): void
{
$this->strCommentDate = date_format($cDate, 'M d, Y');
}
/**
* @return int|null
*/
public function getHymnId(): ?int
{
return $this->hymnId;
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $hymnId
*/
public function setHymnId(int $hymnId): void
{
$this->hymnId = $hymnId;
}
/**
* @param DateTime $commentDate
*/
public function setCommentDate(DateTime $commentDate): void
{
$this->commentDate = $commentDate;
}
/**
* @return DateTimeInterface|null
*/
public function getCommentDate(): ?DateTimeInterface
{
return $this->commentDate;
}
/**
* @return string|null
*/
public function getUserName(): ?string
{
return $this->userName;
}
/**
* @param string|null $userName
*
* @return $this
*/
public function setUserName(?string $userName): self
{
$this->userName = $userName;
return $this;
}
/**
* @return string|null
*/
public function getIpAddress(): ?string
{
return $this->ipAddress;
}
/**
* @param string $ipAddress
*
* @return $this
*/
public function setIpAddress(string $ipAddress): self
{
$this->ipAddress = $ipAddress;
return $this;
}
/**
* @return string|null
*/
public function getComment(): ?string
{
return $this->comment;
}
/**
* @param string $comment
*
* @return $this
*/
public function setComment(string $comment): self
{
$this->comment = $comment;
return $this;
}
/**
* @return string|null
*/
public function getReferringUrl(): ?string
{
return $this->referringUrl;
}
/**
* @param string $referringUrl
*
* @return $this
*/
public function setReferringUrl(string $referringUrl): self
{
$this->referringUrl = $referringUrl;
return $this;
}
/**
* @return string|null
*/
public function getHttpAgent(): ?string
{
return $this->httpAgent;
}
/**
* @param string $httpAgent
*
* @return $this
*/
public function setHttpAgent(string $httpAgent): self
{
$this->httpAgent = $httpAgent;
return $this;
}
/**
* @return string|null
*/
public function getEmail(): ?string
{
return $this->email;
}
/**
* @param string $email
*
* @return $this
*/
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
/**
* @return string
*/
public function __toString()
{
return (string) $this->getUserName();
}
/**
* @return int
*/
public function getUserId(): int
{
return $this->userId;
}
/**
* @param int $userId
* @return UserComments
*/
public function setUserId( int $userId ): self
{
$this->userId = $userId;
return $this;
}
}