I want to use the Sql object in my model to query the database. I have an entity object lets say Person and person object has exchangeArray() method. I want to set this Person object to be an Array Object Prototype of the ResultSet for my sql queries.
I research how to do this but the only information I found is how to set Array Object Prototype to a ResultSet object assigned to a Zend\Db\TableGateway\TableGateway.
$personEntity = new PersonEntity();
$resultSet = new \Zend\Db\ResultSet\ResultSet();
$resultSet->setArrayObjectPrototype($personEntity);
$db = $sm->get('Zend\Db\Adapter\Adapter');
$table = new \Zend\Db\TableGateway\TableGateway('table', $db, null, $resultSet);
My question is how can I set PersonEntity object to represent rows of my database that are return from a Zend\Db\Sql\Sql objects?
Thanks in advance,
Steve