本文整理汇总了PHP中sfForm::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP sfForm::setValue方法的具体用法?PHP sfForm::setValue怎么用?PHP sfForm::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfForm
的用法示例。
在下文中一共展示了sfForm::setValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processForm
protected function processForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid()) {
$form->setValue('account_id', $this->getUser()->getAttribute('account_id'));
$time_item_type = $form->save();
$this->getUser()->setFlash('saved.success', 1);
$this->redirect('adminTimeItemType/edit?id=' . $time_item_type->getId());
}
}
示例2: processForm
protected function processForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid()) {
$form->setValue('account_id', $this->getUser()->getAttribute('account_id'));
$role = $form->save();
unset($role->Credentials);
$role->save();
foreach ($request->getParameter('credential') as $credential_id => $value) {
$roleCredential = new RoleCredential();
$roleCredential->role_id = $role->id;
$roleCredential->credential_id = $credential_id;
$roleCredential->save();
}
$this->getUser()->setFlash('saved.success', 1);
$this->redirect('adminRole/edit?id=' . $role->getId());
}
}
示例3: processForm
protected function processForm(sfWebRequest $request, sfForm $form)
{
$parameters = $request->getParameter($form->getName());
$form->bind($parameters, $request->getFiles($form->getName()));
if ($form->isValid()) {
$this->getContext()->getConfiguration()->loadHelpers('Number');
// On crée la transaction correspondante
$transaction = new Transaction();
$transaction->asso_id = $parameters['asso_id'];
$transaction->compte_id = $parameters['compte_id'];
$transaction->libelle = 'Remboursement ' . $parameters['nom'];
$transaction->commentaire = "Remboursement des achats suivants :\n";
// Voir ci-dessous
$transaction->montant = 0;
// On fera le total plus tard !
$transaction->date_transaction = date('Y-m-d');
$transaction->moyen_id = $parameters['moyen_id'];
$transaction->moyen_commentaire = $parameters['moyen_commentaire'];
$transaction->save();
$form->setValue('transaction_id', $transaction->getPrimaryKey());
$note_de_frais = $form->save();
foreach ($parameters['transactions'] as $transaction_id) {
$transaction2 = $note_de_frais->addAchatFromId($transaction_id);
$transaction->commentaire .= $this->format_transaction($transaction2) . "\n";
}
$transaction->save();
$this->redirect('ndf', $note_de_frais->getAsso());
}
}
示例4: processForm
protected function processForm(sfWebRequest $request, sfForm $form, $emetteur, $asso)
{
$parameters = $request->getParameter($form->getName());
$form->bind($parameters, $request->getFiles($form->getName()));
if ($form->isValid()) {
$montant = abs($parameters['montant']);
var_dump(Doctrine);
$t = new Transaction();
// Transaction côté asso
$t_e = new Transaction();
// Transaction côté pôle
// Asso
$t->Asso = $asso;
$t_e->Asso = $emetteur;
// Compte
$t->compte_id = $parameters['asso_compte_id'];
$t_e->compte_id = $parameters['emetteur_compte_id'];
// Libellé
$t_e->libelle = sprintf('Avance de Trésorie %s', $asso->getName());
$t->libelle = sprintf('Avance de Trésorie %s', $emetteur->getName());
$t_e->montant = -($t->montant = $montant);
$t_e->commentaire = $t->commentaire = $parameters['commentaire'];
$t->moyen_id = $t_e->moyen_id = $parameters['moyen_id'];
$t->moyen_commentaire = $t_e->moyen_commentaire = $parameters['moyen_commentaire'];
$t->date_transaction = $t_e->date_transaction = date('Y-m-d');
$t->save();
$t_e->save();
$form->setValue('transaction_emetteur_id', $t_e);
$form->setValue('transaction_id', $t);
$form->setValue('asso_id', $asso->getPrimaryKey());
$avance_treso = $form->save();
$this->redirect('avances', $emetteur);
}
}