mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-09 14:18:59 +00:00
Catch empty tags.
This commit is contained in:
@@ -70,8 +70,10 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
$tagRepository = App::make('FireflyIII\Repositories\Tag\TagRepositoryInterface');
|
$tagRepository = App::make('FireflyIII\Repositories\Tag\TagRepositoryInterface');
|
||||||
|
|
||||||
foreach ($array as $name) {
|
foreach ($array as $name) {
|
||||||
$tag = Tag::firstOrCreateEncrypted(['tag' => $name, 'user_id' => $journal->user_id]);
|
if (strlen(trim($name)) > 0) {
|
||||||
$tagRepository->connect($journal, $tag);
|
$tag = Tag::firstOrCreateEncrypted(['tag' => $name, 'user_id' => $journal->user_id]);
|
||||||
|
$tagRepository->connect($journal, $tag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,9 +219,11 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
$tags = [];
|
$tags = [];
|
||||||
$ids = [];
|
$ids = [];
|
||||||
foreach ($array as $name) {
|
foreach ($array as $name) {
|
||||||
$tag = Tag::firstOrCreateEncrypted(['tag' => $name, 'user_id' => $journal->user_id]);
|
if (strlen(trim($name)) > 0) {
|
||||||
$tags[] = $tag;
|
$tag = Tag::firstOrCreateEncrypted(['tag' => $name, 'user_id' => $journal->user_id]);
|
||||||
$ids[] = $tag->id;
|
$tags[] = $tag;
|
||||||
|
$ids[] = $tag->id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete all tags connected to journal not in this array:
|
// delete all tags connected to journal not in this array:
|
||||||
|
Reference in New Issue
Block a user