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