From: Alex <ale...@ya...> - 2003-05-24 11:15:58
|
Hi, I ran into that one as well. I'd say go for it! Though I'd have to say, it didn't read like a Right Thing (so to speak.) Perhaps we should fix the ActionMapping and ActionForward classes instead of changing the HashMap. I myself added a findForward() to ActionMapping (that for now does $this->get basically) so in a later stage I can fix that inheritage thing there and make it a normal composition. Perhaps we should do a thing like that for ActionForm as well. PHP has object introspection, we could inspect the used forms for set...() methods and match it with the request, instead of just loading everything we have into the HashMap. That way we can remove the HashMap inhertiage there and you can implement and use subclasses of ActionForm more like you would expect it to work. My thoughts about it. Regards, Alex --- Jason Sweat <jsw...@ya...> wrote: > Another tweak to Phrame I am considering > implementing is to add an optional > default value to the HashMap::Get method. The > reason for this is because I use > ActionForm::Get within my View objects in a similar > fasion to the register() > function I wrote some time ago ( > http://www.zend.com/zend/art/art-sweat4.php#Heading12 > ). This function allows > for extraction of the posted parameters in a > register_globals off environment, > and optionally, you can specify a default value if > the user did not get/post > the desired value i.e. > $foo = register('foo', 'bar'); > would instead be: > $foo = ActionForm->Get('foo', 'bar'); > > The current implementation would have to look like: > $foo = ActionForm->Get('foo'); > if (!$foo) $foo = 'bar'; > > > My modification would be to add a constant and tweak > the get method- > > define('PHRAME_HASHMAP_DEFAULT', > '__PHRAME_HASHMAP_DEFAULT__'); > > /** > * Returns the value to which the specified key is > mapped in this identity > * hash map, or null if the map contains no mapping > for this key. > * > * @access public > * @param mixed $key > * @param mixed $default optional > * @return mixed > */ > function get($key, $default=PHRAME_HASHMAP_DEFAULT) > { > if ($this->containsKey($key)) { > return $this->_values[$key]; > } else { > if (PHRAME_HASHMAP_DEFAULT != $default) { > return $default; > } > } > } > > Should be backwards compatible. Thoughts? > > Regards, > > Jason > > __________________________________ > Do you Yahoo!? > The New Yahoo! Search - Faster. Easier. Bingo. > http://search.yahoo.com > > > ------------------------------------------------------- > This SF.net email is sponsored by: ObjectStore. > If flattening out C++ or Java code to make your > application fit in a > relational database is painful, don't do it! Check > out ObjectStore. > Now part of Progress Software. > http://www.objectstore.net/sourceforge > _______________________________________________ > Phrame-devel mailing list > Phr...@li... > https://lists.sourceforge.net/lists/listinfo/phrame-devel __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com |