本文整理匯總了PHP中School::getMessages方法的典型用法代碼示例。如果您正苦於以下問題:PHP School::getMessages方法的具體用法?PHP School::getMessages怎麽用?PHP School::getMessages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類School
的用法示例。
在下文中一共展示了School::getMessages方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: changerequestAction
public function changerequestAction()
{
$this->response->setHeader("Content-Type", "text/plain; charset=utf-8");
$id = $this->request->getQuery('id', 'int');
$agree = $this->request->getQuery('agree', 'int');
$req = Request::findFirst($id);
if ($req != false) {
$this->db->begin();
// 新建學校
if ($agree) {
$school = new School();
$school->name = $req->name;
$school->district = $req->district;
if (!$school->save()) {
foreach ($school->getMessages() as $message) {
echo $message;
}
$this->db->rollback();
return;
}
}
// 設定管理員和學校關聯
$manager = $req->getManager();
$manager->school_id = $school->school_id;
if (!$manager->save()) {
foreach ($manager->getMessages() as $message) {
echo $message;
}
$this->db->rollback();
return;
}
// 更新狀態
$req->statue = $agree;
if ($req->save()) {
echo "1";
$this->db->commit();
$this->view->disable();
} else {
foreach ($req->getMessages() as $message) {
echo $message;
}
$this->db->rollback();
return;
}
} else {
echo "0";
}
}
示例2: newschool
private function newschool($name, $district, $manager)
{
// 新建學校
$school = new School();
$school->name = $name;
$school->district = $district;
if (!$school->save()) {
foreach ($school->getMessages() as $message) {
$this->db->rollback();
throw new PDOException($message);
}
}
// 設定管理員和學校關聯
$manager->school_id = $school->school_id;
if (!$manager->save()) {
foreach ($manager->getMessages() as $message) {
$this->db->rollback();
throw new PDOException($message);
}
}
}