#1005: Allow configuration parameter type casts
-------------------------+--------------------------------------------------
Reporter: david | Owner: impl
Type: enhancement | Status: new
Priority: normal | Milestone: 1.0
Component: config | Version: 1.0.0beta7
Severity: normal | Keywords:
Has_patch: 0 |
-------------------------+--------------------------------------------------
Several reasons do do this
* what if I want a literal "true", not an auto-cast boolean?
* handling of constants is a mess, some classes do it in userspace code
* sometimes, it's necessary to ''really'' have an int value, not just a
numeric string, e.g. when passing something to certain internal classes
(ext/soap's constructors, for instance)
The types, if declared, should be handled and cast, and if not declared.
the current automatic behavior through
{{{AgaviToolkit::literalize()}}} should be retained.
So, I suggest:
* {{{<ae:parameter name="foo" type="bool" >true</ae:parameter>}}} (how
does that behave?)
* {{{<ae:parameter name="foo" type="boolean" >true</ae:parameter>}}} (how
does that behave?)
* {{{<ae:parameter name="foo" type="int" >1234</ae:parameter>}}}
* {{{<ae:parameter name="foo" type="integer" >1234</ae:parameter>}}}
* {{{<ae:parameter name="foo" type="float" >1234.5</ae:parameter>}}}
* {{{<ae:parameter name="foo" type="double" >1234.5</ae:parameter>}}}
* {{{<ae:parameter name="foo" type="real" >1234.5</ae:parameter>}}}
* {{{<ae:parameter name="foo" type="string" >true</ae:parameter>}}}
* {{{<ae:parameter name="foo"
type="constant">SOAP_SINGLE_ELEMENT_ARRAYS</ae:parameter>}}}
* {{{<ae:parameter name="foo" type="constant">SOAP_SINGLE_ELEMENT_ARRAYS
| SOAP_USE_XSI_ARRAY_TYPE</ae:parameter>}}} (I guess we don't need support
for brackets)
The same issue exists for parameter '''names''' (where we don't do any
casting right now), s we need:
* {{{<ae:parameter keytype="bool" name="true" >foo</ae:parameter>}}}
(how does that behave?)
* {{{<ae:parameter keytype="boolean" name="true" >foo</ae:parameter>}}}
(how does that behave?)
* {{{<ae:parameter keytype="int" name="1234" >foo</ae:parameter>}}}
* {{{<ae:parameter keytype="integer" name="1234"
>1234</ae:parameter>}}}
* {{{<ae:parameter keytype="float"
name="1234.5">1234.5</ae:parameter>}}}
* {{{<ae:parameter keytype="double"
name="1234.5">1234.5</ae:parameter>}}}
* {{{<ae:parameter keytype="real"
name="1234.5">1234.5</ae:parameter>}}}
* {{{<ae:parameter keytype="constant"
name="PHP_OS">true</ae:parameter>}}}
Combination examples:
* {{{
<database name="yay" class="AgaviPdoDatabase">
<ae:parameter name="attributes">
<ae:parameter keytype="constant" name="PDO::ATTR_ERRMODE"
type="constant">PDO::ERRMODE_EXCEPTION</ae:parameter>
</ae:parameter>
</database>
}}}
--
Ticket URL: <http://trac.agavi.org/ticket/1005>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5
_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets