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

[#77] Use parent's fillables in children models #78

Closed
wants to merge 1 commit into from
Closed

[#77] Use parent's fillables in children models #78

wants to merge 1 commit into from

Conversation

litvinjuan
Copy link

The information about this PR is available in issue #77

Copy link
Contributor

@BertvanHoekelen BertvanHoekelen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oeh, I really like this feature 👍 Would you also be able to add a test confirming your implementation works?

*/
public function getFillable()
{
$parentFillable = (new ReflectionClass($this))->getParentClass()->newInstance()->getFillable();
Copy link
Contributor

@BertvanHoekelen BertvanHoekelen Feb 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using the getParentClass is a bit better, that way you won't create an reflection class instance on every subsequent call to getFillable as this is cached by that method. Something like:

Suggested change
$parentFillable = (new ReflectionClass($this))->getParentClass()->newInstance()->getFillable();
$parentClass = $this->getParentClass();
$parentFillable = (new $parentClass)->getFillable();

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this suggestion. Will definitely add it and append some tests

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

Successfully merging this pull request may close these issues.

3 participants