protected function lock($resource_type, $resource_id) { $cmd = $this->dbConnection->createCommand('SELECT GET_LOCK(?, 1)'); $key = $this->getLockKey($resource_type, $resource_id); while (!$cmd->queryScalar(array($key))) { } }