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 {
|
||||
$array = [];
|
||||
foreach (self::$fields as $field) {
|
||||
if ($field === 'tags' && is_string($this->{$field})) {
|
||||
$array[$field] = $this->{$field} === ''? [] : array_values(array_unique(explode(',', $this->{$field})));
|
||||
continue;
|
||||
if ($field === 'tags') {
|
||||
if (is_string($this->{$field})) {
|
||||
$array[$field] = $this->{$field} === '' ? [] : array_values(array_unique(explode(',', $this->{$field})));
|
||||
continue;
|
||||
}
|
||||
if ($this->{$field} === null) {
|
||||
$array[$field] = [];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ($field === 'folders') {
|
||||
if ($this->{$field} === '') {
|
||||
if ($this->{$field} === '' || $this->{$field} === null) {
|
||||
$array[$field] = [];
|
||||
} else {
|
||||
$array[$field] = array_values(array_unique(array_map(static function ($id) {
|
||||
|
|
Loading…
Reference in New Issue