Shopify / Shopify/shopify-api-php
Return created/updated objects
Nessuno ha ancora preso questa issue.
- Lingua principale
- PHP
- Stelle
- 473
- Fork
- 193
- Merge medio
- 5h 8m
- PR unite (30g)
- 1
Descrizione
Overview
The API itself will already return the full object if you do a create/update operation. However, the library swallows this response here:
https://github.com/Shopify/shopify-php-api/blob/0556edf274ceb83346533bd22b662d7622e58c66/src/Rest/Base.php#L60-L74
Solution
Adding return $response->getDecodedBody(); at the end of the function should suffice. Note that the saveAndUpdate function would also need to be updated, with return $this->save(true);. Implementation can be found in my fork: https://github.com/MagicLegend/shopify-php-api/commit/d43bc94601dabae8135cd1c35b5f4af3e1fdac23
Type
- New feature
- Changes to existing features
Motivation
What inspired this feature request? What problems were you facing?
I would like to verify the saved object myself, without needing to query the API again for data that was already returned in the first place. This also allows immediate access to the ID of the newly created object.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia da src/Rest/Base.php alle righe 60-74 e segui la funzione saveAndUpdate. Usa come riferimento il commit del fork collegato, quindi verifica che le operazioni create/update e saveAndUpdate espongano l'oggetto restituito dall'API, incluso l'accesso alla risposta decodificata e all'ID appena creato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- php
- Ambito
- api
- Tipo di issue
- Funzionalità
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 45/100