Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
addFilterPrefixPath example
public
function
setOptions
(
$options
)
{
if
(
$options
instanceof Zend_Config
)
{
$options
=
$options
->
toArray
(
)
;
}
// Set Präfix Path
if
(
array_key_exists
(
'filterPrefixPath',
$options
)
)
{
if
(
!
is_scalar
(
$options
[
'filterPrefixPath'
]
)
)
{
foreach
(
$options
[
'filterPrefixPath'
]
as
$prefix
=>
$path
)
{
$this
->
addFilterPrefixPath
(
$prefix
,
$path
)
;
}
}
}
if
(
array_key_exists
(
'throwTargetExceptionsOn',
$options
)
)
{
$this
->
setThrowTargetExceptionsOn
(
$options
[
'throwTargetExceptionsOn'
]
)
;
}
if
(
array_key_exists
(
'targetReplacementIdentifier',
$options
)
)
{
$this
->
setTargetReplacementIdentifier
(
$options
[
'targetReplacementIdentifier'
]
)
;
}
public
function
addNamespace
(
$namespaces
)
{
if
(
!
is_array
(
$namespaces
)
)
{
$namespaces
= array
(
$namespaces
)
;
}
foreach
(
$namespaces
as
$namespace
)
{
$prefix
=
$namespace
;
$path
=
str_replace
(
'_', DIRECTORY_SEPARATOR,
$prefix
)
;
$this
->
addFilterPrefixPath
(
$prefix
,
$path
)
;
$this
->
addValidatorPrefixPath
(
$prefix
,
$path
)
;
}
return
$this
;
}
/** * Add prefix path for all elements * * @param string $prefix * @param string $path * @return Zend_Filter_Input */