File tree Expand file tree Collapse file tree 3 files changed +22
-11
lines changed Expand file tree Collapse file tree 3 files changed +22
-11
lines changed Original file line number Diff line number Diff line change 3
3
namespace RestJS \Api \Category ;
4
4
5
5
use Doctrine \ORM \Mapping as ORM ;
6
- use RestJS \Trait \GetterAndSetter ;
6
+ use RestJS \Class \GetterAndSetter ;
7
7
8
8
#[ORM \Entity]
9
9
#[ORM \Table('category ' )]
10
- class Category {
11
-
12
- // Trait Getter and Setter
13
- use GetterAndSetter;
10
+ class Category extends GetterAndSetter {
14
11
15
12
#[ORM \Id]
16
13
#[ORM \Column, ORM \GeneratedValue]
Original file line number Diff line number Diff line change 5
5
use Doctrine \ORM \Mapping as ORM ;
6
6
use Doctrine \ORM \Event as Event ;
7
7
use Firebase \JWT \JWT ;
8
- use RestJS \Trait \GetterAndSetter ;
8
+ use RestJS \Class \GetterAndSetter ;
9
9
10
10
#[ORM \Entity]
11
11
#[ORM \Table('user ' )]
12
12
#[ORM \HasLifecycleCallbacks]
13
- class User {
14
-
15
- // Trait Getter and Setter
16
- use GetterAndSetter;
13
+ class User extends GetterAndSetter {
17
14
18
15
#[ORM \Id]
19
16
#[ORM \Column, ORM \GeneratedValue]
@@ -26,7 +23,7 @@ class User {
26
23
public string $ username ;
27
24
28
25
#[ORM \Column]
29
- private string $ password ;
26
+ protected string $ password ;
30
27
31
28
#[ORM \Column(nullable: true )]
32
29
public string $ image ;
Original file line number Diff line number Diff line change
1
+ <?php
2
+ declare (strict_types=1 );
3
+ namespace RestJS \Class ;
4
+
5
+ /** Getter and Setter Functions */
6
+ class GetterAndSetter {
7
+
8
+ /** Get Value by Column */
9
+ public function __get ($ key ) {
10
+ return $ this ->$ key ;
11
+ }
12
+
13
+ /** Set Value by Column */
14
+ public function __set ($ key , $ value ) {
15
+ $ this ->$ key = $ value ;
16
+ }
17
+ }
You can’t perform that action at this time.
0 commit comments