Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 50 |
SubjectSpecializationService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 7 |
156.00 | |
0.00% |
0 / 50 |
__construct | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 1 |
|||
__clone | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 1 |
|||
getInstance | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 4 |
|||
getAllSpecializations | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
deleteSpecializations | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
updateSpecializations | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getSpecialisationByStudentId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 18 |
<?php | |
namespace com\linways\core\ams\professional\service\examcontroller; | |
use com\linways\core\ams\professional\service\BaseService; | |
use com\linways\core\ams\professional\exception\ProfessionalException; | |
class SubjectSpecializationService extends BaseService | |
{ | |
private static $_instance = null; | |
private $mapper = []; | |
/// Condition 2 - Locked down the constructor | |
private function __construct() { | |
} | |
// Prevent any oustide instantiation of this class | |
/// Condition 3 - Prevent any object or instance of that class to be cloned | |
private function __clone() { | |
} | |
// Prevent any copy of this object | |
/// Condition 4 - Have a single globally accessible static method | |
public static function getInstance() { | |
if (! is_object ( self::$_instance )) // or if( is_null(self::$_instance) ) or if( self::$_instance == null ) | |
self::$_instance = new self (); | |
return self::$_instance; | |
} | |
/** | |
* Get Specialization | |
* @author anoop | |
*/ | |
public function getAllSpecializations () { | |
$sql = "SELECT id, specialisationName FROM specialisation_master"; | |
try { | |
$subjectSpecializations = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $subjectSpecializations; | |
} | |
/** | |
* Delete Specialization | |
* @author anoop | |
*/ | |
public function deleteSpecializations ($specilizationId) { | |
$sql = "DELETE FROM specialisation_master WHERE id = $specilizationId"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return true; | |
} | |
/** | |
* Update Specialization | |
* @author anoop | |
*/ | |
public function updateSpecializations ( $specilizationId, $specializationName ) { | |
$specilizationId = $this->realEscapeString ( $specilizationId ); | |
$specializationName = $this->realEscapeString ( $specializationName ); | |
try { | |
$sql = "UPDATE specialisation_master SET specialisationName = '$specializationName' WHERE id = '$specilizationId' "; | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return true; | |
} | |
/** | |
* get SpecializationBy studentId | |
* @author Sibin | |
*/ | |
public function getSpecialisationByStudentId($studentId,$batchId) { | |
$studentId = $this->realEscapeString ( $studentId ); | |
$batchId = $this->realEscapeString ( $batchId ); | |
$sql = "SELECT sm.id, | |
sm.specialisationName,sm.specialisationDesc | |
from specialisation_master sm | |
inner join | |
specialisation_student_relation ssr | |
on sm.id=ssr.specialisationId | |
where | |
ssr.studentId ='$studentId' | |
and ssr.batchId='$batchId'"; | |
try { | |
$specialisation = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $specialisation; | |
} | |
} | |
?> |