PhysicalObjectWriteServiceInterface
in
Contract for PhysicalObject write operations.
Covers: creating new physical objects, updating existing ones, and saving Propel-bound resources.
The PropelAdapter wraps QubitPhysicalObject for Symfony mode. Falls back to Laravel Query Builder for standalone Heratio mode.
Table of Contents
Methods
- createPhysicalObject() : int
- Create a new physical object. Returns the new object ID.
- newPhysicalObject() : object
- Get a new unsaved PhysicalObject (for form binding in Propel mode).
- savePhysicalObject() : int
- Save a physical object with properties already set (Propel mode).
- updatePhysicalObject() : void
- Update an existing physical object.
Methods
createPhysicalObject()
Create a new physical object. Returns the new object ID.
public
createPhysicalObject(array<string|int, mixed> $data[, string $culture = 'en' ]) : int
Handles entity inheritance: INSERT object -> INSERT physical_object -> INSERT physical_object_i18n.
Parameters
- $data : array<string|int, mixed>
-
Physical object attributes (name, location, type_id, etc.)
- $culture : string = 'en'
-
Culture code
Return values
int —The new object ID
newPhysicalObject()
Get a new unsaved PhysicalObject (for form binding in Propel mode).
public
newPhysicalObject() : object
In standalone mode, returns stdClass.
Return values
object —Unsaved QubitPhysicalObject or stdClass
savePhysicalObject()
Save a physical object with properties already set (Propel mode).
public
savePhysicalObject(object $resource) : int
In Propel mode, calls $resource->save(). In standalone mode, extracts properties and performs INSERT/UPDATE via Laravel DB.
Parameters
- $resource : object
-
The physical object to save (QubitPhysicalObject or stdClass)
Return values
int —The saved object ID
updatePhysicalObject()
Update an existing physical object.
public
updatePhysicalObject(int $id, array<string|int, mixed> $data[, string $culture = 'en' ]) : void
Parameters
- $id : int
-
Physical object ID
- $data : array<string|int, mixed>
-
Column => value pairs to update
- $culture : string = 'en'
-
Culture code for i18n attributes