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

Already on GitHub? Sign in to your account

Syncing Up Magic Methods #530

Closed
wants to merge 143 commits into
from

Conversation

Projects
None yet
Contributor

markhuot commented Apr 13, 2012

This pull addresses an issue while using Twig with an Eloquent model. Twig checks if a property isset before calling it in the template. Unfortunately Eloquent's magic methods were running methods inside __get but not checking for the presence of those methods inside __isset. This will allow the following to work inside Twig:

{{ post.author.name }}

daylerees and others added some commits Mar 28, 2012

integrated a simple version of anbu into the laravel core
Signed-off-by: Dayle Rees <thepunkfan@gmail.com>
adding the anbu alias
Signed-off-by: Dayle Rees <thepunkfan@gmail.com>
Added to_array() and $hidden variable to the Eloquent base model.
Signed-off-by: Taylor Otwell <taylorotwell@gmail.com>
Updated change log.
Signed-off-by: Taylor Otwell <taylorotwell@gmail.com>
Timestamps are optional in many-to-many pivot table
Signed-off-by: Kelly Banman <kelly.banman@gmail.com>

taylorotwell and others added some commits Apr 4, 2012

Merge pull request #484 from kbanman/bugfix-pivot
Timestamps are optional in many-to-many pivot table
Use array_merge_recursive in input class.
Signed-off-by: Taylor Otwell <taylorotwell@gmail.com>
Fix bug in input class.
Signed-off-by: Taylor Otwell <taylorotwell@gmail.com>
Turn on profiler by default.
Signed-off-by: Taylor Otwell <taylorotwell@gmail.com>
Allow str_contains to take an array.
Signed-off-by: Taylor Otwell <taylorotwell@gmail.com>
Added total SQL execution time to profiler.
Signed-off-by: Taylor Otwell <taylorotwell@gmail.com>

This needs adding to the master, just cloned a fresh copy and I am experiencing the issue.

Merge pull request #515 from gaker/develop
Change visibility on Crypter::randomizer()
Contributor

ianlandsman commented on 88dd2f3 Apr 8, 2012

lured you back to PHP eh Aker?

Contributor

gaker replied Apr 8, 2012

I do fancy myself a web artisan, and Laravel is just so darned pretty. :)

Contributor

vespakoen commented on 825e8b2 Apr 9, 2012

Why the C:: ? Cookie:: is a lot more clear IMO...

Member

daylerees commented on 34cb9a0 Apr 13, 2012

Nice clean up :)

Member

daylerees commented on 0c8c671 Apr 13, 2012

O.o looks for dragons

The __get() magic method runs three checks before giving up but the _…
…_isset() method only runs two checks. This syncs the logic to ensure that __get() and __isset() are looking at the same possibilities.

@markhuot markhuot closed this Apr 13, 2012

Contributor

markhuot commented Apr 13, 2012

Sorry, included waaaayy to many commits in that one. Revising now.

Contributor

franzliedke commented on 4938451 Sep 17, 2012

@markhuot What was the logic behind this commit? This makes it impossible (or at least very hard) to check whether a certain relationship was loaded or not.

Take a look at pull request #1046.

Contributor

markhuot replied Sep 19, 2012

#1046 makes sense to me and should accomplish the same thing. The issue was that when Eloquent was used within a Twig template the conditional {% if user.friends %} failed because the __isset magic method wasn't smart enough to know that friends was a method and could potentially return "true."

thomasedwards pushed a commit to thomasedwards/laravel that referenced this pull request Oct 14, 2013

Merge pull request #530 from bencorlett/feature/overridable-helpers
Allowing overrides for helper functions.

Are you on an old laravel version? str_after has been added to 5.4.24, which was just released 9 days ago. Maybe you haven't updated yet.

@NowNewStart Really? Sorry! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment