Utilities
The Database Utility Class contains methods that help you manage your database.
Get XML from Result
getXMLFromResult()
This method returns the xml result from database result. You can do like this:
<?php
$model = new class () extends \CodeIgniter\Model {
protected $table = 'foo';
protected $primaryKey = 'id';
};
$util = \CodeIgniter\Database\Config::utils();
echo $util->getXMLFromResult($model->get());
and it will get the following xml result:
<root>
<element>
<id>1</id>
<name>bar</name>
</element>
</root>