Page MenuHomePhabricator

Nuance - conduit method to create items
ClosedPublic

Authored by btrahan on Jan 2 2014, 9:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Mar 20, 3:08 PM
Unknown Object (File)
Tue, Mar 12, 12:47 AM
Unknown Object (File)
Tue, Mar 12, 12:47 AM
Unknown Object (File)
Tue, Mar 12, 12:47 AM
Unknown Object (File)
Tue, Mar 12, 12:47 AM
Unknown Object (File)
Feb 9 2024, 6:14 AM
Unknown Object (File)
Feb 8 2024, 7:36 PM
Unknown Object (File)
Jan 28 2024, 2:37 AM

Details

Reviewers
epriestley
Commits
Restricted Diffusion Commit
rPcba959635e98: Nuance - conduit method to create items
Summary

pretty simple. did the bare minimum in the editor, etc. to be able to create an item from the conduit console.

I put the work in the editor for initializing new values, rather than some initializeNewItem method, mainly because Items don't have policy directly but instead policy will be defined by the queue(s) the item is in. The editor is definitely going to host this work, so it felt like it might be better to do it this way in time...? anyway, easy to make an initializeNew method instead if you want to have that paradigm going all the time.

Test Plan

made an item from teh conduit console - success. verified errors for missing data as well

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

initializeNewX() is mostly about setting valid values. Inside the Editor, objects sometimes get save()'d before transactions get applied. If they have non-nullable fields, this save() will fail for fields like title VARCHAR(255) NOT NULL if no title has been set yet. initializeNewX() just provides a central place to set all the defaults, which is greppable and better than setting them as property defaults (protected $title = '';) for at least some fields, since it can run logic like "go lookup the default policy".

(Possibly we should also attack this by limiting when save() gets called. I think we currently call it in order to generate an object PHID, but we could generate the PHID without saving the object.)

In this case, I would probably implement initializeNewX() but only use it to set the $status field, since null isn't meaningful or valid there.

I might or might not use transactions to apply the other fields. I think it's good to get one transaction in which can be the "created" transaction (especially since these objects have no explicit immutable creatorPHID sort of thing), but having a pile of them doesn't seem too valuable.

src/applications/nuance/conduit/ConduitAPI_nuance_createitem_Method.php
11

pht()

28โ€“29

pht()

src/applications/nuance/editor/NuanceItemEditor.php
31โ€“32

I think these are wrong -- at least, as written -- and should go in initializeNewX(): they will be applied every time any transaction happens, not just on object creation. So if I comment later, the item will be reopened and its timestamp will be refreshed.

btrahan updated this revision to Unknown Object (????).Jan 3 2014, 9:58 PM

initializeNewItem instead of the junk in the editor