Um deinen Code von Doctrine auf Doctrine_Core umzustellen kannst du folgenden Befehl verwenden
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 |
Wenn du ein Plugin hast benutze folgenden Befehl
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 |
Du hast ein Registrierungsformular mit einem Feld account_type und zwei eingebetteten Formularen Company und Address.
Du willst das eingebettete Company Formular entfernen, wenn das Feld account_type sfGuardUserProfile::TYPE_PRIVATE entspricht, andernfalls willst du das eingebettete Address Formular entfernen.
Die Lösung ist die bind Methode in deinem Formular zu überschreiben.
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);
} |
Letzte Kommentare