-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathWebsite.php
More file actions
80 lines (64 loc) · 1.66 KB
/
Copy pathWebsite.php
File metadata and controls
80 lines (64 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
namespace EasyCorp\Bundle\EasyAdminBundle\Tests\Functional\Apps\DefaultApp\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
#[ORM\Table(name: '`website`')]
class Website implements \Stringable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private ?int $id = null;
#[ORM\Column(type: 'string', length: 255)]
private ?string $name = null;
#[ORM\OneToMany(targetEntity: Page::class, mappedBy: 'website', orphanRemoval: true)]
private Collection $pages;
public function __construct()
{
$this->pages = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName($name): self
{
$this->name = $name;
return $this;
}
/**
* @return Collection|Page[]
*/
public function getPages(): Collection
{
return $this->pages;
}
public function addPage(Page $page): self
{
if (!$this->pages->contains($page)) {
$this->pages[] = $page;
$page->setWebsite($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->getWebsite() === $this) {
$page->setWebsite(null);
}
}
return $this;
}
public function __toString()
{
return $this->name;
}
}