mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 01:06:46 +00:00
Fixed a bug in tag creation.
This commit is contained in:
@@ -35,6 +35,7 @@ class TagsComma extends BasicConverter implements ConverterInterface
|
||||
|
||||
if (strlen($value) === 0) {
|
||||
$this->setCertainty(0);
|
||||
|
||||
return new Collection;
|
||||
}
|
||||
$parts = array_unique(explode(',', $value));
|
||||
@@ -63,8 +64,8 @@ class TagsComma extends BasicConverter implements ConverterInterface
|
||||
Log::debug('Found tag by name ', ['id' => $tag->id]);
|
||||
|
||||
$set->push($tag);
|
||||
continue;
|
||||
}
|
||||
if (is_null($tag->id)) {
|
||||
// create new tag
|
||||
$tag = $repository->store(
|
||||
[
|
||||
@@ -80,6 +81,7 @@ class TagsComma extends BasicConverter implements ConverterInterface
|
||||
Log::debug('Created new tag', ['name' => $part, 'id' => $tag->id]);
|
||||
$set->push($tag);
|
||||
}
|
||||
}
|
||||
$this->setCertainty(100);
|
||||
|
||||
return $set;
|
||||
|
@@ -35,6 +35,7 @@ class TagsSpace extends BasicConverter implements ConverterInterface
|
||||
|
||||
if (strlen($value) === 0) {
|
||||
$this->setCertainty(0);
|
||||
|
||||
return new Collection;
|
||||
}
|
||||
$parts = array_unique(explode(' ', $value));
|
||||
@@ -63,8 +64,8 @@ class TagsSpace extends BasicConverter implements ConverterInterface
|
||||
Log::debug('Found tag by name ', ['id' => $tag->id]);
|
||||
|
||||
$set->push($tag);
|
||||
continue;
|
||||
}
|
||||
if (is_null($tag->id)) {
|
||||
// create new tag
|
||||
$tag = $repository->store(
|
||||
[
|
||||
@@ -80,6 +81,7 @@ class TagsSpace extends BasicConverter implements ConverterInterface
|
||||
Log::debug('Created new tag', ['name' => $part, 'id' => $tag->id]);
|
||||
$set->push($tag);
|
||||
}
|
||||
}
|
||||
$this->setCertainty(100);
|
||||
|
||||
return $set;
|
||||
|
@@ -106,9 +106,9 @@ class TagRepository implements TagRepositoryInterface
|
||||
{
|
||||
$tags = $this->user->tags()->get();
|
||||
/** @var Tag $tag */
|
||||
foreach ($tags as $tag) {
|
||||
if ($tag->tag === $tag) {
|
||||
return $tag;
|
||||
foreach ($tags as $databaseTag) {
|
||||
if ($databaseTag->tag === $tag) {
|
||||
return $databaseTag;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user