0

i would like to gather different entities for a given time, serialize them to an array or json and send them to an external API. Those entities consists are for example buyers, order, transactions

Is it possible to

  • get objects that represents those entities easily for a timerange without doing direct database queries (probably supported by an ORM)
  • is the serialization of those objects into an format like json/array natively supported

does magento version from 1.6 - latest support those operations in the same way?

0

get objects that represents those entities easily for a timerange without doing direct database queries

This is not quite clear to me, but let's say you have order data, including the order id, you can instantiate an order model without loading it from the database:

$order = Mage::getModel('sales/order', ['id' => 123, ... ]);

But using such an incomplete object might cause unwanted side effects.

is the serialization of those objects into an format like json/array natively supported

Varien_Object and by inheritance all Magento models, has several methods for this:

  • toJson()
  • toArray()
  • toXml()
  • serialize()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.