Code cleanup

This commit is contained in:
James Cole
2021-03-21 09:15:40 +01:00
parent da1751940e
commit 206845575c
317 changed files with 7418 additions and 7362 deletions

View File

@@ -38,16 +38,17 @@ trait CollectorProperties
private $hasAccountInfo;
/** @var bool Will be true if query result includes bill information. */
private $hasBillInformation;
/** @var bool */
private $hasNotesInformation;
/** @var bool Will be true if query result contains budget info. */
private $hasBudgetInformation;
/** @var bool Will be true if query result contains category info. */
private $hasCatInformation;
/** @var bool Will be true for attachments */
private $hasJoinedAttTables;
private bool $hasJoinedMetaTables;
/** @var bool Will be true of the query has the tag info tables joined. */
private $hasJoinedTagTables;
/** @var bool */
private $hasNotesInformation;
/** @var array */
private $integerFields;
/** @var int The maximum number of results. */
@@ -60,6 +61,4 @@ trait CollectorProperties
private $total;
/** @var User The user object. */
private $user;
private bool $hasJoinedMetaTables;
}

View File

@@ -39,84 +39,60 @@ trait MetaCollection
{
/**
* @inheritDoc
* Where has no tags.
*
* @return GroupCollectorInterface
*/
public function withNotes(): GroupCollectorInterface
public function hasAnyTag(): GroupCollectorInterface
{
if (false === $this->hasNotesInformation) {
// join bill table
$this->query->leftJoin(
'notes',
static function (JoinClause $join) {
$join->on('notes.noteable_id', '=', 'transaction_journals.id');
$join->where('notes.noteable_type', '=', 'FireflyIII\Models\TransactionJournal');
}
);
// add fields
$this->fields[] = 'notes.text as notes';
$this->hasNotesInformation = true;
}
$this->withTagInformation();
$this->query->whereNotNull('tag_transaction_journal.tag_id');
return $this;
}
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function notesContain(string $value): GroupCollectorInterface
{
$this->withNotes();
$this->query->where('notes.text', 'LIKE', sprintf('%%%s%%', $value));
return $this;
}
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function notesEndWith(string $value): GroupCollectorInterface
{
$this->withNotes();
$this->query->where('notes.text', 'LIKE', sprintf('%%%s', $value));
return $this;
}
/**
* @return GroupCollectorInterface
*/
public function withoutNotes(): GroupCollectorInterface
{
$this->withNotes();
$this->query->whereNull('notes.text');
return $this;
}
/**
* @return GroupCollectorInterface
*/
public function withAnyNotes(): GroupCollectorInterface
{
$this->withNotes();
$this->query->whereNotNull('notes.text');
return $this;
}
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function notesExactly(string $value): GroupCollectorInterface
{
$this->withNotes();
$this->query->where('notes.text', '=', sprintf('%s', $value));
return $this;
}
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function notesStartWith(string $value): GroupCollectorInterface
@@ -124,7 +100,7 @@ trait MetaCollection
$this->withNotes();
$this->query->where('notes.text', 'LIKE', sprintf('%s%%', $value));
return $this;
return $this;
}
/**
@@ -221,219 +197,6 @@ trait MetaCollection
return $this;
}
/**
* Limit results to a specific tag.
*
* @param Tag $tag
*
* @return GroupCollectorInterface
*/
public function setTag(Tag $tag): GroupCollectorInterface
{
$this->withTagInformation();
$this->query->where('tag_transaction_journal.tag_id', $tag->id);
return $this;
}
/**
* Limit results to a specific set of tags.
*
* @param Collection $tags
*
* @return GroupCollectorInterface
*/
public function setTags(Collection $tags): GroupCollectorInterface
{
$this->withTagInformation();
$this->query->whereIn('tag_transaction_journal.tag_id', $tags->pluck('id')->toArray());
return $this;
}
/**
* Where has no tags.
*
* @return GroupCollectorInterface
*/
public function withoutTags(): GroupCollectorInterface
{
$this->withTagInformation();
$this->query->whereNull('tag_transaction_journal.tag_id');
return $this;
}
/**
* Where has no tags.
*
* @return GroupCollectorInterface
*/
public function hasAnyTag(): GroupCollectorInterface
{
$this->withTagInformation();
$this->query->whereNotNull('tag_transaction_journal.tag_id');
return $this;
}
/**
* Will include bill name + ID, if any.
*
* @return GroupCollectorInterface
*/
public function withBillInformation(): GroupCollectorInterface
{
if (false === $this->hasBillInformation) {
// join bill table
$this->query->leftJoin('bills', 'bills.id', '=', 'transaction_journals.bill_id');
// add fields
$this->fields[] = 'bills.id as bill_id';
$this->fields[] = 'bills.name as bill_name';
$this->hasBillInformation = true;
}
return $this;
}
/**
* Will include budget ID + name, if any.
*
* @return GroupCollectorInterface
*/
public function withBudgetInformation(): GroupCollectorInterface
{
if (false === $this->hasBudgetInformation) {
// join link table
$this->query->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
// join cat table
$this->query->leftJoin('budgets', 'budget_transaction_journal.budget_id', '=', 'budgets.id');
// add fields
$this->fields[] = 'budgets.id as budget_id';
$this->fields[] = 'budgets.name as budget_name';
$this->hasBudgetInformation = true;
}
return $this;
}
/**
* Will include category ID + name, if any.
*
* @return GroupCollectorInterface
*/
public function withCategoryInformation(): GroupCollectorInterface
{
if (false === $this->hasCatInformation) {
// join link table
$this->query->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
// join cat table
$this->query->leftJoin('categories', 'category_transaction_journal.category_id', '=', 'categories.id');
// add fields
$this->fields[] = 'categories.id as category_id';
$this->fields[] = 'categories.name as category_name';
$this->hasCatInformation = true;
}
return $this;
}
/**
* @return GroupCollectorInterface
*/
public function withTagInformation(): GroupCollectorInterface
{
$this->fields[] = 'tags.id as tag_id';
$this->fields[] = 'tags.tag as tag_name';
$this->fields[] = 'tags.date as tag_date';
$this->fields[] = 'tags.description as tag_description';
$this->fields[] = 'tags.latitude as tag_latitude';
$this->fields[] = 'tags.longitude as tag_longitude';
$this->fields[] = 'tags.zoomLevel as tag_zoom_level';
$this->joinTagTables();
return $this;
}
/**
* Limit results to a transactions without a budget..
*
* @return GroupCollectorInterface
*/
public function withoutBudget(): GroupCollectorInterface
{
$this->withBudgetInformation();
$this->query->whereNull('budget_transaction_journal.budget_id');
return $this;
}
/**
* Limit results to a transactions without a bill.
*
* @return GroupCollectorInterface
*/
public function withoutBill(): GroupCollectorInterface
{
$this->query->whereNull('transaction_journals.bill_id');
return $this;
}
/**
* Limit results to a transactions without a budget..
*
* @return GroupCollectorInterface
*/
public function withBudget(): GroupCollectorInterface
{
$this->withBudgetInformation();
$this->query->whereNotNull('budget_transaction_journal.budget_id');
return $this;
}
/**
* Limit results to a transactions without a category.
*
* @return GroupCollectorInterface
*/
public function withoutCategory(): GroupCollectorInterface
{
$this->withCategoryInformation();
$this->query->whereNull('category_transaction_journal.category_id');
return $this;
}
/**
* Limit results to a transactions without a category.
*
* @return GroupCollectorInterface
*/
public function withCategory(): GroupCollectorInterface
{
$this->withCategoryInformation();
$this->query->whereNotNull('category_transaction_journal.category_id');
return $this;
}
/**
* Join table to get tag information.
*/
protected function joinTagTables(): void
{
if (false === $this->hasJoinedTagTables) {
// join some extra tables:
$this->hasJoinedTagTables = true;
$this->query->leftJoin('tag_transaction_journal', 'tag_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
$this->query->leftJoin('tags', 'tag_transaction_journal.tag_id', '=', 'tags.id');
}
}
/**
* @inheritDoc
*/
@@ -465,5 +228,248 @@ trait MetaCollection
return $this;
}
/**
* Limit results to a specific tag.
*
* @param Tag $tag
*
* @return GroupCollectorInterface
*/
public function setTag(Tag $tag): GroupCollectorInterface
{
$this->withTagInformation();
$this->query->where('tag_transaction_journal.tag_id', $tag->id);
return $this;
}
/**
* Limit results to a specific set of tags.
*
* @param Collection $tags
*
* @return GroupCollectorInterface
*/
public function setTags(Collection $tags): GroupCollectorInterface
{
$this->withTagInformation();
$this->query->whereIn('tag_transaction_journal.tag_id', $tags->pluck('id')->toArray());
return $this;
}
/**
* @return GroupCollectorInterface
*/
public function withAnyNotes(): GroupCollectorInterface
{
$this->withNotes();
$this->query->whereNotNull('notes.text');
return $this;
}
/**
* Will include bill name + ID, if any.
*
* @return GroupCollectorInterface
*/
public function withBillInformation(): GroupCollectorInterface
{
if (false === $this->hasBillInformation) {
// join bill table
$this->query->leftJoin('bills', 'bills.id', '=', 'transaction_journals.bill_id');
// add fields
$this->fields[] = 'bills.id as bill_id';
$this->fields[] = 'bills.name as bill_name';
$this->hasBillInformation = true;
}
return $this;
}
/**
* Limit results to a transactions without a budget..
*
* @return GroupCollectorInterface
*/
public function withBudget(): GroupCollectorInterface
{
$this->withBudgetInformation();
$this->query->whereNotNull('budget_transaction_journal.budget_id');
return $this;
}
/**
* Will include budget ID + name, if any.
*
* @return GroupCollectorInterface
*/
public function withBudgetInformation(): GroupCollectorInterface
{
if (false === $this->hasBudgetInformation) {
// join link table
$this->query->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
// join cat table
$this->query->leftJoin('budgets', 'budget_transaction_journal.budget_id', '=', 'budgets.id');
// add fields
$this->fields[] = 'budgets.id as budget_id';
$this->fields[] = 'budgets.name as budget_name';
$this->hasBudgetInformation = true;
}
return $this;
}
/**
* Limit results to a transactions without a category.
*
* @return GroupCollectorInterface
*/
public function withCategory(): GroupCollectorInterface
{
$this->withCategoryInformation();
$this->query->whereNotNull('category_transaction_journal.category_id');
return $this;
}
/**
* Will include category ID + name, if any.
*
* @return GroupCollectorInterface
*/
public function withCategoryInformation(): GroupCollectorInterface
{
if (false === $this->hasCatInformation) {
// join link table
$this->query->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
// join cat table
$this->query->leftJoin('categories', 'category_transaction_journal.category_id', '=', 'categories.id');
// add fields
$this->fields[] = 'categories.id as category_id';
$this->fields[] = 'categories.name as category_name';
$this->hasCatInformation = true;
}
return $this;
}
/**
* @inheritDoc
*/
public function withNotes(): GroupCollectorInterface
{
if (false === $this->hasNotesInformation) {
// join bill table
$this->query->leftJoin(
'notes',
static function (JoinClause $join) {
$join->on('notes.noteable_id', '=', 'transaction_journals.id');
$join->where('notes.noteable_type', '=', 'FireflyIII\Models\TransactionJournal');
}
);
// add fields
$this->fields[] = 'notes.text as notes';
$this->hasNotesInformation = true;
}
return $this;
}
/**
* @return GroupCollectorInterface
*/
public function withTagInformation(): GroupCollectorInterface
{
$this->fields[] = 'tags.id as tag_id';
$this->fields[] = 'tags.tag as tag_name';
$this->fields[] = 'tags.date as tag_date';
$this->fields[] = 'tags.description as tag_description';
$this->fields[] = 'tags.latitude as tag_latitude';
$this->fields[] = 'tags.longitude as tag_longitude';
$this->fields[] = 'tags.zoomLevel as tag_zoom_level';
$this->joinTagTables();
return $this;
}
/**
* Limit results to a transactions without a bill.
*
* @return GroupCollectorInterface
*/
public function withoutBill(): GroupCollectorInterface
{
$this->query->whereNull('transaction_journals.bill_id');
return $this;
}
/**
* Limit results to a transactions without a budget..
*
* @return GroupCollectorInterface
*/
public function withoutBudget(): GroupCollectorInterface
{
$this->withBudgetInformation();
$this->query->whereNull('budget_transaction_journal.budget_id');
return $this;
}
/**
* Limit results to a transactions without a category.
*
* @return GroupCollectorInterface
*/
public function withoutCategory(): GroupCollectorInterface
{
$this->withCategoryInformation();
$this->query->whereNull('category_transaction_journal.category_id');
return $this;
}
/**
* @return GroupCollectorInterface
*/
public function withoutNotes(): GroupCollectorInterface
{
$this->withNotes();
$this->query->whereNull('notes.text');
return $this;
}
/**
* Where has no tags.
*
* @return GroupCollectorInterface
*/
public function withoutTags(): GroupCollectorInterface
{
$this->withTagInformation();
$this->query->whereNull('tag_transaction_journal.tag_id');
return $this;
}
/**
* Join table to get tag information.
*/
protected function joinTagTables(): void
{
if (false === $this->hasJoinedTagTables) {
// join some extra tables:
$this->hasJoinedTagTables = true;
$this->query->leftJoin('tag_transaction_journal', 'tag_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
$this->query->leftJoin('tags', 'tag_transaction_journal.tag_id', '=', 'tags.id');
}
}
}

View File

@@ -126,14 +126,76 @@ class GroupCollector implements GroupCollectorInterface
}
/**
*
* @inheritDoc
*/
public function dumpQuery(): void
public function descriptionEnds(array $array): GroupCollectorInterface
{
echo $this->query->select($this->fields)->toSql();
echo '<pre>';
print_r($this->query->getBindings());
echo '</pre>';
$this->query->where(
static function (EloquentBuilder $q) use ($array) {
$q->where(
static function (EloquentBuilder $q1) use ($array) {
foreach ($array as $word) {
$keyword = sprintf('%%%s', $word);
$q1->where('transaction_journals.description', 'LIKE', $keyword);
}
}
);
$q->orWhere(
static function (EloquentBuilder $q2) use ($array) {
foreach ($array as $word) {
$keyword = sprintf('%%%s', $word);
$q2->where('transaction_groups.title', 'LIKE', $keyword);
}
}
);
}
);
return $this;
}
/**
* @inheritDoc
*/
public function descriptionIs(string $value): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($value) {
$q->where('transaction_journals.description', '=', $value);
$q->orWhere('transaction_groups.title', '=', $value);
}
);
return $this;
}
/**
* @inheritDoc
*/
public function descriptionStarts(array $array): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($array) {
$q->where(
static function (EloquentBuilder $q1) use ($array) {
foreach ($array as $word) {
$keyword = sprintf('%s%%', $word);
$q1->where('transaction_journals.description', 'LIKE', $keyword);
}
}
);
$q->orWhere(
static function (EloquentBuilder $q2) use ($array) {
foreach ($array as $word) {
$keyword = sprintf('%s%%', $word);
$q2->where('transaction_groups.title', 'LIKE', $keyword);
}
}
);
}
);
return $this;
}
/**
@@ -209,6 +271,19 @@ class GroupCollector implements GroupCollectorInterface
return new LengthAwarePaginator($set, $this->total, $this->limit, $this->page);
}
/**
* Has attachments
*
* @return GroupCollectorInterface
*/
public function hasAttachments(): GroupCollectorInterface
{
Log::debug('Add filter on attachment ID.');
$this->joinAttachmentTables();
$this->query->whereNotNull('attachments.attachable_id');
return $this;
}
/**
* Limit results to a specific currency, either foreign or normal one.
@@ -239,6 +314,21 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
/**
* Limit the result to a set of specific transaction groups.
*
* @param array $groupIds
*
* @return GroupCollectorInterface
*/
public function setIds(array $groupIds): GroupCollectorInterface
{
$this->query->whereIn('transaction_groups.id', $groupIds);
return $this;
}
/**
* Limit the result to a set of specific journals.
*
@@ -255,20 +345,6 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
/**
* Limit the result to a set of specific transaction groups.
*
* @param array $groupIds
*
* @return GroupCollectorInterface
*/
public function setIds(array $groupIds): GroupCollectorInterface {
$this->query->whereIn('transaction_groups.id', $groupIds);
return $this;
}
/**
* Limit the number of returned entries.
*
@@ -333,80 +409,6 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
/**
* @inheritDoc
*/
public function descriptionStarts(array $array): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($array) {
$q->where(
static function (EloquentBuilder $q1) use ($array) {
foreach ($array as $word) {
$keyword = sprintf('%s%%', $word);
$q1->where('transaction_journals.description', 'LIKE', $keyword);
}
}
);
$q->orWhere(
static function (EloquentBuilder $q2) use ($array) {
foreach ($array as $word) {
$keyword = sprintf('%s%%', $word);
$q2->where('transaction_groups.title', 'LIKE', $keyword);
}
}
);
}
);
return $this;
}
/**
* @inheritDoc
*/
public function descriptionEnds(array $array): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($array) {
$q->where(
static function (EloquentBuilder $q1) use ($array) {
foreach ($array as $word) {
$keyword = sprintf('%%%s', $word);
$q1->where('transaction_journals.description', 'LIKE', $keyword);
}
}
);
$q->orWhere(
static function (EloquentBuilder $q2) use ($array) {
foreach ($array as $word) {
$keyword = sprintf('%%%s', $word);
$q2->where('transaction_groups.title', 'LIKE', $keyword);
}
}
);
}
);
return $this;
}
/**
* @inheritDoc
*/
public function descriptionIs(string $value): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($value) {
$q->where('transaction_journals.description', '=', $value);
$q->orWhere('transaction_groups.title', '=', $value);
}
);
return $this;
}
/**
* Limit the search to one specific transaction group.
*
@@ -483,35 +485,47 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
/**
* Convert a selected set of fields to arrays.
*
* @param array $array
*
* @return array
* Build the query.
*/
private function convertToInteger(array $array): array
private function startQuery(): void
{
foreach ($this->integerFields as $field) {
$array[$field] = array_key_exists($field, $array) ? (int)$array[$field] : null;
}
//app('log')->debug('GroupCollector::startQuery');
$this->query = $this->user
//->transactionGroups()
//->leftJoin('transaction_journals', 'transaction_journals.transaction_group_id', 'transaction_groups.id')
->transactionJournals()
->leftJoin('transaction_groups', 'transaction_journals.transaction_group_id', 'transaction_groups.id')
return $array;
}
/**
* Has attachments
*
* @return GroupCollectorInterface
*/
public function hasAttachments(): GroupCollectorInterface
{
Log::debug('Add filter on attachment ID.');
$this->joinAttachmentTables();
$this->query->whereNotNull('attachments.attachable_id');
return $this;
// join source transaction.
->leftJoin(
'transactions as source',
function (JoinClause $join) {
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id')
->where('source.amount', '<', 0);
}
)
// join destination transaction
->leftJoin(
'transactions as destination',
function (JoinClause $join) {
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')
->where('destination.amount', '>', 0);
}
)
// left join transaction type.
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
->leftJoin('transaction_currencies as currency', 'currency.id', '=', 'source.transaction_currency_id')
->leftJoin('transaction_currencies as foreign_currency', 'foreign_currency.id', '=', 'source.foreign_currency_id')
->whereNull('transaction_groups.deleted_at')
->whereNull('transaction_journals.deleted_at')
->whereNull('source.deleted_at')
->whereNull('destination.deleted_at')
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC')
->orderBy('transaction_journals.description', 'DESC')
->orderBy('source.amount', 'DESC');
}
/**
@@ -533,6 +547,33 @@ class GroupCollector implements GroupCollectorInterface
}
}
/**
*
*/
public function dumpQuery(): void
{
echo $this->query->select($this->fields)->toSql();
echo '<pre>';
print_r($this->query->getBindings());
echo '</pre>';
}
/**
* Convert a selected set of fields to arrays.
*
* @param array $array
*
* @return array
*/
private function convertToInteger(array $array): array
{
foreach ($this->integerFields as $field) {
$array[$field] = array_key_exists($field, $array) ? (int)$array[$field] : null;
}
return $array;
}
/**
* @param array $existingJournal
* @param TransactionJournal $newJournal
@@ -735,47 +776,4 @@ class GroupCollector implements GroupCollectorInterface
return $groups;
}
/**
* Build the query.
*/
private function startQuery(): void
{
//app('log')->debug('GroupCollector::startQuery');
$this->query = $this->user
//->transactionGroups()
//->leftJoin('transaction_journals', 'transaction_journals.transaction_group_id', 'transaction_groups.id')
->transactionJournals()
->leftJoin('transaction_groups', 'transaction_journals.transaction_group_id', 'transaction_groups.id')
// join source transaction.
->leftJoin(
'transactions as source',
function (JoinClause $join) {
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id')
->where('source.amount', '<', 0);
}
)
// join destination transaction
->leftJoin(
'transactions as destination',
function (JoinClause $join) {
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')
->where('destination.amount', '>', 0);
}
)
// left join transaction type.
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
->leftJoin('transaction_currencies as currency', 'currency.id', '=', 'source.transaction_currency_id')
->leftJoin('transaction_currencies as foreign_currency', 'foreign_currency.id', '=', 'source.foreign_currency_id')
->whereNull('transaction_groups.deleted_at')
->whereNull('transaction_journals.deleted_at')
->whereNull('source.deleted_at')
->whereNull('destination.deleted_at')
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC')
->orderBy('transaction_journals.description', 'DESC')
->orderBy('source.amount', 'DESC');
}
}

View File

@@ -66,6 +66,33 @@ interface GroupCollectorInterface
*/
public function amountMore(string $amount): GroupCollectorInterface;
/**
* End of the description must match:
*
* @param array $array
*
* @return GroupCollectorInterface
*/
public function descriptionEnds(array $array): GroupCollectorInterface;
/**
* Description must be:
*
* @param string $value
*
* @return GroupCollectorInterface
*/
public function descriptionIs(string $value): GroupCollectorInterface;
/**
* Beginning of the description must match:
*
* @param array $array
*
* @return GroupCollectorInterface
*/
public function descriptionStarts(array $array): GroupCollectorInterface;
/**
* Exclude destination accounts.
*
@@ -105,6 +132,46 @@ interface GroupCollectorInterface
*/
public function getPaginatedGroups(): LengthAwarePaginator;
/**
* @return GroupCollectorInterface
*/
public function hasAnyTag(): GroupCollectorInterface;
/**
* Has attachments
*
* @return GroupCollectorInterface
*/
public function hasAttachments(): GroupCollectorInterface;
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function notesContain(string $value): GroupCollectorInterface;
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function notesEndWith(string $value): GroupCollectorInterface;
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function notesExactly(string $value): GroupCollectorInterface;
/**
* @param string $value
*
* @return GroupCollectorInterface
*/
public function notesStartWith(string $value): GroupCollectorInterface;
/**
* Define which accounts can be part of the source and destination transactions.
*
@@ -213,15 +280,6 @@ interface GroupCollectorInterface
*/
public function setCurrency(TransactionCurrency $currency): GroupCollectorInterface;
/**
* Limit results to a specific foreign currency.
*
* @param TransactionCurrency $currency
*
* @return GroupCollectorInterface
*/
public function setForeignCurrency(TransactionCurrency $currency): GroupCollectorInterface;
/**
* Set destination accounts.
*
@@ -232,13 +290,22 @@ interface GroupCollectorInterface
public function setDestinationAccounts(Collection $accounts): GroupCollectorInterface;
/**
* Limit the result to a set of specific transaction journals.
* Look for specific external ID's.
*
* @param array $journalIds
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function setJournalIds(array $journalIds): GroupCollectorInterface;
public function setExternalId(string $externalId): GroupCollectorInterface;
/**
* Limit results to a specific foreign currency.
*
* @param TransactionCurrency $currency
*
* @return GroupCollectorInterface
*/
public function setForeignCurrency(TransactionCurrency $currency): GroupCollectorInterface;
/**
* Limit the result to a set of specific transaction groups.
@@ -249,6 +316,24 @@ interface GroupCollectorInterface
*/
public function setIds(array $groupIds): GroupCollectorInterface;
/**
* Look for specific external ID's.
*
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function setInternalReference(string $externalId): GroupCollectorInterface;
/**
* Limit the result to a set of specific transaction journals.
*
* @param array $journalIds
*
* @return GroupCollectorInterface
*/
public function setJournalIds(array $journalIds): GroupCollectorInterface;
/**
* Limit the number of returned entries.
*
@@ -286,33 +371,6 @@ interface GroupCollectorInterface
*/
public function setSearchWords(array $array): GroupCollectorInterface;
/**
* Beginning of the description must match:
*
* @param array $array
*
* @return GroupCollectorInterface
*/
public function descriptionStarts(array $array): GroupCollectorInterface;
/**
* End of the description must match:
*
* @param array $array
*
* @return GroupCollectorInterface
*/
public function descriptionEnds(array $array): GroupCollectorInterface;
/**
* Description must be:
*
* @param string $value
*
* @return GroupCollectorInterface
*/
public function descriptionIs(string $value): GroupCollectorInterface;
/**
* Set source accounts.
*
@@ -340,16 +398,6 @@ interface GroupCollectorInterface
*/
public function setTags(Collection $tags): GroupCollectorInterface;
/**
* @return GroupCollectorInterface
*/
public function withoutTags(): GroupCollectorInterface;
/**
* @return GroupCollectorInterface
*/
public function hasAnyTag(): GroupCollectorInterface;
/**
* Limit the search to one specific transaction group.
*
@@ -409,6 +457,13 @@ interface GroupCollectorInterface
*/
public function withAccountInformation(): GroupCollectorInterface;
/**
* Any notes, no matter what.
*
* @return GroupCollectorInterface
*/
public function withAnyNotes(): GroupCollectorInterface;
/**
* Add basic info on attachments of transactions.
*
@@ -416,13 +471,6 @@ interface GroupCollectorInterface
*/
public function withAttachmentInformation(): GroupCollectorInterface;
/**
* Has attachments
*
* @return GroupCollectorInterface
*/
public function hasAttachments(): GroupCollectorInterface;
/**
* Include bill name + ID.
*
@@ -430,6 +478,13 @@ interface GroupCollectorInterface
*/
public function withBillInformation(): GroupCollectorInterface;
/**
* Limit results to a transactions with a budget.
*
* @return GroupCollectorInterface
*/
public function withBudget(): GroupCollectorInterface;
/**
* Will include budget ID + name, if any.
*
@@ -437,6 +492,13 @@ interface GroupCollectorInterface
*/
public function withBudgetInformation(): GroupCollectorInterface;
/**
* Limit results to a transactions with a category.
*
* @return GroupCollectorInterface
*/
public function withCategory(): GroupCollectorInterface;
/**
* Will include category ID + name, if any.
*
@@ -451,42 +513,6 @@ interface GroupCollectorInterface
*/
public function withNotes(): GroupCollectorInterface;
/**
* Any notes, no matter what.
*
* @return GroupCollectorInterface
*/
public function withAnyNotes(): GroupCollectorInterface;
/**
* @param string $value
* @return GroupCollectorInterface
*/
public function notesContain(string $value): GroupCollectorInterface;
/**
* @param string $value
* @return GroupCollectorInterface
*/
public function withoutNotes(): GroupCollectorInterface;
/**
* @param string $value
* @return GroupCollectorInterface
*/
public function notesStartWith(string $value): GroupCollectorInterface;
/**
* @param string $value
* @return GroupCollectorInterface
*/
public function notesEndWith(string $value): GroupCollectorInterface;
/**
* @param string $value
* @return GroupCollectorInterface
*/
public function notesExactly(string $value): GroupCollectorInterface;
/**
* Add tag info.
*
@@ -494,13 +520,6 @@ interface GroupCollectorInterface
*/
public function withTagInformation(): GroupCollectorInterface;
/**
* Limit results to a transactions without a budget.
*
* @return GroupCollectorInterface
*/
public function withoutBudget(): GroupCollectorInterface;
/**
* Limit results to a transactions without a bill.
*
@@ -508,6 +527,13 @@ interface GroupCollectorInterface
*/
public function withoutBill(): GroupCollectorInterface;
/**
* Limit results to a transactions without a budget.
*
* @return GroupCollectorInterface
*/
public function withoutBudget(): GroupCollectorInterface;
/**
* Limit results to a transactions without a category.
*
@@ -516,35 +542,15 @@ interface GroupCollectorInterface
public function withoutCategory(): GroupCollectorInterface;
/**
* Limit results to a transactions with a category.
* @param string $value
*
* @return GroupCollectorInterface
*/
public function withCategory(): GroupCollectorInterface;
public function withoutNotes(): GroupCollectorInterface;
/**
* Limit results to a transactions with a budget.
*
* @return GroupCollectorInterface
*/
public function withBudget(): GroupCollectorInterface;
/**
* Look for specific external ID's.
*
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function setExternalId(string $externalId): GroupCollectorInterface;
/**
* Look for specific external ID's.
*
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function setInternalReference(string $externalId): GroupCollectorInterface;
public function withoutTags(): GroupCollectorInterface;
}