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;
 }
示例#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;
 }
 /**
  * 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;
 }
示例#10
0
 public function insertItem(array $data)
 {
     $this->itemTable->insert($data);
     return $this->itemTable->select(['id' => $this->itemTable->getLastInsertValue()])->current();
 }
示例#11
0
 public function insert($data)
 {
     $insertData = ['name' => $data->name, 'description' => $data->description, 'price' => $data->price];
     return $this->tableGateway->insert($insertData);
 }
示例#12
0
 public function insert($data)
 {
     $hydrator = new ObjectProperty();
     $this->tableGateway->insert($hydrator->extract($data));
     return $this->find($this->tableGateway->getLastInsertValue());
 }
示例#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);
 }
示例#15
0
 public function insert($data)
 {
     $hydrator = new ObjectProperty();
     $array = $hydrator->extract($data);
     return $this->tableGateway->insert($array);
 }