#1199: Support arbitrary "provides" and "depends" validator options with access 
to
argument base parts
-----------------------------------------+----------------------------------
 Reporter:  sven.kretschmann@…           |       Owner:  david               
     Type:  enhancement                  |      Status:  assigned            
 Priority:  normal                       |   Milestone:  1.1                 
Component:  validation                   |     Version:  1.0.1               
 Severity:  normal                       |    Keywords:  validator dependency
Has_patch:  0                            |  
-----------------------------------------+----------------------------------
Changes (by david):

  * owner:  dominik => david
  * status:  new => assigned


Comment:

 So the idea then is:

 {{{
 #!xml
 <validator … provides="fubar">
   <arguments base="foo[]">
     <argument>bar</argument>
   </arguments>
 </validator>
 }}}
 would now set just {{{fubar}}} for every iteration in {{{foo[]}}},
 contrary to the old behavior which set {{{foo[$key][fubar]}}} (the
 argument base is used in the string, but the argument itself is not
 included).

 On the other hand,

 {{{
 #!xml
 <validator … depends="fubar">
   <arguments base="foo[]">
     <argument>bar</argument>
   </arguments>
 </validator>
 }}}
 would still, like in 1.0, depend on just {{{fubar}}} (you'd have to use
 {{{[fubar]}}} to depend on {{{foo[$key][fubar]}}}, and that shows the
 problem nicely - you can only depend on "provides" set in the same
 argument base).

 The old behavior is automatically kept for 1.0 config namespaces, but if
 you want it for 1.1 namespaces, then in the above example you'd have to do
 {{{
 #!xml
 <validator … provides="foo[%2$s][fubar]">
   <arguments base="foo[]">
     <argument>bar</argument>
   </arguments>
 </validator>
 }}}
 and
 {{{
 #!xml
 <validator … depends="foo[%2$s][fubar]">
   <arguments base="foo[]">
     <argument>bar</argument>
   </arguments>
 </validator>
 }}}

 Since the {{{sprintf()}}} expansion works on all argument base parts, just
 like for {{{export}}} (see #1073), you could in both cases also use
 {{{%1$s[%2$s][fubar]}}}, since "foo" is the first part of the argument
 base and the dynamic key (inside the square brackets) is the second part.

 Of course, you don't even have to go this far for such a simple example;
 {{{foobarset[%2$s]}}} is sufficient in both cases if you only care about
 the dynamic key part in square brackets.

-- 
Ticket URL: <http://trac.agavi.org/ticket/1199#comment:5>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5



_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets

Reply via email to