(PECL xcommerce >= 1.0.0)
Xcom::encode — Encode an avro message
$data
, string $avro_schema
)
This method encodes a stdClass
object to an
avro binary encoded blob.
data
A stdClass
compatible object to encode.
avro_schema
The avro JSON schema to encode the data
against.
Returns an avro-encoded string or FALSE
on failure.
Przykład #1 Xcom::encode() example
<?php
$data = new stdClass();
$data->orderID = "foo1234";
$schema = file_get_contents('http://api.x.com/ocl/com.x.example.v1/OrderFulfillment/OrderShipped/1.2.0/');
$xcom = new Xcom();
$xcom->encode($data, $schema);
?>