mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 22:21:42 +00:00
Update API for tags.
This commit is contained in:
@@ -34,6 +34,11 @@ use Log;
|
||||
*/
|
||||
class TagFactory
|
||||
{
|
||||
/** @var Collection */
|
||||
private $tags;
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
@@ -44,11 +49,6 @@ class TagFactory
|
||||
}
|
||||
}
|
||||
|
||||
/** @var Collection */
|
||||
private $tags;
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
@@ -56,6 +56,10 @@ class TagFactory
|
||||
*/
|
||||
public function create(array $data): ?Tag
|
||||
{
|
||||
$zoomLevel = 0 === (int)$data['zoom_level'] ? null : (int)$data['zoom_level'];
|
||||
$latitude = 0.0 === (float)$data['latitude'] ? null : (float)$data['latitude'];
|
||||
$longitude = 0.0 === (float)$data['longitude'] ? null : (int)$data['longitude'];
|
||||
|
||||
return Tag::create(
|
||||
[
|
||||
'user_id' => $this->user->id,
|
||||
@@ -63,9 +67,9 @@ class TagFactory
|
||||
'tagMode' => 'nothing',
|
||||
'date' => $data['date'],
|
||||
'description' => $data['description'],
|
||||
'latitude' => $data['latitude'],
|
||||
'longitude ' => $data['longitude'],
|
||||
'zoomLevel' => $data['zoom_level'],
|
||||
'latitude' => $latitude,
|
||||
'longitude ' => $longitude,
|
||||
'zoomLevel' => $zoomLevel,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user