2026-02-26 16:48:10 +07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models\Test;
|
|
|
|
|
|
|
|
|
|
use App\Models\BaseModel;
|
|
|
|
|
|
|
|
|
|
class TestMapDetailModel extends BaseModel {
|
|
|
|
|
protected $table = 'testmapdetail';
|
|
|
|
|
protected $primaryKey = 'TestMapDetailID';
|
|
|
|
|
protected $allowedFields = [
|
|
|
|
|
'TestMapID',
|
|
|
|
|
'HostTestCode',
|
|
|
|
|
'HostTestName',
|
|
|
|
|
'ConDefID',
|
|
|
|
|
'ClientTestCode',
|
|
|
|
|
'ClientTestName',
|
|
|
|
|
'CreateDate',
|
|
|
|
|
'EndDate'
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
protected $useTimestamps = true;
|
|
|
|
|
protected $createdField = 'CreateDate';
|
|
|
|
|
protected $updatedField = '';
|
|
|
|
|
protected $useSoftDeletes = true;
|
|
|
|
|
protected $deletedField = "EndDate";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get all details for a test map
|
|
|
|
|
*/
|
|
|
|
|
public function getDetailsByTestMap($testMapID) {
|
|
|
|
|
return $this->where('TestMapID', $testMapID)
|
|
|
|
|
->where('EndDate IS NULL')
|
|
|
|
|
->findAll();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get test map detail by host test code
|
|
|
|
|
*/
|
|
|
|
|
public function getDetailsByHostCode($hostTestCode) {
|
|
|
|
|
return $this->where('HostTestCode', $hostTestCode)
|
|
|
|
|
->where('EndDate IS NULL')
|
|
|
|
|
->findAll();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get test map detail by client test code
|
|
|
|
|
*/
|
|
|
|
|
public function getDetailsByClientCode($clientTestCode) {
|
|
|
|
|
return $this->where('ClientTestCode', $clientTestCode)
|
|
|
|
|
->where('EndDate IS NULL')
|
|
|
|
|
->findAll();
|
|
|
|
|
}
|
2026-03-10 16:40:37 +07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Disable all details for a test map
|
|
|
|
|
*
|
|
|
|
|
* @param int $testMapID
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function disableByTestMapID($testMapID)
|
|
|
|
|
{
|
|
|
|
|
$this->where('TestMapID', $testMapID)
|
|
|
|
|
->where('EndDate', null)
|
|
|
|
|
->set('EndDate', date('Y-m-d H:i:s'))
|
|
|
|
|
->update();
|
|
|
|
|
}
|
2026-02-26 16:48:10 +07:00
|
|
|
}
|