-- Ian Warner <[email protected]> wrote
(on Friday, 16 October 2009, 11:54 AM +0900):
> I would like some guidance on best practices for Action Helpers;
>
> I currently use the following in my controllers
>
> // Get the Users Profile PIC URL
> $this->_helper->facebookPhotos($social);
>
> // Setup the Invite elements
> $profilePic = $this->_helper->facebookPhotos->getProfilePicURL();
>
> In the helper I have:
>
> public function direct($social)
> {
> $this->social = $social;
> }
>
> public function getProfilePicURL() {
> }
>
> Last time I checked I couldnt do something like:
>
> $profilePic = $this->_helper->facebookPhotos($social)->getProfilePicURL();
Makes sense -- your direct() method isn't returning anything. Have it
return $this, and you can then chain it:
public function direct($social)
{
$this->social = $social;
return $this;
}
> Or even
> $helper = $this->_helper->facebookPhotos($social);
> $profilePic = $helper->getProfilePicURL();
Same applies here.
> Can you give me any pointers on how to invoke and also optimise these little
> beauties.
--
Matthew Weier O'Phinney
Project Lead | [email protected]
Zend Framework | http://framework.zend.com/