#1171: AgaviValidationManager produces a notice when exporting flattened values
array
-----------------------------------------+----------------------------------
Reporter: sven.kretschm...@… | Owner: dominik
Type: defect | Status: new
Priority: normal | Milestone: 1.0.2
Component: validation | Version: 1.0.1
Severity: normal | Keywords:
Has_patch: 0 |
-----------------------------------------+----------------------------------
Comment(by sven.kretschm...@…):
Hi David,
I can give you a brief description of my use case:
We provide database persisted user settings, which own a key => value
table. As we want to provide Arrays as well, we flatten the data for
storing and use an AgaviArrayPathDefinition to load the settings.
The validator is part of an action which takes the settings to be stored
from javascript. The action just takes the validated (and flattened) array
and stores the keys and values, without any further normalization.
The validator does just little more than I wrote above to check the keys
and values, but in short, it just flattens the value, sets the affected
arguments and exports the flattened value.
The notice came up when I provided multidimensional data:
The incoming data looks like this:
{{{
array(
'settings' => array(
'foo' => array(
'bar' => 'buz'
)
)
)
}}}
The validator takes the settings (settings is the argument) array and
flattens it:
{{{
$value = array(
'foo[bar]' => 'buz'
)
}}}
This array is exported as settings again.
The validation manager then calculates the flat key names, leading to
{{{
array(
'settings[foo][bar]]
)
}}}
This key does not exist, as it should be 'settings[foo][bar]'.
The reason why setting the affected arguments to the flatKeyNames works,
is that it tells the validation manager the "incorrect" calculated
argument name to be a valid argument.
--
Ticket URL: <http://trac.agavi.org/ticket/1171#comment:9>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5
_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets