Files
thetool/application/ProductNetwork/ProductNetwork.php
2025-01-24 15:04:24 +01:00

58 lines
1.1 KiB
PHP

<?php
class ProductNetwork extends mfBaseModel {
private $product;
private $network;
protected function beforeUpdate($data) {
if(!array_key_exists("edit_by", $data)) {
$me = new User();
$me->loadMe();
$data["edit_by"] = $me->id;
}
return $data;
}
public function getProperty($name) {
if($this->$name == null) {
if(!$this->id) {
return null;
}
$classname = ucfirst($name);
$idfield = $name."_id";
$this->$name = new $classname($this->$idfield);
if($this->$name->id) {
return $this->$name;
} else {
return null;
}
}
return $this->$name;
}
public function __clone() {
$me = new User;
$me->loadMe();
$old_id = $this->id;
$this->id = null;
// cleanup data
$this->create_by = $me->id;
$this->edit_by = $me->id;
$this->create = null;
$this->edit = null;
$this->saved = 0;
$this->mode = "new";
$this->_old_data = new StdClass();
$this->log->debug("Cloned ProductNetwork $old_id");
}
}