我在yii中使用select方法,它给出错误“属性“CDbCriteria.:centerId”未定义”
if (0 < self::model()->countByAttributes(
'centerId = :centerId AND qTypeId = :qTypeId',
array(
':centerId' => $centerId,
':qTypeId' => $qTypeId,
)
)) {
throw new Exception('Duplicate Entry for center and que type');
}
1条答案
按热度按时间6g8kf2rb1#
您使用此方法的方式不正确。您跳过了第一个参数,该参数应该是用作筛选器的活动记录参数的列表(请参阅文档)。您可能需要类似以下的内容:
或者使用
count()
: