Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 16
DesignationService
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 4
42.00
0.00% covered (danger)
0.00%
0 / 16
 __construct
0.00% covered (danger)
0.00%
0 / 1
2.00
0.00% covered (danger)
0.00%
0 / 1
 __clone
0.00% covered (danger)
0.00%
0 / 1
2.00
0.00% covered (danger)
0.00%
0 / 1
 getInstance
0.00% covered (danger)
0.00%
0 / 1
6.00
0.00% covered (danger)
0.00%
0 / 4
 getStaffDesignations
0.00% covered (danger)
0.00%
0 / 1
6.00
0.00% covered (danger)
0.00%
0 / 10
<?php
namespace com\linways\core\ams\professional\service;
use com\linways\core\ams\professional\exception\ProfessionalException;
use com\linways\core\ams\professional\dto\Department;
class DesignationService extends BaseService
{
    private static $_instance = null;
    
    // /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 staff designations
     * @return Staff Designations
     */
    public function getStaffDesignations($sortBy = 'name', $sortOrder = 'ASC') {
        $staffdesignations = null;
        $sql = "SELECT id as Id, name as designationName, description as designationDesc 
        FROM staff_designation ORDER BY ".$sortBy." ".$sortOrder."";
        try {
            $staffdesignations = $this->executeQueryForList($sql);
        } catch (\Exception $e) {
            throw new ProfessionalException($e->getCode(),$e->getMessage());
        }
        return $staffdesignations;
    
    }
}