public function save(Entity $entity) { $data = array('product_id' => $entity->getProductId(), 'date' => $entity->getDate(), 'name' => $entity->getName(), 'email' => $entity->getEmail(), 'phone' => $entity->getPhone(), 'is_complete' => $entity->getIsComplete(), 'user_id' => $entity->getUserId()); if ($entity->getId() > 0) { $this->db->update($this->table, $data, $entity->getId()); } else { $entity->setId($this->db->insert($this->table, $data)); } }
/** * @param Entity $entity */ public function save(Entity $entity) { $dataInput = array('username' => $entity->getUsername(), 'description' => $entity->getDescription(), 'email' => $entity->getEmail()); if ($entity->getId() > 0) { $this->update($entity->getId(), $dataInput); } else { $this->create($dataInput); } }
public function save(Entity $entity) { $data = array('name' => $entity->getName(), 'email' => $entity->getEmail(), 'phone' => $entity->getPhone(), 'message' => $entity->getMessage(), 'date' => $entity->getDate()); if ($entity->getId() > 0) { $this->db->update($this->table, $data, $entity->getId()); } else { $entity->setId($this->db->insert($this->table, $data)); } }