mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-14 08:11:20 +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) {
|
if (strlen($value) === 0) {
|
||||||
$this->setCertainty(0);
|
$this->setCertainty(0);
|
||||||
|
|
||||||
return new Collection;
|
return new Collection;
|
||||||
}
|
}
|
||||||
$parts = array_unique(explode(',', $value));
|
$parts = array_unique(explode(',', $value));
|
||||||
@@ -63,22 +64,23 @@ class TagsComma extends BasicConverter implements ConverterInterface
|
|||||||
Log::debug('Found tag by name ', ['id' => $tag->id]);
|
Log::debug('Found tag by name ', ['id' => $tag->id]);
|
||||||
|
|
||||||
$set->push($tag);
|
$set->push($tag);
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
// create new tag
|
if (is_null($tag->id)) {
|
||||||
$tag = $repository->store(
|
// create new tag
|
||||||
[
|
$tag = $repository->store(
|
||||||
'tag' => $part,
|
[
|
||||||
'date' => null,
|
'tag' => $part,
|
||||||
'description' => $part,
|
'date' => null,
|
||||||
'latitude' => null,
|
'description' => $part,
|
||||||
'longitude' => null,
|
'latitude' => null,
|
||||||
'zoomLevel' => null,
|
'longitude' => null,
|
||||||
'tagMode' => 'nothing',
|
'zoomLevel' => null,
|
||||||
]
|
'tagMode' => 'nothing',
|
||||||
);
|
]
|
||||||
Log::debug('Created new tag', ['name' => $part, 'id' => $tag->id]);
|
);
|
||||||
$set->push($tag);
|
Log::debug('Created new tag', ['name' => $part, 'id' => $tag->id]);
|
||||||
|
$set->push($tag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->setCertainty(100);
|
$this->setCertainty(100);
|
||||||
|
|
||||||
|
@@ -35,6 +35,7 @@ class TagsSpace extends BasicConverter implements ConverterInterface
|
|||||||
|
|
||||||
if (strlen($value) === 0) {
|
if (strlen($value) === 0) {
|
||||||
$this->setCertainty(0);
|
$this->setCertainty(0);
|
||||||
|
|
||||||
return new Collection;
|
return new Collection;
|
||||||
}
|
}
|
||||||
$parts = array_unique(explode(' ', $value));
|
$parts = array_unique(explode(' ', $value));
|
||||||
@@ -63,22 +64,23 @@ class TagsSpace extends BasicConverter implements ConverterInterface
|
|||||||
Log::debug('Found tag by name ', ['id' => $tag->id]);
|
Log::debug('Found tag by name ', ['id' => $tag->id]);
|
||||||
|
|
||||||
$set->push($tag);
|
$set->push($tag);
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
// create new tag
|
if (is_null($tag->id)) {
|
||||||
$tag = $repository->store(
|
// create new tag
|
||||||
[
|
$tag = $repository->store(
|
||||||
'tag' => $part,
|
[
|
||||||
'date' => null,
|
'tag' => $part,
|
||||||
'description' => $part,
|
'date' => null,
|
||||||
'latitude' => null,
|
'description' => $part,
|
||||||
'longitude' => null,
|
'latitude' => null,
|
||||||
'zoomLevel' => null,
|
'longitude' => null,
|
||||||
'tagMode' => 'nothing',
|
'zoomLevel' => null,
|
||||||
]
|
'tagMode' => 'nothing',
|
||||||
);
|
]
|
||||||
Log::debug('Created new tag', ['name' => $part, 'id' => $tag->id]);
|
);
|
||||||
$set->push($tag);
|
Log::debug('Created new tag', ['name' => $part, 'id' => $tag->id]);
|
||||||
|
$set->push($tag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->setCertainty(100);
|
$this->setCertainty(100);
|
||||||
|
|
||||||
|
@@ -106,9 +106,9 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
{
|
{
|
||||||
$tags = $this->user->tags()->get();
|
$tags = $this->user->tags()->get();
|
||||||
/** @var Tag $tag */
|
/** @var Tag $tag */
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $databaseTag) {
|
||||||
if ($tag->tag === $tag) {
|
if ($databaseTag->tag === $tag) {
|
||||||
return $tag;
|
return $databaseTag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user