Add condition_id property to department_selfserve_conditions_o and update related methods, routes, and logic
This commit is contained in:
@@ -14,6 +14,7 @@ class department_selfserve_conditions_o extends db
|
||||
public object_property $department; // The department id
|
||||
public object_property $lane; // The lane id
|
||||
public object_property $product; // The product id
|
||||
public object_property $condition_id; // The condition id (optional)
|
||||
public object_property $name; // The condition name
|
||||
public object_property $description; // The task description
|
||||
public object_property $created_at;
|
||||
@@ -33,10 +34,11 @@ class department_selfserve_conditions_o extends db
|
||||
* @param int $product The product id
|
||||
* @param string $name The condition name
|
||||
* @param string $description The condition description
|
||||
* @param int|null $condition_id The condition id (optional)
|
||||
* @return department_selfserve_conditions_o
|
||||
* @throws Exception If the object was not created successfully
|
||||
*/
|
||||
public function add(int $department, int $lane, int $product, string $name, string $description): department_selfserve_conditions_o
|
||||
public function add(int $department, int $lane, int $product, string $name, string $description, int $condition_id = null): department_selfserve_conditions_o
|
||||
{
|
||||
global /** @var db $db */
|
||||
$db;
|
||||
@@ -46,6 +48,10 @@ class department_selfserve_conditions_o extends db
|
||||
$product = (int)$product;
|
||||
$name = $db->escape_string($name);
|
||||
$description = $db->escape_string($description);
|
||||
if (!is_null($condition_id)) {
|
||||
$condition_id = (int)$condition_id;
|
||||
}
|
||||
|
||||
// Add the object
|
||||
$tmp_id = self::add_object([
|
||||
'department' => $department,
|
||||
@@ -53,6 +59,7 @@ class department_selfserve_conditions_o extends db
|
||||
'product' => $product,
|
||||
'name' => $name,
|
||||
'description' => $description,
|
||||
...(!is_null($condition_id) ? ['condition_id' => $condition_id] : []),
|
||||
]);
|
||||
$this->id = $tmp_id;
|
||||
self::getObjectProperties();
|
||||
@@ -67,6 +74,7 @@ class department_selfserve_conditions_o extends db
|
||||
$this->department = new object_property($this->table, $this->id, 'department', 'int', false);
|
||||
$this->lane = new object_property($this->table, $this->id, 'lane', 'int', false);
|
||||
$this->product = new object_property($this->table, $this->id, 'product', 'int', false);
|
||||
$this->condition_id = new object_property($this->table, $this->id, 'condition_id', 'int', false);
|
||||
$this->name = new object_property($this->table, $this->id, 'name', 'string', false);
|
||||
$this->description = new object_property($this->table, $this->id, 'description', 'string', false);
|
||||
$this->created_at = new object_property($this->table, $this->id, 'created_at', 'timestamp', false);
|
||||
@@ -86,6 +94,7 @@ class department_selfserve_conditions_o extends db
|
||||
'department' => (int)$this->department->value(),
|
||||
'lane' => (int)$this->lane->value(),
|
||||
'product' => (int)$this->product->value(),
|
||||
'condition_id' => is_null($this->condition_id->value()) ? null : (int)$this->condition_id->value(),
|
||||
'name' => (string)$this->name->value(),
|
||||
'description' => (string)$this->description->value(),
|
||||
// Timestamps
|
||||
|
||||
Reference in New Issue
Block a user