PHP code example of dhii / cqrs-resource-model-interface
1. Go to this page and download the library: Download dhii/cqrs-resource-model-interface library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dhii / cqrs-resource-model-interface example snippets
use Dhii\Storage\Resource\SelectCapableInterface;
use Dhii\Collection\MapInterface;
/* @var $select SelectCapableInterface */
$results = $select->select();
/* The below would go through each element of the result set, and,
* if the 'age' field is greater than 18, output all of the names
* and values of all fields.
*/
foreach ($results as $_result) {
/* @var $_result MapInterface */
if ((int) $_result->get('age') < 18) {
continue;
}
foreach ($_result as $_field => $_value) {
echo sprintf('%1$s: %2$s', $_field, $_value) . "\n";
}
echo "---' . "\n";
}