Skip to content

Instantly share code, notes, and snippets.

@docteurklein

docteurklein/README

Created May 5, 2010
Embed
What would you like to do?
HOW TO :
- Déclarer les composants dans modules.yml
- Créer une page (form) et y ajouter le widget Form.
- Créer une sous-page ( edition) de celle citée juste au dessus et y ajouter le widget Edit.
- aller a l'URL : /form/edition?id=1
/** edit an existing object **/
public function executeEditWidget(dmWebRequest $request)
{
$this->form = $this->forms['AmapFrontForm'] = new AmapFrontForm(Doctrine::getTable('Amap')->find($request->getParameter('id')));
if($request->isMethod('post') and $this->form->bindAndValid($request))
{
$this->form->save();
$this->redirect('/mes-amaps');
}
}
/** create a new object **/
public function executeFormWidget(dmWebRequest $request)
{
$form = $this->forms['AmapFront'] = new AmapFrontForm(Doctrine::getTable('Amap')->find($request->getParameter('id')));
if ($request->isMethod('post') && $form->bindAndValid($request)) {
if($amap = $form->save()) {
dm::enableMailer();
$this->getMailer()->composeAndSend('...')
);
}
$this->redirect('/inscription-amap-merci');
}
}
// sureremnt ameliorable
public function executeEdit()
{
$this->form = $this->forms['AmapFrontForm'];
}
public function executeForm()
{
$this->form = $this->forms['AmapFront'];
}
Amapy:
Amap:
page: true
components:
show:
form:
edit:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment