我有条件需要根据employment_status = active
和account_type != admin
过滤下拉列表
这是我的代码:
<?php
$employeesList = array();
$employees = Employee::model()->findAllByAttributes(array('employment_status' => 'active', 'account_type' ??? 'admin'));
foreach ($employees as $employee) {
$employeesList[$employee->company_id] = $employee->getName();
}
?>
我如何获得'account_type' != 'admin'
?
请帮忙。
答案 0 :(得分:2)
有多种方法可以做到这一点:
$employees = Employee::model()->findAllByAttributes(array('employment_status' => 'active'), 'account_type' != 'admin');
或者,
$criteria=new CDbCriteria;
$criteria->condition = "account_type != 'admin' AND employment_status = :status";
$criteria->params = array (
':status' => "active",
);
$employees = Employee::model()->findAll( $criteria );
答案 1 :(得分:0)
在yii1中,以下代码对我有用。
WebDriverWait(self.your_webelemt_object, 20, ignored_exceptions=[NoSuchElementException, the_other_exceptions]). # the rest omitted for brevity