This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of Jitamin. |
||
5 | * |
||
6 | * Copyright (C) Jitamin Team |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace Jitamin\Model; |
||
13 | |||
14 | use Jitamin\Foundation\Database\Model; |
||
15 | use PicoDb\Database; |
||
16 | |||
17 | /** |
||
18 | * Subtask Model. |
||
19 | */ |
||
20 | class SubtaskModel extends Model |
||
21 | { |
||
22 | /** |
||
23 | * SQL table name. |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | const TABLE = 'subtasks'; |
||
28 | |||
29 | /** |
||
30 | * Subtask status. |
||
31 | * |
||
32 | * @var int |
||
33 | */ |
||
34 | const STATUS_TODO = 0; |
||
35 | const STATUS_INPROGRESS = 1; |
||
36 | const STATUS_DONE = 2; |
||
37 | |||
38 | /** |
||
39 | * Events. |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | const EVENT_UPDATE = 'subtask.update'; |
||
44 | const EVENT_CREATE = 'subtask.create'; |
||
45 | const EVENT_DELETE = 'subtask.delete'; |
||
46 | |||
47 | /** |
||
48 | * Get projectId from subtaskId. |
||
49 | * |
||
50 | * @param int $subtask_id |
||
51 | * |
||
52 | * @return int |
||
53 | */ |
||
54 | public function getProjectId($subtask_id) |
||
55 | { |
||
56 | return $this->db |
||
0 ignored issues
–
show
|
|||
57 | ->table(self::TABLE) |
||
58 | ->eq(self::TABLE.'.id', $subtask_id) |
||
59 | ->join(TaskModel::TABLE, 'id', 'task_id') |
||
60 | ->findOneColumn(TaskModel::TABLE.'.project_id') ?: 0; |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Get available status. |
||
65 | * |
||
66 | * @return string[] |
||
67 | */ |
||
68 | View Code Duplication | public function getStatusList() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
69 | { |
||
70 | return [ |
||
71 | self::STATUS_TODO => t('Todo'), |
||
72 | self::STATUS_INPROGRESS => t('In progress'), |
||
73 | self::STATUS_DONE => t('Done'), |
||
74 | ]; |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * Get the query to fetch subtasks assigned to a user. |
||
79 | * |
||
80 | * @param int $user_id User id |
||
81 | * @param array $status List of status |
||
82 | * |
||
83 | * @return \PicoDb\Table |
||
84 | */ |
||
85 | public function getUserQuery($user_id, array $status) |
||
86 | { |
||
87 | return $this->db->table(self::TABLE) |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
88 | ->columns( |
||
89 | self::TABLE.'.*', |
||
90 | TaskModel::TABLE.'.project_id', |
||
91 | TaskModel::TABLE.'.color_id', |
||
92 | TaskModel::TABLE.'.title AS task_name', |
||
93 | ProjectModel::TABLE.'.name AS project_name' |
||
94 | ) |
||
95 | ->subquery($this->subtaskTimeTrackingModel->getTimerQuery($user_id), 'timer_start_date') |
||
0 ignored issues
–
show
The property
subtaskTimeTrackingModel does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
96 | ->eq('user_id', $user_id) |
||
97 | ->eq(ProjectModel::TABLE.'.is_active', ProjectModel::ACTIVE) |
||
98 | ->in(self::TABLE.'.status', $status) |
||
99 | ->join(TaskModel::TABLE, 'id', 'task_id') |
||
100 | ->join(ProjectModel::TABLE, 'id', 'project_id', TaskModel::TABLE) |
||
101 | ->callback([$this, 'addStatusName']); |
||
102 | } |
||
103 | |||
104 | /** |
||
105 | * Get all subtasks for a given task. |
||
106 | * |
||
107 | * @param int $task_id Task id |
||
108 | * |
||
109 | * @return array |
||
110 | */ |
||
111 | public function getAll($task_id) |
||
112 | { |
||
113 | return $this->db |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
114 | ->table(self::TABLE) |
||
115 | ->eq('task_id', $task_id) |
||
116 | ->columns( |
||
117 | self::TABLE.'.*', |
||
118 | UserModel::TABLE.'.username', |
||
119 | UserModel::TABLE.'.name' |
||
120 | ) |
||
121 | ->subquery($this->subtaskTimeTrackingModel->getTimerQuery($this->userSession->getId()), 'timer_start_date') |
||
0 ignored issues
–
show
The property
subtaskTimeTrackingModel does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() The property
userSession does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
122 | ->join(UserModel::TABLE, 'id', 'user_id') |
||
123 | ->asc(self::TABLE.'.position') |
||
124 | ->callback([$this, 'addStatusName']) |
||
125 | ->findAll(); |
||
126 | } |
||
127 | |||
128 | /** |
||
129 | * Get a subtask by the id. |
||
130 | * |
||
131 | * @param int $subtask_id Subtask id |
||
132 | * @param bool $more Fetch more data |
||
133 | * |
||
134 | * @return array |
||
135 | */ |
||
136 | public function getById($subtask_id, $more = false) |
||
137 | { |
||
138 | if ($more) { |
||
139 | return $this->db |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
140 | ->table(self::TABLE) |
||
141 | ->eq(self::TABLE.'.id', $subtask_id) |
||
142 | ->columns(self::TABLE.'.*', UserModel::TABLE.'.username', UserModel::TABLE.'.name') |
||
143 | ->subquery($this->subtaskTimeTrackingModel->getTimerQuery($this->userSession->getId()), 'timer_start_date') |
||
0 ignored issues
–
show
The property
subtaskTimeTrackingModel does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() The property
userSession does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
144 | ->join(UserModel::TABLE, 'id', 'user_id') |
||
145 | ->callback([$this, 'addStatusName']) |
||
146 | ->findOne(); |
||
147 | } |
||
148 | |||
149 | return $this->db->table(self::TABLE)->eq('id', $subtask_id)->findOne(); |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
150 | } |
||
151 | |||
152 | /** |
||
153 | * Get the position of the last column for a given project. |
||
154 | * |
||
155 | * @param int $task_id Task id |
||
156 | * |
||
157 | * @return int |
||
158 | */ |
||
159 | public function getLastPosition($task_id) |
||
160 | { |
||
161 | return (int) $this->db |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
162 | ->table(self::TABLE) |
||
163 | ->eq('task_id', $task_id) |
||
164 | ->desc('position') |
||
165 | ->findOneColumn('position'); |
||
166 | } |
||
167 | |||
168 | /** |
||
169 | * Create a new subtask. |
||
170 | * |
||
171 | * @param array $values Form values |
||
172 | * |
||
173 | * @return bool|int |
||
174 | */ |
||
175 | public function create(array $values) |
||
176 | { |
||
177 | $this->prepareCreation($values); |
||
178 | $subtask_id = $this->db->table(self::TABLE)->persist($values); |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
179 | |||
180 | if ($subtask_id !== false) { |
||
181 | $this->subtaskTimeTrackingModel->updateTaskTimeTracking($values['task_id']); |
||
0 ignored issues
–
show
The property
subtaskTimeTrackingModel does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
182 | $this->queueManager->push($this->subtaskEventJob->withParams($subtask_id, self::EVENT_CREATE)); |
||
0 ignored issues
–
show
The property
queueManager does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() The property
subtaskEventJob does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
183 | } |
||
184 | |||
185 | return $subtask_id; |
||
186 | } |
||
187 | |||
188 | /** |
||
189 | * Update. |
||
190 | * |
||
191 | * @param array $values |
||
192 | * @param bool $fire_event |
||
193 | * |
||
194 | * @return bool |
||
195 | */ |
||
196 | public function update(array $values, $fire_event = true) |
||
197 | { |
||
198 | $this->prepare($values); |
||
199 | $result = $this->db->table(self::TABLE)->eq('id', $values['id'])->save($values); |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
200 | |||
201 | if ($result) { |
||
202 | $this->subtaskTimeTrackingModel->updateTaskTimeTracking($values['task_id']); |
||
0 ignored issues
–
show
The property
subtaskTimeTrackingModel does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
203 | |||
204 | if ($fire_event) { |
||
205 | $this->queueManager->push($this->subtaskEventJob->withParams($values['id'], self::EVENT_UPDATE, $values)); |
||
0 ignored issues
–
show
The property
queueManager does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() The property
subtaskEventJob does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
206 | } |
||
207 | } |
||
208 | |||
209 | return $result; |
||
210 | } |
||
211 | |||
212 | /** |
||
213 | * Remove. |
||
214 | * |
||
215 | * @param int $subtask_id Subtask id |
||
216 | * |
||
217 | * @return bool |
||
218 | */ |
||
219 | public function remove($subtask_id) |
||
220 | { |
||
221 | $this->subtaskEventJob->execute($subtask_id, self::EVENT_DELETE); |
||
0 ignored issues
–
show
The property
subtaskEventJob does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
222 | |||
223 | return $this->db->table(self::TABLE)->eq('id', $subtask_id)->remove(); |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
224 | } |
||
225 | |||
226 | /** |
||
227 | * Duplicate all subtasks to another task. |
||
228 | * |
||
229 | * @param int $src_task_id Source task id |
||
230 | * @param int $dst_task_id Destination task id |
||
231 | * |
||
232 | * @return bool |
||
233 | */ |
||
234 | public function duplicate($src_task_id, $dst_task_id) |
||
235 | { |
||
236 | return $this->db->transaction(function (Database $db) use ($src_task_id, $dst_task_id) { |
||
0 ignored issues
–
show
The property
db does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
237 | $subtasks = $db->table(SubtaskModel::TABLE) |
||
238 | ->columns('title', 'time_estimated', 'position') |
||
239 | ->eq('task_id', $src_task_id) |
||
240 | ->asc('position') |
||
241 | ->findAll(); |
||
242 | |||
243 | foreach ($subtasks as &$subtask) { |
||
244 | $subtask['task_id'] = $dst_task_id; |
||
245 | |||
246 | if (!$db->table(SubtaskModel::TABLE)->save($subtask)) { |
||
247 | return false; |
||
248 | } |
||
249 | } |
||
250 | }); |
||
251 | } |
||
252 | |||
253 | /** |
||
254 | * Prepare data before insert/update. |
||
255 | * |
||
256 | * @param array $values Form values |
||
257 | */ |
||
258 | protected function prepare(array &$values) |
||
259 | { |
||
260 | $this->helper->model->removeFields($values, ['another_subtask']); |
||
0 ignored issues
–
show
The property
helper does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
261 | $this->helper->model->resetFields($values, ['time_estimated', 'time_spent']); |
||
0 ignored issues
–
show
The property
helper does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
262 | $this->hook->reference('model:subtask:modification:prepare', $values); |
||
0 ignored issues
–
show
The property
hook does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
263 | } |
||
264 | |||
265 | /** |
||
266 | * Prepare data before insert. |
||
267 | * |
||
268 | * @param array $values Form values |
||
269 | */ |
||
270 | protected function prepareCreation(array &$values) |
||
271 | { |
||
272 | $this->prepare($values); |
||
273 | |||
274 | $values['position'] = $this->getLastPosition($values['task_id']) + 1; |
||
275 | $values['status'] = isset($values['status']) ? $values['status'] : self::STATUS_TODO; |
||
276 | $values['time_estimated'] = isset($values['time_estimated']) ? $values['time_estimated'] : 0; |
||
277 | $values['time_spent'] = isset($values['time_spent']) ? $values['time_spent'] : 0; |
||
278 | $values['user_id'] = isset($values['user_id']) ? $values['user_id'] : 0; |
||
279 | $this->hook->reference('model:subtask:creation:prepare', $values); |
||
0 ignored issues
–
show
The property
hook does not exist on object<Jitamin\Model\SubtaskModel> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
280 | } |
||
281 | |||
282 | /** |
||
283 | * Add subtask status status to the resultset. |
||
284 | * |
||
285 | * @param array $subtasks Subtasks |
||
286 | * |
||
287 | * @return array |
||
288 | */ |
||
289 | public function addStatusName(array $subtasks) |
||
290 | { |
||
291 | $status = $this->getStatusList(); |
||
292 | |||
293 | foreach ($subtasks as &$subtask) { |
||
294 | $subtask['status_name'] = $status[$subtask['status']]; |
||
295 | $subtask['timer_start_date'] = isset($subtask['timer_start_date']) ? $subtask['timer_start_date'] : 0; |
||
296 | $subtask['is_timer_started'] = !empty($subtask['timer_start_date']); |
||
297 | } |
||
298 | |||
299 | return $subtasks; |
||
300 | } |
||
301 | } |
||
302 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.