Update API and transaction components.

This commit is contained in:
James Cole
2019-03-30 07:09:52 +01:00
parent 484ed6a585
commit 5b1fb5354e
18 changed files with 406 additions and 312 deletions

View File

@@ -118,6 +118,25 @@ class GroupCollector implements GroupCollectorInterface
];
}
/**
* Return the transaction journals without group information. Is useful in some instances.
*
* @return array
*/
public function getExtractedJournals(): array
{
$selection = $this->getGroups();
$return = new Collection;
/** @var array $group */
foreach ($selection as $group) {
foreach ($group['transactions'] as $journalId => $journal) {
$return[$journalId] = $journal;
}
}
return $return;
}
/**
* Return the groups.
*
@@ -339,6 +358,18 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
/**
* Limit the search to one specific transaction group.
*
* @param TransactionGroup $transactionGroup
*
* @return GroupCollectorInterface
*/
public function setTransactionGroup(TransactionGroup $transactionGroup): GroupCollectorInterface
{
$this->query->where('transaction_groups.id', $transactionGroup->id);
}
/**
* Limit the included transaction types.
*