nineskeletor/src/Entity/Pagetype.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;
/**
* Pagetype.
*
* @ORM\Table(name="pagetype")
* @ORM\Entity(repositoryClass="App\Repository\PagetypeRepository")
*/
class Pagetype
{
/**
* @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="Page", mappedBy="pagetype", cascade={"persist"}, orphanRemoval=false)
*/
private $pages;
/**
* @ORM\OneToMany(targetEntity="Menuchild", mappedBy="pagetype", cascade={"persist"}, orphanRemoval=true)
*/
private $menuchilds;
public function setId(int $id): self
{
$this->id = $id;
return $this;
}
public function __construct()
{
$this->pages = 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, Page>
*/
public function getPages(): Collection
{
return $this->pages;
}
public function addPage(Page $page): self
{
if (!$this->pages->contains($page)) {
$this->pages->add($page);
$page->setPagetype($this);
}
return $this;
}
public function removePage(Page $page): self
{
if ($this->pages->removeElement($page)) {
// set the owning side to null (unless already changed)
if ($page->getPagetype() === $this) {
$page->setPagetype(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->setPagetype($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->getPagetype() === $this) {
$menuchild->setPagetype(null);
}
}
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
}