1 | <?php |
||
2 | |||
3 | namespace Doctrine\Tests\Models\Cache; |
||
4 | use Doctrine\Common\Collections\ArrayCollection; |
||
5 | |||
6 | /** |
||
7 | * @Entity |
||
8 | * @Cache("READ_ONLY") |
||
9 | * @Table("cache_token") |
||
10 | */ |
||
11 | class Token |
||
12 | { |
||
13 | /** |
||
14 | * @Id |
||
15 | * @Column(type="string") |
||
16 | */ |
||
17 | public $token; |
||
18 | |||
19 | /** |
||
20 | * @Column(type="date") |
||
21 | */ |
||
22 | public $expiresAt; |
||
23 | |||
24 | /** |
||
25 | * @OneToOne(targetEntity="Client") |
||
26 | */ |
||
27 | public $client; |
||
28 | |||
29 | /** |
||
30 | * @OneToMany(targetEntity="Login", cascade={"persist", "remove"}, mappedBy="token") |
||
31 | * @var array |
||
32 | */ |
||
33 | public $logins; |
||
34 | |||
35 | /** |
||
36 | * @ManyToOne(targetEntity="Action", cascade={"persist", "remove"}, inversedBy="tokens") |
||
37 | * @JoinColumn(name="action_name", referencedColumnName="name") |
||
38 | * @var array |
||
39 | */ |
||
40 | public $action; |
||
41 | |||
42 | /** |
||
43 | * @ManyToOne(targetEntity="ComplexAction", cascade={"persist", "remove"}, inversedBy="tokens") |
||
44 | * @JoinColumns({ |
||
45 | * @JoinColumn(name="complex_action1_name", referencedColumnName="action1_name"), |
||
46 | * @JoinColumn(name="complex_action2_name", referencedColumnName="action2_name") |
||
47 | * }) |
||
48 | * @var ComplexAction |
||
49 | */ |
||
50 | public $complexAction; |
||
51 | |||
52 | public function __construct($token, Client $client = null) |
||
53 | { |
||
54 | $this->logins = new ArrayCollection(); |
||
0 ignored issues
–
show
|
|||
55 | $this->token = $token; |
||
56 | $this->client = $client; |
||
57 | $this->expiresAt = new \DateTime(date('Y-m-d H:i:s', strtotime("+7 day"))); |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @param Login $login |
||
62 | */ |
||
63 | public function addLogin(Login $login) |
||
64 | { |
||
65 | $this->logins[] = $login; |
||
66 | $login->token = $this; |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * @return Client |
||
71 | */ |
||
72 | public function getClient() |
||
73 | { |
||
74 | return $this->client; |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * @return Action |
||
79 | */ |
||
80 | public function getAction() |
||
81 | { |
||
82 | return $this->action; |
||
0 ignored issues
–
show
|
|||
83 | } |
||
84 | |||
85 | /** |
||
86 | * @return ComplexAction |
||
87 | */ |
||
88 | public function getComplexAction() |
||
89 | { |
||
90 | return $this->complexAction; |
||
91 | } |
||
92 | |||
93 | } |
||
94 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..