Procedure::getListBySubspecialty PHP Méthode

getListBySubspecialty() public méthode

public getListBySubspecialty ( $subspecialtyId, boolean $restrict = false ) : array
$subspecialtyId
$restrict boolean
Résultat array
    public function getListBySubspecialty($subspecialtyId, $restrict = false)
    {
        $where = '';
        if ($restrict == 'unbooked') {
            $where = ' and unbooked = 1';
        } elseif ($restrict == 'booked') {
            $where = ' and unbooked = 0';
        }
        $procedures = Yii::app()->db->createCommand()->select('proc.id, proc.term')->from('proc')->join('proc_subspecialty_assignment psa', 'psa.proc_id = proc.id')->where('psa.subspecialty_id = :id and proc.active = 1' . $where, array(':id' => $subspecialtyId))->order('display_order, proc.term ASC')->queryAll();
        $data = array();
        foreach ($procedures as $procedure) {
            $data[$procedure['id']] = $procedure['term'];
        }
        return $data;
    }