Total Complexity | 6 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
12 | trait RouteAwareTrait |
||
13 | { |
||
14 | /** |
||
15 | * @ORM\OneToMany(targetEntity="Silverback\ApiComponentBundle\Entity\Route\Route", mappedBy="content", cascade={"persist"}) |
||
16 | * @Groups({"default", "route_read"}) |
||
17 | * @var Collection|Route[] |
||
18 | */ |
||
19 | protected $routes; |
||
20 | |||
21 | /** |
||
22 | * @var bool |
||
23 | * @Groups({"default_write"}) |
||
24 | */ |
||
25 | private $regenerateRoute = false; |
||
26 | |||
27 | /** |
||
28 | * @param Route $route |
||
29 | * @return RouteAwareInterface|RouteAwareTrait |
||
30 | */ |
||
31 | public function addRoute(Route $route) |
||
32 | { |
||
33 | if ($this instanceof AbstractContent) { |
||
34 | $route->setContent($this); |
||
35 | } |
||
36 | $this->routes->add($route); |
||
37 | return $this; |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @param Route $route |
||
42 | * @return RouteAwareInterface|RouteAwareTrait |
||
43 | */ |
||
44 | public function removeRoute(Route $route) |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @return Collection|Route[] |
||
52 | */ |
||
53 | public function getRoutes(): Collection |
||
54 | { |
||
55 | return $this->routes; |
||
56 | } |
||
57 | |||
58 | public function setRegenerateRoute(bool $regenerateRoute) |
||
62 | } |
||
63 | |||
64 | public function getRegenerateRoute(): bool |
||
67 | } |
||
68 | } |
||
69 |