Slim icon indicating copy to clipboard operation
Slim copied to clipboard

Develop - Helpers\Set no property access/overloading

Open zomble opened this issue 13 years ago • 1 comments

I was playing around with the develop branch of Slim and I ran into an issue with the Set class and Mustache templating.

Mustache is explicitly checking for properties ->foo not ['foo'] (as you currently expect Set to be used).

Obviously one could update Mustache to check for instanceof \ArrayAccess (bit silly), or simply extend Set, and add the usage of magic functions.

Would it be alright to add the use of __get (I think this should still throw ErrorException on properties that don't "exist") and __isset in Helper\Set? Or is it by design to exclude it? If wanted I can PR the change, inc tests.

Also, I'm not 100% sure if it's a good idea to use __get and __isset with out __set and __unset, but I'd personally prefer those were still handled the way you have currently defined in Set. Thoughts?

Cheers.

zomble avatar Apr 21 '13 23:04 zomble

I think property overloading is fine if it will help improve compatibility with Mustache. Go for it. Send a PR when ready.

codeguy avatar Jun 03 '13 19:06 codeguy