本文整理匯總了PHP中Reservation::findFirst方法的典型用法代碼示例。如果您正苦於以下問題:PHP Reservation::findFirst方法的具體用法?PHP Reservation::findFirst怎麽用?PHP Reservation::findFirst使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Reservation
的用法示例。
在下文中一共展示了Reservation::findFirst方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: deleteAction
public function deleteAction()
{
$this->view->disable();
$this->response->setContentType('text/plain', 'UTF-8');
$Reservationid = $this->request->get('reservationid', 'string');
$reservation = Reservation::findFirst(array('coditions' => 'id=?1', 'bind' => array(1 => $reservationid)));
if ($reservation != null) {
$available = $reservation->Available;
if ($available->date == date('Y-m-d', strtotime('now'))) {
$this->response->setContent('對不起,該預約單已經超過可取消日期');
$this->response->send();
return;
} else {
if ($reservation->delete() == false) {
$this->response->setContent('對不起,現在無法取消預約單');
$this->response->send();
return;
} else {
$this->response->setContent('預約單取消成功');
$this->response->send();
return;
}
}
}
}
示例2: doprintAction
public function doprintAction()
{
$rid = $this->request->get('reservationid', 'int');
$r = Reservation::findFirst(array('id=:rid:', 'bind' => array('rid' => $rid)));
$user = $r->getUser();
$available = $r->getAvailable();
$doctor = $available->getDoctor();
$department = $doctor->getDepartment();
$hospital = $department->getHospital();
$this->view->setVars(array('user' => $user, 'available' => $available, 'doctor' => $doctor, 'department' => $department, 'hospital' => $hospital, 'reservation' => $r));
}
示例3: showsuccessAction
public function showsuccessAction()
{
$availableid = $this->request->get('availableid', 'int');
$this->tag->appendTitle('預約成功');
$available = Available::findFirst(array('id=:id:', 'bind' => array('id' => $availableid)));
$doctor = $available->getDoctor();
$department = $doctor->getDepartment();
$hospital = $department->getHospital();
$user = User::findFirst(array('conditions' => 'id=?1', 'bind' => array(1 => $this->session->get('userid'))));
$reservation = Reservation::findFirst(array('a_id=:a_id: AND u_id=:u_id:', 'bind' => array('a_id' => $available->id, 'u_id' => $user->id)));
$this->view->setVars(array('doctor' => $doctor, 'hospital' => $hospital, 'department' => $department, 'reservationid' => $reservation->id, 'user' => $user, 'available' => $available));
}