Exemplo n.º 1
0
 /**
  * @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);
     }
 }
Exemplo n.º 2
0
 public function save(Entity $entity)
 {
     $dataInput = array('image' => $entity->getImage(), 'title' => $entity->getTitle(), 'description' => $entity->getDescription(), 'created_at' => $entity->getCreatedAt());
     if ($entity->getId() > 0) {
         $this->update($entity->getId(), $dataInput);
     } else {
         $this->create($dataInput);
     }
 }
Exemplo n.º 3
0
 public function save(Entity $entity)
 {
     $dataInput = array('name' => $entity->getName(), 'image' => $entity->getImage(), 'category_id' => $entity->getCategoryId(), 'description' => $entity->getDescription());
     if ($entity->getId() > 0) {
         $this->update($entity->getId(), $dataInput);
     } else {
         $this->create($dataInput);
     }
 }
Exemplo n.º 4
0
 public function save(Entity $entity)
 {
     $data = array('title' => $entity->getTitle(), 'description' => $entity->getDescription(), 'price' => $entity->getPrice());
     if ($entity->getImage() != '') {
         $data['image'] = $entity->getImage();
     }
     if ($entity->getId() > 0) {
         $this->db->update($this->table, $data, $entity->getId());
     } else {
         $entity->setId($this->db->insert($this->table, $data));
     }
 }