Skip to content

Prevent getAttribute() from calling static methods #383

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

Closed
wants to merge 1 commit into from
Closed

Prevent getAttribute() from calling static methods #383

wants to merge 1 commit into from

Conversation

nsmithuk
Copy link
Contributor

I hit an issue after upgrading to v2 that I could no longer access attributes that had the same name as static method declared on Jenssegers\Mongodb\Model (or its parents).

For example I had attributes called 'updated' and 'deleted'. When trying to access $model->updated, PHP threw a fatal error because $relations = $this->$camelKey(); tried calling \Illuminate\Database\Eloquent\Model::updated($callback).

This pull request helps mitigate the issue by ensuring only non-static methods are assumed to represent a embedded model.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling cf28733 on NSmithUK:master into 3bddd4b on jenssegers:master.

@jenssegers jenssegers added the bug label Mar 22, 2015
jenssegers added a commit that referenced this pull request May 25, 2015
@jenssegers
Copy link
Contributor

I had to manually merge your changes, could not get the github merge to work :(

@jenssegers jenssegers closed this May 25, 2015
mnphpexpert added a commit to mnphpexpert/laravel-mongodb that referenced this pull request Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants