本文整理汇总了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);
}
}
}