To change all your code from Doctrine to Doctrine_Core you can use the following command
1
| for fl in `find apps/ config/ lib/ test/ -name *.php`; do mv $fl $fl.old; sed 's/Doctrine::/Doctrine_Core::/g' $fl.old > $fl; rm -f $fl.old; done |
When you have a plugin you can use this command
1
| for fl in `find . -name *.php`; do mv $fl $fl.old; sed 's/Doctrine::/Doctrine_Core::/g' $fl.old > $fl; rm -f $fl.old; done |
You have a register form with a field account_type and two embed forms Company and Address.
You want remove the embed Company form, when the field account_type is sfGuardUserProfile::TYPE_PRIVATE otherwise you want remove the embed Address form.
The solution is to override the bind method in your form.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| public function bind(array $taintedValues = null, array $taintedFiles = null)
{
// unset request param and validator
if($taintedValues['account_type'] == sfGuardUserProfile::TYPE_PRIVATE)
{
unset(
$taintedValues['Company'],
$this->validatorSchema['Company']
);
}
else
{
unset(
$taintedValues['Address'],
$this->validatorSchema['Address']
);
}
parent::bind($taintedValues, $taintedFiles);
} |
Recent Comments