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; }
public function insertItem(array $data) { $this->orderItemTableGateway->insert($data); $id = $this->orderItemTableGateway->getLastInsertValue(); return $id; }
public function insertItem(array $data) { $this->itemTable->insert($data); return $this->itemTable->select(['id' => $this->itemTable->getLastInsertValue()])->current(); }
public function insert($data) { $hydrator = new ObjectProperty(); $this->tableGateway->insert($hydrator->extract($data)); return $this->find($this->tableGateway->getLastInsertValue()); }