Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function saveProduto(Produto $produto)
- {
- $data = array(
- 'nome' => $produto->nome,
- );
- $id = (int) $produto->id;
- if ($id == 0) {
- $this->tableGateway->insert($data);
- } else {
- if ($this->getProduto($id)) {
- $this->tableGateway->update($data, array('id' => $id));
- } else {
- throw new \Exception('Produto não existe');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement