Describe the bug
When one-to-many relationships is eager-loaded (using the _with function) from a record, the serialized value for the related field is set as None.
To Reproduce
class Category(Model):
__hidden__ = [
'id',
'created_at',
'updated_at'
]
@belongs_to('website_id', 'id')
def websites(self):
return Website
class Website(Model, SoftDeletesMixin):
__appends__ = [
'categories',
]
@has_many('id', 'website_id')
def categories(self):
return Category
data = Website.with_('categories').first().serialize()
print(data) # data["categories"] is None
Expected behavior
The serialized value for the related field should be set as an empty array.
Desktop (please complete the following information):
OS: Linux
Version: Ubuntu 22.04
What database are you using?
Type: [MySQL]
Version [14.14 Distrib 5.7.30, for Linux (x86_64) using EditLine wrapper]
Describe the bug When one-to-many relationships is eager-loaded (using the
_with
function) from a record, the serialized value for the related field is set as None.To Reproduce
Expected behavior The serialized value for the related field should be set as an empty array.
Desktop (please complete the following information):
What database are you using?