本文整理匯總了PHP中Products::getMessages方法的典型用法代碼示例。如果您正苦於以下問題:PHP Products::getMessages方法的具體用法?PHP Products::getMessages怎麽用?PHP Products::getMessages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Products
的用法示例。
在下文中一共展示了Products::getMessages方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createAction
public function createAction()
{
$auth = $this->session->get('auth');
$request = $this->request;
if (!$request->isPost()) {
return $this->forward("products/index");
}
$request = $request->getPost();
$products = new Products();
$products->product_types_id = $request['product_types_id'];
$products->name = $request['name'];
$products->issuer = $request['issuer'];
$products->status = $request['status'];
$products->cycle = $request['cycle'];
$products->min = $request['min'];
$products->expected = $request['expected'];
$products->issuetime = $request['issuetime'];
$products->telephone = $request['telephone'];
$products->control = $request['control'];
$products->description = $request['description'];
$products->registrar = $auth['name'];
if ($products->save()) {
$this->flash->notice("保存成功!");
return $this->forward('products/new');
} else {
foreach ($products->getMessages() as $message) {
$this->flash->error((string) $message);
}
}
}
示例2: addProductAction
public function addProductAction()
{
if (ApiController::access()) {
$product = new Products();
$saveArr = $this->request->getPost();
if (!isset($saveArr['name'])) {
die('Не передан обязательный параметр name');
}
if ($product->save($saveArr) == false) {
foreach ($product->getMessages() as $message) {
$this->response .= (string) $message;
}
} else {
$this->response = array('error_code' => 200, 'error_desc' => 'Create product: ' . $this->request->getPost('name'));
}
echo json_encode($this->response);
$this->view->disable();
}
}
示例3: createAction
public function createAction()
{
$request = $this->request;
if (!$request->isPost()) {
return $this->forward("products/index");
}
$products = new Products();
$products->id = $request->getPost("id", "int");
$products->product_types_id = $request->getPost("product_types_id", "int");
$products->name = $request->getPost("name", "striptags");
$products->price = $request->getPost("price");
$products->active = $request->getPost("active");
if (!$products->save()) {
foreach ($products->getMessages() as $message) {
$this->flash->error((string) $message);
}
return $this->forward("products/new");
} else {
$this->flash->success("products was created successfully");
return $this->forward("products/index");
}
}
示例4: createAction
public function createAction()
{
if (!$this->request->isPost()) {
return $this->_forward("products/index");
}
$products = new Products();
$products->id = $this->request->getPost("id", "int");
$products->product_types_id = $this->request->getPost("product_types_id", "int");
$products->name = $this->request->getPost("name");
$products->price = $this->request->getPost("price");
$products->active = $this->request->getPost("active");
$products->name = strip_tags($products->name);
if (!$products->save()) {
foreach ($products->getMessages() as $message) {
Flash::error((string) $message, "alert alert-error");
}
return $this->_forward("products/new");
} else {
Flash::success("products was created successfully", "alert alert-success");
return $this->_forward("products/index");
}
}