nineskeletor/src/Entity/Blogtype.php

181 lines
3.6 KiB
PHP

<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* Blogtype.
*
* @ORM\Table(name="blogtype")
* @ORM\Entity(repositoryClass="App\Repository\BlogtypeRepository")
*/
class Blogtype
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string")
*/
private $name;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="string")
*/
private $sortby;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $image;
/**
* @ORM\OneToMany(targetEntity="Blog", mappedBy="blogtype", cascade={"persist"}, orphanRemoval=false)
*/
private $blogs;
/**
* @ORM\OneToMany(targetEntity="Menuchild", mappedBy="blogtype", cascade={"persist"}, orphanRemoval=true)
*/
private $menuchilds;
public function setId(int $id): self
{
$this->id = $id;
return $this;
}
public function __construct()
{
$this->blogs = new ArrayCollection();
$this->menuchilds = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSortby(): ?string
{
return $this->sortby;
}
public function setSortby(string $sortby): self
{
$this->sortby = $sortby;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): self
{
$this->image = $image;
return $this;
}
/**
* @return Collection<int, Blog>
*/
public function getBlogs(): Collection
{
return $this->blogs;
}
public function addBlog(Blog $blog): self
{
if (!$this->blogs->contains($blog)) {
$this->blogs->add($blog);
$blog->setBlogtype($this);
}
return $this;
}
public function removeBlog(Blog $blog): self
{
if ($this->blogs->removeElement($blog)) {
// set the owning side to null (unless already changed)
if ($blog->getBlogtype() === $this) {
$blog->setBlogtype(null);
}
}
return $this;
}
/**
* @return Collection<int, Menuchild>
*/
public function getMenuchilds(): Collection
{
return $this->menuchilds;
}
public function addMenuchild(Menuchild $menuchild): self
{
if (!$this->menuchilds->contains($menuchild)) {
$this->menuchilds->add($menuchild);
$menuchild->setBlogtype($this);
}
return $this;
}
public function removeMenuchild(Menuchild $menuchild): self
{
if ($this->menuchilds->removeElement($menuchild)) {
// set the owning side to null (unless already changed)
if ($menuchild->getBlogtype() === $this) {
$menuchild->setBlogtype(null);
}
}
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
}