本文整理匯總了PHP中Companies::getMessages方法的典型用法代碼示例。如果您正苦於以下問題:PHP Companies::getMessages方法的具體用法?PHP Companies::getMessages怎麽用?PHP Companies::getMessages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Companies
的用法示例。
在下文中一共展示了Companies::getMessages方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createAction
/**
* Creates a new companie
*/
public function createAction()
{
if (!$this->request->isPost()) {
return $this->dispatcher->forward(array("controller" => "companies", "action" => "index"));
}
$companie = new Companies();
$companie->id = $this->request->getPost("id");
$companie->name = $this->request->getPost("name");
if (!$companie->save()) {
foreach ($companie->getMessages() as $message) {
$this->flash->error($message);
}
return $this->dispatcher->forward(array("controller" => "companies", "action" => "new"));
}
$this->flash->success("companie was created successfully");
return $this->dispatcher->forward(array("controller" => "companies", "action" => "index"));
}
示例2: createAction
public function createAction()
{
if (!$this->request->isPost()) {
return $this->forward("companies/index");
}
$companies = new Companies();
$companies->name = $this->request->getPost("name", "striptags");
$companies->telephone = $this->request->getPost("telephone", "striptags");
$companies->address = $this->request->getPost("address", "striptags");
$companies->city = $this->request->getPost("city", "striptags");
if (!$companies->save()) {
foreach ($companies->getMessages() as $message) {
$this->flash->error((string) $message);
}
return $this->forward("companies/new");
}
$this->flash->success("Company was created successfully");
return $this->forward("companies/index");
}
示例3: createAction
public function createAction()
{
if (!$this->request->isPost()) {
return $this->_forward("companies/index");
}
$companies = new Companies();
$companies->id = $this->request->getPost("id", "int");
$companies->name = $this->request->getPost("name");
$companies->telephone = $this->request->getPost("telephone");
$companies->address = $this->request->getPost("address");
$companies->city = $this->request->getPost("city");
$companies->name = strip_tags($companies->name);
$companies->telephone = strip_tags($companies->telephone);
$companies->address = strip_tags($companies->address);
$companies->city = strip_tags($companies->city);
if (!$companies->save()) {
foreach ($companies->getMessages() as $message) {
Flash::error((string) $message, "alert alert-error");
}
return $this->_forward("companies/new");
} else {
Flash::success("companies was created successfully", "alert alert-success");
return $this->_forward("companies/index");
}
}