The following does not work:
use application\components\auditor\AuditLevel;
public function actionAudit()
{
    $data=unserialize($_POST['data']);
    $message=$data['message'];
    $context=$data['context'];
    $level=$context['level'];
    Yii::app()->auditor->log(constant('AuditLevel::'.$level), $message, $context);
}
// constant(): Couldn't find constant AuditLevel::INFO
But having all namespace works:
use application\components\auditor\AuditLevel;
public function actionAudit()
{
    $data=unserialize($_POST['data']);
    $message=$data['message'];
    $context=$data['context'];
    $level=$context['level'];
    Yii::app()->auditor->log(constant('application\components\auditor\AuditLevel::'.$level), $message, $context);
}
Any idea how can I use the namespace declared above instead of in the function?
Thanks!
 
                        
From the php.net comment section on
constant():You have to use the full namespace path.