|
|
|
[
Permlink
| « Hide
]
Thomas Weidner - 15/Oct/07 01:47 PM
Assigned to Rob
I like the idea of post-construction configurability, but I would instead recommend the solution to be adding a setAllowModifications(boolean $enabled) method or similar, though maybe there is better name for $enabled.
I also think disallowing modifications should be one-way as it's something you'd do to enforce code standards. The name (seal() or setReadOnly()) doesn't matter to me.
If I understand correctly, this is trivially accomplished by extending Zend_Config:
class MyConfig extends Zend_Config { public function seal() { $this->_allowModifications = false; return $this; } } Considering the above comments and the fact that it could also be harmful to allow only seal()/setReadOnly() - many people would have the opposite problem (needing write access to a locked object) - it would seem that this is best done in userland instead of bloating the framework component with possibly problematic functionality. It's not that easy because you need to apply the change recursively. And that's currently not possible because __construct() and __set() use new Zend_Config instead of new self and therefor all childs won't have a seal method.
Yes, of course, I missed that. What would the implementation look like, now that I committed SVN r6767
I'd like to resolve this issue one way or another if possible.
Choices are: 1. Resolve as "Won't Fix" or "Not an Issue" and users will have to create a user-land class. Personally, I'm tending towards (2) as merging multiple config files into a single Zend_Config doesn't strike me as that unusual a use-case and with merge() we are implicitly endorsing this use-case anyway. May as well tidy up after ourselves! Thoughts? Fixing Fix Version to follow issue tracker conventions.
|
||||||||||||||||||||||||||||||||||||||||||||||