0
J'utilise symfony 1.4.11. J'ai une forme frontend et backend.Formulaire backend Symfony
Frontend:
<?php
{
public function configure()
{
$user = sfContext::getInstance()->getUser()->getGuardUser()->getProfile();
$this->removeFields();
$this->widgField();
$this->widgetSchema->setLabels(array(
'time_id' => 'Duration *',
));
}
protected function removeFields()
{
unset(
$this['created_at'],
$this['updated_at'],
$this['is_closed'],
$this['invoice_url'],
$this['is_cancel']
);
}
protected function widgField()
{
$this->widgetSchema['user_id'] = new sfWidgetFormInputHidden();
}
protected function doUpdateObject($values)
{
parent::doUpdateObject($values);
$this->getObject()->setUserId(sfContext::getInstance()->getUser()->getGuardUser()->getId());
}
}
Et Backend:
<?php
class BackendPaymentForm extends PaymentForm
{
public function configure()
{
parent::configure();
}
protected function removeFields()
{
unset(
$this['updated_at'],
$this['created_at'],
$this['user_id'],
$this['time_id'],
$this['invoice_url'],
$this['is_cancel']
);
}
protected function widgField()
{
}
}
?>
Le problème est que j'ai dans frontend doUpdateObject qui a mis user_id, et en back-end-je besoin que l'administrateur peut définir un paramètre, Tout va bien, mais ça change user_id à admin ... Merci!
Mise à jour: je résoudre ce problème, mais je posterai réponse seulement après 8 heures :( – denys281