In a project I was working on when I had a similar issue I reverted to an extra method along the lines of setParametersElement($array, $value, $key="") you may want to consider that as a mechanism of adding elements to an array rather than trying to second guess what was intended in an all encompassing method.
On Fri, Dec 12, 2008 at 4:49 AM, David Zülke <[email protected]>wrote: > The problem is that it starts to get really ambiguous when you do > > $ph->setParameters(array( > 'foo[bar]' => 'baz' > )); > > if we had to dissect *all* of those (and we would have to, > recursively!) then that would imply a massive performance impact. > > So, if we changed this, setParameters() would remain "old-style", and > that's just as bad if you ask me (and probably the reason why > setParameter() doesn't work this way. > > Thoughts, everyone? > > - David > > > > Am 11.12.2008 um 16:33 schrieb Benjamin Börngen-Schmidt: > > > I would agree with Felix, even though I never used the possibility of > > setting an array as parameter (cuz I didn't know it'll and i didn't > > need it yet), but when looking at the code I would expect the same as > > Felix. > > Why would I want to have the Parameters Name containing brackets? If I > > not want to access my value i saved there? > > > > Cheers > > Benjamin > > > > > > Am 11.12.2008 um 16:09 schrieb David Zülke: > > > >> Nah, that's intentional. The idea is that you can set a literal > >> "foo[bar]" if you need to (and that will be returned if you get it > >> again instead of the entry "bar" in "foo"). > >> > >> Changing that would break BC; I believe; we're relying on it in a > >> couple of places, I think. > >> > >> - David > >> > >> > >> > >> > >> Am 11.12.2008 um 14:47 schrieb Felix Gilcher: > >> > >>> Hey, > >>> > >>> while writing the tests for #955 I stumbled over the behavior > >>> demonstrated in this snippet: > >>> > >>> $p = new AgaviParameterHolder(); > >>> $p->setParameter('foo', array('bar' => 'baz', 'ball' => 'round')); > >>> $p->getParameter('foo[bar]'); // baz > >>> $p->setParameter('foo[bar]', 'foo'); > >>> $p->getParameter('foo'); // hmm: array('bar' => 'baz', 'ball' => > >>> 'round'), expected: array('bar' => 'foo', 'ball' => 'round') > >>> $p->getParameter('foo[bar]'); // foo > >>> $p->unsetParameter('foo[bar]'); // foo > >>> $p->getParameter('foo[bar]'); // baz !!! (instead of null) > >>> > >>> This is triggered by AgaviParameterHolder::setParameter() not trying > >>> to resolve array parts in the name like get/has/unsetParameter() do. > >>> I'd call that unexpected and I'd say it's a bug - it took me nearly > >>> 15 minutes to figure out what I was doing wrong in my testcase. > >>> However it's a bit unclear how to fix that... > >>> > >>> Any insights? > >>> > >>> cheers > >>> > >>> felix > >>> > >>> -- > >>> Felix Gilcher > >>> > >>> Bitextender GmbH > >>> Paul-Heyse-Str. 6 > >>> D-80336 München > >>> > >>> T: +49 89 57 08 15 16 > >>> F: +49 89 57 08 15 17 > >>> M: +49 172 840 88 28 > >>> > >>> [email protected] > >>> http://bitextender.com/ > >>> > >>> Amtsgericht München, HRB 174280 > >>> Geschäftsführer: David Zülke, Florian Clever > >>> > >>> _______________________________________________ > >>> Agavi Dev Mailing List > >>> [email protected] > >>> http://lists.agavi.org/mailman/listinfo/dev > >> > >> > >> _______________________________________________ > >> Agavi Dev Mailing List > >> [email protected] > >> http://lists.agavi.org/mailman/listinfo/dev > > > > > > _______________________________________________ > > Agavi Dev Mailing List > > [email protected] > > http://lists.agavi.org/mailman/listinfo/dev > > > > > _______________________________________________ > Agavi Dev Mailing List > [email protected] > http://lists.agavi.org/mailman/listinfo/dev >
_______________________________________________ Agavi Dev Mailing List [email protected] http://lists.agavi.org/mailman/listinfo/dev
