1 | <?php |
||
9 | abstract class BaseJob extends Job |
||
10 | { |
||
11 | /** |
||
12 | * @Grid\Column() |
||
13 | * @ORM\Column(type="bigint") |
||
14 | * @ORM\Id |
||
15 | * @ORM\GeneratedValue(strategy="AUTO") |
||
16 | */ |
||
17 | protected $id; |
||
18 | |||
19 | /** |
||
20 | * @Grid\Column(sortable=true, searchable=true) |
||
21 | * @ORM\Column(type="string") |
||
22 | */ |
||
23 | protected $workerName; |
||
24 | |||
25 | /** |
||
26 | * @Grid\Column(sortable=true, searchable=true) |
||
27 | * @ORM\Column(type="string") |
||
28 | */ |
||
29 | protected $className; |
||
30 | |||
31 | /** |
||
32 | * @Grid\Column(sortable=true, searchable=true) |
||
33 | * @ORM\Column(type="string") |
||
34 | */ |
||
35 | protected $method; |
||
36 | |||
37 | /** |
||
38 | * @Grid\Column(sortable=true, searchable=true) |
||
39 | * @ORM\Column(type="string") |
||
40 | */ |
||
41 | protected $status; |
||
42 | |||
43 | /** |
||
44 | * @ORM\Column(type="text") |
||
45 | */ |
||
46 | protected $args; |
||
47 | |||
48 | /** |
||
49 | * @ORM\Column(type="boolean", nullable=true) |
||
50 | */ |
||
51 | protected $batch; |
||
52 | |||
53 | /** |
||
54 | * @Grid\Column(sortable=true, searchable=true) |
||
55 | * @ORM\Column(type="boolean", nullable=true) |
||
56 | */ |
||
57 | protected $locked; |
||
58 | |||
59 | /** |
||
60 | * @ORM\Column(type="datetime", nullable=true) |
||
61 | */ |
||
62 | protected $lockedAt; |
||
63 | |||
64 | /** |
||
65 | * @Grid\Column(sortable=true) |
||
66 | * @ORM\Column(type="integer", nullable=true) |
||
67 | */ |
||
68 | protected $priority; |
||
69 | |||
70 | /** |
||
71 | * @ORM\Column(type="string") |
||
72 | */ |
||
73 | protected $crcHash; |
||
74 | |||
75 | /** |
||
76 | * @Grid\Column(sortable=true) |
||
77 | * @ORM\Column(type="datetime", nullable=true) |
||
78 | */ |
||
79 | protected $whenAt; |
||
80 | |||
81 | /** |
||
82 | * @Grid\Column(sortable=true) |
||
83 | * @ORM\Column(type="datetime", nullable=true) |
||
84 | */ |
||
85 | protected $expiresAt; |
||
86 | |||
87 | /** |
||
88 | * When the job started. |
||
89 | * |
||
90 | * @Grid\Column(sortable=true) |
||
91 | * @ORM\Column(type="datetime", nullable=true) |
||
92 | */ |
||
93 | protected $startedAt; |
||
94 | |||
95 | /** |
||
96 | * When the job finished. |
||
97 | * |
||
98 | * @ORM\Column(type="datetime", nullable=true) |
||
99 | */ |
||
100 | protected $finishedAt; |
||
101 | |||
102 | /** |
||
103 | * @ORM\Column(type="float", nullable=true) |
||
104 | */ |
||
105 | protected $elapsed; |
||
106 | |||
107 | /** |
||
108 | * @ORM\Column(type="text", nullable=true) |
||
109 | */ |
||
110 | protected $message; |
||
111 | |||
112 | /** |
||
113 | * @ORM\Column(type="datetime") |
||
114 | */ |
||
115 | protected $createdAt; |
||
116 | |||
117 | /** |
||
118 | * @ORM\Column(type="datetime") |
||
119 | */ |
||
120 | protected $updatedAt; |
||
121 | |||
122 | /** |
||
123 | * @ORM\Column(type="integer", nullable=true) |
||
124 | */ |
||
125 | protected $maxDuration; |
||
126 | |||
127 | /** |
||
128 | * @ORM\Column(type="bigint", nullable=true) |
||
129 | */ |
||
130 | protected $runId; |
||
131 | |||
132 | /** |
||
133 | * @return mixed |
||
134 | */ |
||
135 | public function getRunId() |
||
139 | |||
140 | /** |
||
141 | * @param mixed $runId |
||
142 | */ |
||
143 | public function setRunId($runId) |
||
147 | |||
148 | public function setArgs($args) |
||
153 | |||
154 | public function getArgs() |
||
160 | } |
||
161 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: