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