<?php
namespace App\Entity\Forum;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use App\Traits\CreatedUpdatedTrait;
use Gedmo\Mapping\Annotation as Gedmo;
use JMS\Serializer\Annotation\Exclude;
use JMS\Serializer\Annotation as JMS;
use JMS\Serializer\Annotation as Serializer;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Table(name="v_forum_group")
* @ORM\Entity(repositoryClass="App\Repository\Forum\GroupRepository")
* @Vich\Uploadable
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false)
*/
class Group
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @var string
* @Gedmo\Slug(fields={"name"}, updatable=false)
* @ORM\Column(type="string", length=255)
*/
private $slug;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $disclaimers;
/**
* @ORM\Column(type="boolean")
*/
private $suggested = false;
/**
* @ORM\Column(type="boolean")
*/
private $enabled = true;
/**
* @ORM\Column(name="deleted_at", type="datetime", nullable=true)
*/
private $deletedAt;
/**
* NOTE: This is not a mapped field of entity metadata, just a simple property.
*
* @Vich\UploadableField(mapping="forum_files", fileNameProperty="image")
*
* @var File
* @Exclude
*/
private $imageFile;
/**
* @ORM\Column(name="image", type="string", length=255, nullable=true)
*
* @var string
*/
private $image;
use CreatedUpdatedTrait;
public function __toString()
{
return (string) $this->name;
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return mixed
*/
public function getName()
{
return $this->name;
}
/**
* @param mixed $name
*/
public function setName($name): void
{
$this->name = $name;
}
/**
* @return string
*/
public function getSlug(): string
{
return $this->slug;
}
/**
* @param string $slug
*/
public function setSlug(string $slug): void
{
$this->slug = $slug;
}
/**
* @return mixed
*/
public function getDescription()
{
return $this->description;
}
/**
* @param mixed $description
*/
public function setDescription($description): void
{
$this->description = $description;
}
/**
* @return mixed
*/
public function getDisclaimers()
{
return $this->disclaimers;
}
/**
* @param mixed $disclaimers
*/
public function setDisclaimers($disclaimers): void
{
$this->disclaimers = $disclaimers;
}
/**
* @return bool
*/
public function isSuggested(): ?bool
{
return $this->suggested;
}
/**
* @param bool $suggested
*/
public function setSuggested(?bool $suggested): void
{
$this->suggested = $suggested;
}
/**
* @return bool
*/
public function isEnabled(): ?bool
{
return $this->enabled;
}
/**
* @param bool $enabled
*/
public function setEnabled(?bool $enabled): void
{
$this->enabled = $enabled;
}
/**
* @return mixed
*/
public function getDeletedAt()
{
return $this->deletedAt;
}
/**
* @param mixed $deletedAt
*/
public function setDeletedAt($deletedAt): void
{
$this->deletedAt = $deletedAt;
}
/**
* If manually uploading a file (i.e. not using Symfony Form) ensure an instance
* of 'UploadedFile' is injected into this setter to trigger the update. If this
* bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
* must be able to accept an instance of 'File' as the bundle will inject one here
* during Doctrine hydration.
*
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $file
*/
public function setImageFile(File $file = null)
{
$this->imageFile = $file;
if ($file) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->updated = new \DateTime('now');
}
}
/**
* @return File
*/
public function getImageFile()
{
return $this->imageFile;
}
/**
* @param string $image
*/
public function setImage($image)
{
$this->image = $image;
}
/**
* @return string
*/
public function getImage()
{
return $this->image;
}
}