Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

I get "AttributeError: type object 'Pivot' has no attribute 'boot_pivot'" when using morph_to_many #402

Open
RezDev94 opened this issue Dec 15, 2021 · 0 comments

Comments

@RezDev94
Copy link

Here is the error

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\orator\orm\model.py", line 64, in __getattr__
    return type.__getattribute__(cls, item)
AttributeError: type object 'Pivot' has no attribute 'boot_pivot'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\orator\orm\builder.py", line 215, in get
    models = self.eager_load_relations(models)
  File "C:\Python310\lib\site-packages\orator\orm\builder.py", line 475, in eager_load_relations
    models = self._load_relation(models, name, constraints)
  File "C:\Python310\lib\site-packages\orator\orm\builder.py", line 496, in _load_relation
    results = relation.get_eager()
  File "C:\Python310\lib\site-packages\orator\orm\relations\relation.py", line 75, in get_eager
    return self.get()
  File "C:\Python310\lib\site-packages\orator\orm\relations\belongs_to_many.py", line 152, in get
    self._hydrate_pivot_relation(models)
  File "C:\Python310\lib\site-packages\orator\orm\relations\belongs_to_many.py", line 166, in _hydrate_pivot_relation
    pivot = self.new_existing_pivot(self._clean_pivot_attributes(model))
  File "C:\Python310\lib\site-packages\orator\orm\relations\belongs_to_many.py", line 817, in new_existing_pivot
    return self.new_pivot(attributes, True)
  File "C:\Python310\lib\site-packages\orator\orm\relations\morph_to_many.py", line 110, in new_pivot
    pivot = MorphPivot(self._parent, attributes, self._table, exists)
  File "C:\Python310\lib\site-packages\orator\orm\relations\pivot.py", line 27, in __init__
    super(Pivot, self).__init__()
  File "C:\Python310\lib\site-packages\orator\orm\model.py", line 129, in __init__
    self._boot_if_not_booted()
  File "C:\Python310\lib\site-packages\orator\orm\model.py", line 156, in _boot_if_not_booted
    klass._boot()
  File "C:\Python310\lib\site-packages\orator\orm\model.py", line 174, in _boot
    cls._boot_mixins()
  File "C:\Python310\lib\site-packages\orator\orm\model.py", line 194, in _boot_mixins
    if hasattr(mixin, method):
  File "C:\Python310\lib\site-packages\orator\orm\model.py", line 66, in __getattr__
    query = cls.query()
  File "C:\Python310\lib\site-packages\orator\orm\model.py", line 1922, in query
    return cls().new_query()
TypeError: Pivot.__init__() missing 3 required positional arguments: 'parent', 'attributes', and 'table'
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant