Skip to content
Snippets Groups Projects
Commit 4e822e08 authored by jaapjansma's avatar jaapjansma
Browse files

Fixed errors with velt.

parent ba4441fe
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,7 @@ use Civi\DataProcessor\DataFlow\MultipleDataFlows\JoinInterface;
use Civi\DataProcessor\DataFlow\MultipleDataFlows\MultipleSourceDataFlows;
use Civi\DataProcessor\DataFlow\MultipleDataFlows\SqlJoinInterface;
use Civi\DataProcessor\DataFlow\SqlDataFlow;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use \Civi\DataProcessor\DataSpecification\DataSpecification;
......@@ -67,7 +68,11 @@ class CombinedSqlDataFlow extends SqlDataFlow implements MultipleSourceDataFlows
public function getFromStatement() {
$fromStatements = array();
$sourceDataFlowDescription = reset($this->sourceDataFlowDescriptions);
$fromStatements[] = "FROM `{$sourceDataFlowDescription->getDataFlow()->getTable()}` `{$sourceDataFlowDescription->getDataFlow()->getTableAlias()}`";
if ($sourceDataFlowDescription->getDataFlow() instanceof SqlTableDataFlow) {
$fromStatements[] = "FROM `{$sourceDataFlowDescription->getDataFlow()->getTable()}` `{$sourceDataFlowDescription->getDataFlow()->getTableAlias()}`";
} elseif ($sourceDataFlowDescription->getDataFlow() instanceof CombinedSqlDataFlow) {
$fromStatements[] = "FROM `{$sourceDataFlowDescription->getDataFlow()->getPrimaryTable()}` `{$sourceDataFlowDescription->getDataFlow()->getPrimaryTableAlias()}`";
}
$fromStatements = array_merge($fromStatements, $this->getJoinStatement(0));
return implode(" ", $fromStatements);
}
......
<?php
/**
* @author Jaap Jansma <jaap.jansma@civicoop.org>
* @license AGPL-3.0
*/
namespace Civi\DataProcessor;
use Civi\DataProcessor\DataFlow\MultipleDataFlows\JoinSpecification;
use Civi\DataProcessor\ProcessorType\DefaultProcessorType;
use Civi\DataProcessor\Source\ContactSource;
use Civi\DataProcessor\Source\ContributionSource;
use Civi\DataProcessor\Storage\DatabaseTable;
class DummyDataProcessor {
/**
* @var \Civi\DataProcessor\ProcessorType\AbstractProcessorType
*/
public $dataprocessor;
public function __construct() {
$this->dataprocessor = new DefaultProcessorType();
$this->dataprocessor->addDataSource(new ContactSource('civicrm_contact_'));
$this->dataprocessor->addDataSource(new ContributionSource('civicrm_contribution_'), new JoinSpecification('id', 'civicrm_contact_', 'contact_id', 'civicrm_contribution_'));
$this->dataprocessor->setStorage(new DatabaseTable('aaaa'));
}
}
\ No newline at end of file
......@@ -73,13 +73,13 @@ class Api implements OutputInterface, API_ProviderInterface, EventSubscriberInte
return array('count' => $count, 'is_error' => 0);
} else {
$options = _civicrm_api3_get_options_from_params($apiRequest['params']);
if (isset($options['limit'])) {
$dataProcessor->getDataFlow()->setLimit($options['limit']);
}
if (isset($options['offset'])) {
$dataProcessor->getDataFlow()->setOffset($options['offset']);
}
$records = $dataProcessor->getDataFlow()->allRecords();
$values = array();
foreach($records as $idx => $record) {
......
<?php
use CRM_Dataprocessor_ExtensionUtil as E;
/**
* Dummy.Dataprocessor API specification (optional)
* This is used for documentation and validation.
*
* @param array $spec description of fields supported by this API call
* @return void
* @see http://wiki.civicrm.org/confluence/display/CRMDOC/API+Architecture+Standards
*/
function _civicrm_api3_dummy_Dataprocessor_spec(&$spec) {
}
/**
* Dummy.Dataprocessor API
*
* @param array $params
* @return array API result descriptor
* @see civicrm_api3_create_success
* @see civicrm_api3_create_error
* @throws API_Exception
*/
function civicrm_api3_dummy_Dataprocessor($params) {
$return = array();
$dummy = new \Civi\DataProcessor\DummyDataProcessor();
$return = $dummy->dataprocessor->getDataFlow()->allRecords();
return civicrm_api3_create_success($return);
}
......@@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS `civicrm_data_processor_field` (
`name` VARCHAR(128) NOT NULL,
`type` VARCHAR(128) NOT NULL,
`title` VARCHAR(128) NOT NULL,
`configuration` TEXT NULL
`configuration` TEXT NULL,
PRIMARY KEY (`id`)
) ENGINE = InnoDB;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment