| Current Path : /var/www/v3.cesa.co.za/src/SessionsBundle/Entity/ |
| Current File : /var/www/v3.cesa.co.za/src/SessionsBundle/Entity/Sites.php |
<?php
namespace App\SessionsBundle\Entity;
use App\ContentBundle\Entity\Content;
use App\UserBundle\Entity\UserList;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* Sites
*
* @ORM\Table(name="sites")
* @ORM\Entity(repositoryClass="App\SessionsBundle\Repository\SitesRepository")
* @ORM\HasLifecycleCallbacks
*/
class Sites
{
/**
* @ORM\Id
* @ORM\Column(type="string", unique=true)
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator")
*/
private ?string $id = null;
/**
* @ORM\Column(type="string", length=255)
*/
private ?string $site_host_name = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $site_name = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $site_e_mail = null;
/**
* @ORM\Column(type="string", length=255)
*/
private ?string $server_ip = null;
/**
* @ORM\Column(type="integer")
*/
private ?int $site_port = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $template_id = null;
/**
* @ORM\Column(type="integer", options={"default": 0})
*/
private ?int $session_count = null;
/**
* @ORM\Column(type="boolean", options={"default": false})
*/
private ?bool $build_site_map = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $created_by = null;
/**
* @ORM\Column(type="datetime")
*/
private ?\DateTimeInterface $created_at = null;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private ?\DateTimeInterface $updated_at = null;
/**
* @ORM\OneToMany(targetEntity="Sessions", mappedBy="sites")
*/
private Collection $sessions;
/**
* @ORM\OneToMany(targetEntity="App\UserBundle\Entity\UserList", mappedBy="site")
*/
private Collection $user_list;
public function __construct()
{
$this->sessions = new ArrayCollection();
$this->user_list = new ArrayCollection();
}
public function getId(): ?string
{
return $this->id;
}
public function getSiteHostName(): ?string
{
return $this->site_host_name;
}
public function setSiteHostName(string $site_host_name): static
{
$this->site_host_name = $site_host_name;
return $this;
}
public function getSiteName(): ?string
{
return $this->site_name;
}
public function setSiteName(?string $site_name): static
{
$this->site_name = $site_name;
return $this;
}
public function getSiteEMail(): ?string
{
return $this->site_e_mail;
}
public function setSiteEMail(?string $site_e_mail): static
{
$this->site_e_mail = $site_e_mail;
return $this;
}
public function getServerIp(): ?string
{
return $this->server_ip;
}
public function setServerIp(string $server_ip): static
{
$this->server_ip = $server_ip;
return $this;
}
public function getSitePort(): ?int
{
return $this->site_port;
}
public function setSitePort(int $site_port): static
{
$this->site_port = $site_port;
return $this;
}
public function getTemplateId(): ?string
{
return $this->template_id;
}
public function setTemplateId(?string $template_id): static
{
$this->template_id = $template_id;
return $this;
}
public function getSessionCount(): ?int
{
return $this->session_count;
}
public function setSessionCount(int $session_count): static
{
$this->session_count = $session_count;
return $this;
}
public function isBuildSiteMap(): ?bool
{
return $this->build_site_map;
}
public function setBuildSiteMap(bool $build_site_map): static
{
$this->build_site_map = $build_site_map;
return $this;
}
public function getCreatedBy(): ?string
{
return $this->created_by;
}
public function setCreatedBy(?string $created_by): static
{
$this->created_by = $created_by;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeInterface $created_at): static
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updated_at;
}
public function setUpdatedAt(?\DateTimeInterface $updated_at): static
{
$this->updated_at = $updated_at;
return $this;
}
/**
* @return Collection<int, Sessions>
*/
public function getSessions(): Collection
{
return $this->sessions;
}
public function addSession(Sessions $session): static
{
if (!$this->sessions->contains($session)) {
$this->sessions->add($session);
$session->setSites($this);
}
return $this;
}
public function removeSession(Sessions $session): static
{
if ($this->sessions->removeElement($session)) {
// set the owning side to null (unless already changed)
if ($session->getSites() === $this) {
$session->setSites(null);
}
}
return $this;
}
/**
* @return Collection<int, UserList>
*/
public function getUserList(): Collection
{
return $this->user_list;
}
public function addUserList(UserList $userList): static
{
if (!$this->user_list->contains($userList)) {
$this->user_list->add($userList);
$userList->setSite($this);
}
return $this;
}
public function removeUserList(UserList $userList): static
{
if ($this->user_list->removeElement($userList)) {
// set the owning side to null (unless already changed)
if ($userList->getSite() === $this) {
$userList->setSite(null);
}
}
return $this;
}
/**
* @ORM\PrePersist
*/
public function setCreatedAtValue()
{
if (!$this->getCreatedAt()) {
$this->created_at = new \DateTime();
}
$this->updated_at = new \DateTime();
}
/**
* @ORM\PreUpdate
*/
public function setUpdatedAtValue()
{
$this->updated_at = new \DateTime();
}
public function __toString()
{
return $this->getSiteName() . ' - ' . $this->getSiteHostName();
}
}