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

Correct isset behaviour #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

michaeldyrynda
Copy link
Contributor

In order to be able to use ternary / Laravel Blade or syntax, provide an __isset magic method.

@kylestev
Copy link

kylestev commented Feb 7, 2015

👍 this looks good to me and makes sense.

@ChrisReid
Copy link

It would also need to return true if the property exists on the model. Sometimes you might not override a model property and you would want it to show as set.

@michaeldyrynda
Copy link
Contributor Author

If you weren't changing the property that's on the model, wouldn't you just display that directly ($model->property rather than $model->present()->property)?

@jordanlev
Copy link

+1 ... this is also required when using presenter models in Twig templates (because Twig won't bother asking for a property or method unless it passes an isset check first)

…sent()->property or "N/A" }} will return false for a property retrieved via the __get magic method.

Provide an __isset magic method to correct this behaviour.
@michaeldyrynda michaeldyrynda force-pushed the master branch 2 times, most recently from 7d96a6c to 2e12ee0 Compare February 16, 2022 23:17
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.

4 participants