I've created a Magento 2 module and I set up a class that extends Magento\Framework\DataObject that I'm using to pass data between my helper (e.g. Package\Module\Helper\Data) and model (e.g. Package\Module\Model\Total\Checkout\Total).
It's just nicer syntax then passing an array back and forth, allows me to keep my code DRY, and adds some free functionality (like toJson()
).
For now I've placed it in the Model directory (e.g. Package\Module\Model\Data\MyData).
My question is: Where is the best place to put a class that doesn't seem to belong in any of the traditional module folders? Its location should make it's role apparent to the next developer who works on this code before they even look at its contents. Is there an existing construct?