mirror of https://github.com/nextcloud/bookmarks
fix(BookmarkWithTagsAndParent): Avoid requerying tags if a bookmark has no tags
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
parent
3d51a44fd0
commit
c2213b9e09
|
@ -23,12 +23,18 @@ class BookmarkWithTagsAndParent extends Bookmark {
|
||||||
public function toArray(): array {
|
public function toArray(): array {
|
||||||
$array = [];
|
$array = [];
|
||||||
foreach (self::$fields as $field) {
|
foreach (self::$fields as $field) {
|
||||||
if ($field === 'tags' && is_string($this->{$field})) {
|
if ($field === 'tags') {
|
||||||
$array[$field] = $this->{$field} === ''? [] : array_values(array_unique(explode(',', $this->{$field})));
|
if (is_string($this->{$field})) {
|
||||||
continue;
|
$array[$field] = $this->{$field} === '' ? [] : array_values(array_unique(explode(',', $this->{$field})));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($this->{$field} === null) {
|
||||||
|
$array[$field] = [];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($field === 'folders') {
|
if ($field === 'folders') {
|
||||||
if ($this->{$field} === '') {
|
if ($this->{$field} === '' || $this->{$field} === null) {
|
||||||
$array[$field] = [];
|
$array[$field] = [];
|
||||||
} else {
|
} else {
|
||||||
$array[$field] = array_values(array_unique(array_map(static function ($id) {
|
$array[$field] = array_values(array_unique(array_map(static function ($id) {
|
||||||
|
|
Loading…
Reference in New Issue