3
3
namespace App \Entity ;
4
4
5
5
use App \Repository \LinkPhpRepository ;
6
+ use Doctrine \Common \Collections \ArrayCollection ;
7
+ use Doctrine \Common \Collections \Collection ;
8
+ use Doctrine \DBAL \Types \Types ;
6
9
use Doctrine \ORM \Mapping as ORM ;
7
10
8
11
#[ORM \Entity(repositoryClass: LinkPhpRepository::class)]
9
12
class LinkPhp
10
13
{
11
14
#[ORM \Id]
12
15
#[ORM \GeneratedValue]
13
- #[ORM \Column]
16
+ #[ORM \Column(
17
+ type: Types::INTEGER ,
18
+ options: ['unsigned ' => true ]
19
+ )]
14
20
private ?int $ id = null ;
15
21
16
22
#[ORM \Column(length: 150 )]
@@ -22,6 +28,17 @@ class LinkPhp
22
28
#[ORM \Column(length: 255 )]
23
29
private ?string $ Url = null ;
24
30
31
+ /**
32
+ * @var Collection<int, PhpFunction>
33
+ */
34
+ #[ORM \ManyToMany(targetEntity: PhpFunction::class, mappedBy: 'Link ' )]
35
+ private Collection $ phpFunctions ;
36
+
37
+ public function __construct ()
38
+ {
39
+ $ this ->phpFunctions = new ArrayCollection ();
40
+ }
41
+
25
42
public function getId (): ?int
26
43
{
27
44
return $ this ->id ;
@@ -62,4 +79,31 @@ public function setUrl(string $Url): static
62
79
63
80
return $ this ;
64
81
}
82
+
83
+ /**
84
+ * @return Collection<int, PhpFunction>
85
+ */
86
+ public function getPhpFunctions (): Collection
87
+ {
88
+ return $ this ->phpFunctions ;
89
+ }
90
+
91
+ public function addPhpFunction (PhpFunction $ phpFunction ): static
92
+ {
93
+ if (!$ this ->phpFunctions ->contains ($ phpFunction )) {
94
+ $ this ->phpFunctions ->add ($ phpFunction );
95
+ $ phpFunction ->addLink ($ this );
96
+ }
97
+
98
+ return $ this ;
99
+ }
100
+
101
+ public function removePhpFunction (PhpFunction $ phpFunction ): static
102
+ {
103
+ if ($ this ->phpFunctions ->removeElement ($ phpFunction )) {
104
+ $ phpFunction ->removeLink ($ this );
105
+ }
106
+
107
+ return $ this ;
108
+ }
65
109
}
0 commit comments