public function insert($data)
 {
     if (!$this->tableGateway->insert($data)) {
         return new ApiProblem(500, 'Erro ao inserir registro.');
     }
     return $this->tableGateway->getLastInsertValue();
 }
 public function create($data)
 {
     $data = array('username' => $data->username, 'password' => $data->password, 'first_name' => $data->first_name, 'last_name' => $data->last_name, 'role' => $data->role);
     $this->tableGateway->insert($data);
     $data['id'] = $this->tableGateway->getLastInsertValue();
     return $data;
 }
 /**
  * Create a new resource.
  *
  * @param array|object $data Data representing the resource to create.
  * @return array|object Newly created resource.
  */
 public function create($data)
 {
     $data = $this->retrieveData($data);
     $this->table->insert($data);
     $id = $this->table->getLastInsertValue();
     return $this->fetch($id);
 }
 public function create($data)
 {
     $mapper = new ObjectProperty();
     $data = $mapper->extract($data);
     $this->tableGateway->insert($data);
     $data['id'] = $this->tableGateway->getLastInsertValue();
     return $data;
 }
Esempio n. 5
0
 public function save(Motivo $motivo)
 {
     $data = $motivo->toArray();
     if (empty($motivo->codigo)) {
         $this->tableGateway->insert($data);
     } else {
         $this->tableGateway->update('codigo=' . $motivo->codigo);
     }
 }
 public function insertItem(array $data)
 {
     $this->orderItemTableGateway->insert($data);
     $id = $this->orderItemTableGateway->getLastInsertValue();
     return $id;
 }
Esempio n. 7
0
 /**
  * Insert a new resource
  */
 public function insert($userEntity)
 {
     return $this->tableGateway->insert((array) $userEntity);
 }
 public function create($productEntity)
 {
     return $this->tableGateway->insert((array) $productEntity);
 }
 public function create($data)
 {
     $mapper = new UsersMapper();
     $result = $this->tableGateway->insert($mapper->extract($data));
     return $result;
 }
Esempio n. 10
0
 public function insertItem(array $data)
 {
     $this->itemTable->insert($data);
     return $this->itemTable->select(['id' => $this->itemTable->getLastInsertValue()])->current();
 }
Esempio n. 11
0
 public function insert($data)
 {
     $insertData = ['name' => $data->name, 'description' => $data->description, 'price' => $data->price];
     return $this->tableGateway->insert($insertData);
 }
Esempio n. 12
0
 public function insert($data)
 {
     $hydrator = new ObjectProperty();
     $this->tableGateway->insert($hydrator->extract($data));
     return $this->find($this->tableGateway->getLastInsertValue());
 }
Esempio n. 13
0
 /**
  * @param $data
  * @return mixed
  */
 public function insert($data)
 {
     $insertData = $this->setTratarData($data);
     return $this->tableGateway->insert($insertData);
 }
 public function create($user)
 {
     return $this->tableGateway->insert((array) $user);
 }
Esempio n. 15
0
 public function insert($data)
 {
     $hydrator = new ObjectProperty();
     $array = $hydrator->extract($data);
     return $this->tableGateway->insert($array);
 }