A mutable wrapper around the immutable DTO — mirrors the Ruby client's stateful resource pattern. Accessed via $client->ticket()->resource(1) — fetches the DTO and wraps it.
Property access: __get reads from internal attributes array. __set writes and tracks the change in a $changes array with old and new values.
save() behavior:
newRecord (no ID): POSTs all attributes to create
changed(): PUTs only the diff (changed fields) — unchanged fields are NOT sent
- Unchanged: no request at all
Other methods: destroy() sends DELETE if record exists. toDTO() rebuilds a fresh DTO from current attributes. changed() / newRecord() for state queries. After save(), changes are cleared and attributes are updated from the API response.
Acceptance Criteria
Depends on
Produces
A mutable wrapper around the immutable DTO — mirrors the Ruby client's stateful resource pattern. Accessed via
$client->ticket()->resource(1)— fetches the DTO and wraps it.Property access:
__getreads from internal attributes array.__setwrites and tracks the change in a$changesarray with old and new values.save() behavior:
newRecord(no ID): POSTs all attributes to createchanged(): PUTs only the diff (changed fields) — unchanged fields are NOT sentOther methods:
destroy()sends DELETE if record exists.toDTO()rebuilds a fresh DTO from current attributes.changed()/newRecord()for state queries. Aftersave(), changes are cleared and attributes are updated from the API response.Acceptance Criteria
Depends on
Produces
Resource