Ich erstelle eine REST-API FuelPHP und seine ORM, docs hier: http://fuelphp.com/docs/packages/orm/crud.html_DATA Array von ORM mit FuelPHP
ich eine Aufgabe der Datenbankzeile zurückkehren kann etwa so:
$entry = Model_V1_Inventory::find(1);
Dies gibt mir das Objekt zurück, wo der PK gleich 1 ist, was wie erwartet ist. Wie greife ich auf das Array _data zu, um es zu json_encode zu machen und es als Teil der REST-Antwort zurückzugeben? Ich kann einfach durch Aufruf einzelne Elemente im Array zuzugreifen:
$entry->product_ref
Als Beispiel, aber ich kann trotzdem nicht die Rücksendung die _data Array sehe damit geschützt.
Das zurück vom ORM widersprochen:
Model_V1_Inventory Object
(
[_is_new:protected] =>
[_frozen:protected] =>
[_sanitization_enabled:protected] =>
[_data:protected] => Array
(
[product_ref] => from the model
[cost_price] => 0.99
[rrp_price] => 11.67
[current_price] => 5.47
[description] => test description
[created_at] => 2016-04-26 14:29:20
[updated_at] => 2016-04-26 14:29:20
[id] => 1
)
[_custom_data:protected] => Array
(
)
[_original:protected] => Array
(
[product_ref] => from the model
[cost_price] => 0.99
[rrp_price] => 11.67
[current_price] => 5.47
[description] => test description
[created_at] => 2016-04-26 14:29:20
[updated_at] => 2016-04-26 14:29:20
[id] => 1
)
[_data_relations:protected] => Array
(
)
[_original_relations:protected] => Array
(
)
[_reset_relations:protected] => Array
(
)
[_disabled_events:protected] => Array
(
)
[_view:protected] =>
[_iterable:protected] => Array
(
)
)