PHP code example of activedbsoft / webapi-active-query-builder
1. Go to this page and download the library: Download activedbsoft/webapi-active-query-builder 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/ */
activedbsoft / webapi-active-query-builder example snippets
= new WebApiActiveQueryBuilder\ActiveQueryBuilderApi();
$metadataGuid= "b3207f4f-b1f4-4dc2-979b-7724ed2d0221";
$sql = "Select customer_id, first_name From customer";
$query = new WebApiActiveQueryBuilder\SqlQuery(); // \WebApiActiveQueryBuilder\SqlQuery | Information about SQL query and it's context.
$query->setGuid($metadataGuid);
$query->setText($sql);
$columns = $api->getQueryColumnsPost($query);
print_r($columns);
$transform = new WebApiActiveQueryBuilder\Transform();
$transform->setGuid($metadataGuid);
$transform->setSql($sql);
$filter = new WebApiActiveQueryBuilder\ConditionGroup();
$condition = new WebApiActiveQueryBuilder\Condition();
$condition->setField('customer_id');
$condition->setConditionOperator('Greater');
$condition->setValues(array(10));
$filter->setConditions(array($condition));
$page = new WebApiActiveQueryBuilder\Pagination();
$page->setSkip(10);
$page->setTake(5);
$order = new WebApiActiveQueryBuilder\Sorting();
$order->setField('customer_id');
$order->setOrder('asc');
$transform->setFilter($filter);
$transform->setPagination($page);
$transform->setSortings(array($order));
$result = $api->transformSqlPost($transform);
print_r($result);