Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maximum Recursion Depth issue while using Accessor #462

Closed
ghost opened this issue May 17, 2021 · 1 comment
Closed

Maximum Recursion Depth issue while using Accessor #462

ghost opened this issue May 17, 2021 · 1 comment

Comments

@ghost
Copy link

ghost commented May 17, 2021

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

class Member(Model, SoftDeletesMixin):
    """Member Model."""
    
    __fillable__ = ["unique_hash", "first_name", "middle_name", "last_name", "email", "email_verified_at", "phone", "phone_verified_at",]

    __hidden__ = ['password']

    __auth__ = "email"

    def get_email_attribute(self):
        return self.email.upper() # simple demonstration on getting upper case letter

Screen Shot 2021-05-17 at 4 50 58 PM

Screen Shot 2021-05-17 at 5 07 24 PM

@josephmancuso
Copy link
Member

You cannot call self.email within a get_email_attribute method because you will get an infinite recursion (the self.email calls the get_email_attribute which calls self.email again forever).

You will need to call another method to get that attribute:

    def get_email_attribute(self):
        return self.get_raw_attribute('email').upper() # simple demonstration on getting upper case letter

@josephmancuso josephmancuso transferred this issue from MasoniteFramework/masonite May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant