本文整理汇总了PHP中Department::findFirst方法的典型用法代码示例。如果您正苦于以下问题:PHP Department::findFirst方法的具体用法?PHP Department::findFirst怎么用?PHP Department::findFirst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Department
的用法示例。
在下文中一共展示了Department::findFirst方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
public static function edit($id, $data)
{
$info = Department::findFirst($id);
if (!$info) {
return false;
}
foreach ($data as $field => $value) {
$info->{$field} = $value;
}
return $info->update();
}
示例2: indexAction
public function indexAction()
{
$auth = $this->session->get('auth');
$user = Users::findFirst($auth['id']);
if ($user == false) {
$this->forward('index/index');
}
if ($auth['did'] != '' && $auth['did'] != 0) {
$department = Department::findFirst($auth['did']);
} else {
$department->name = '北京银泰财富中心';
}
$this->view->setVar("department", $department);
}
示例3: departmentAction
public function departmentAction()
{
$departmentid = $this->request->get('departmentid');
$department = Department::findFirst(array('conditions' => 'id=?1', 'bind' => array(1 => $departmentid)));
$hospital = $department->Hospital;
$this->tag->appendTitle($hospital->name . $department->name);
$doctors = array();
$k = 0;
foreach ($department->Doctor as $item) {
$k++;
$doctors[$k] = $item;
}
$city = $hospital->City;
$this->view->setVars(array('city' => $city, 'hospital' => $hospital, 'department' => $department, 'doctors' => $doctors));
}