<?php
namespace Entity; class SupplierContract extends \Entity\PartnerContractAbstract { protected $saveInsideTransaction = true; protected $partnerRefColumnName = 'idSupplier'; protected function setTableName(): void { global $DBTSuppliersContracts; $this->tableName = $DBTSuppliersContracts; } public function getFileStoragePath() { return FILEPATH_SUPPLIER_CONTRACTS; } protected function getAttribute($var) { switch ($var) { case 'supplier' : { return \Entity\Supplier::selectForUpdate($this->fields['idSupplier']); } default : { return parent::getAttribute($var); } } } protected function setAttribute($var, $value) { if ($this->operation != 'insert' and $this->operation != 'update') { throw new \Exception('You can use __set magic method only with insert/update operation in `'.__CLASS__.'` class.'); } switch ($var) { case 'idSupplier' : { $this->fields[$var] = $value; break; } default : { parent::setAttribute($var, $value); } } } protected function save_postProcess(Array $saveData) { $this->save_updateCache_addEntry('Supplier', \Entity\SupplierContract::select($this->id)->idSupplier); parent::save_postProcess($saveData); } }