robclancy / presenter

Decorate your objects using presenters. Primarily to keep presentation logic out of your models.
MIT License
345 stars 38 forks source link

Add support for nested presenters #10

Closed alexwhitman closed 11 years ago

alexwhitman commented 11 years ago

Allows for nested PresentableInterface instances.

alexwhitman commented 11 years ago

I've updated this with a better implementation. I'll look at adding tests tomorrow.

robclancy commented 11 years ago

Now we have the problem of the copy pasted method, which I knew was going to happen. My current thinking is make your new one here static and call it in the view area and delete the one there.

alexwhitman commented 11 years ago

Updated to remove code duplication and added tests. I also updated the tests to use assertInstanceOf as it provides a more useful error message rather than just "Failed asserting that false is true.".

BigfootPlatform commented 11 years ago

The modification of alexwhiteman is working great. Can you please accept his pull request ?

robclancy commented 11 years ago

This will be pull requested when I have time to think about the static method we have in there now (trying to think of a better solution, possibly a helpers.php file with it as a function). And when I have time to run the tests myself and then do all the updating for a release with the readme and tag stuff.

So it will be pulled in, just not until I am free from work a bit, being smashed right now.

BigfootPlatform commented 11 years ago

Ok, sounds good to me !

And thanks for this package that really helps to keep the models light and clean !

harhoo commented 11 years ago

Does this mean that if User has a Profile, and Profile has a presenter attribute of say transformed, then $user->profile->transformed will work (whereas at the moment, only $profile->transformed does)? If so, that would be great, as at the moment I'm still have to suck it up with accessors as most of my models are heavy related.

alexwhitman commented 11 years ago

@harhoo Yep, that's exactly what it does.

robclancy commented 11 years ago

This has been merged into the develop branch.