Re: HTML_QuickForm2_Renderer: ArrayAccess

From: Date: Mon, 03 May 2010 23:56:35 +0000
Subject: Re: HTML_QuickForm2_Renderer: ArrayAccess
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-30491@lists.php.net to get a copy of this message
On Mon, May 3, 2010 at 3:38 PM, Christian Weiske <cweiske@cweiske.de> wrote: > Hello, > > > Using my own renderer, I wanted to implement ArrayAccess to get easy > access to elements by IDs (see my last mail, > "HTML_QuickForm2_Renderer_Array: Element IDs as array key?") in my > templates. > > Unfortunately, the rendering proxy tunnels every method calls and thus > prevents usage of ArrayAccess which gets not tunneled. Does someone > know how I could get array access working despite the proxy? > I cannot instantiate my renderer without the factory since I want to > use renderer plugins. I think the proxy should implement these methods accordingly, so that these special interfaces such as Traversable, Countable, ArrayAccess, __toString, etc are handled as expected. I do something like this in Savant4/Savvy's templating system to perform automatic output escaping while preserving the object context. This example is by no means extensive, but accommodates the most-used interactions. http://github.com/saltybeagle/Savvy/blob/master/src/Savvy/ObjectProxy.php#L165 -- Brett Bieber

« previous php.pear.general (#30491) next »