HosipLan

Untitled

Jul 17th, 2013
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. class MyForm extends Nette\Application\UI\Form
  2. {
  3.     private $dep;
  4.  
  5.     public function __construct(Dep $dep)
  6.     {
  7.         parent::__construct();
  8.         $this->dep = $dep;
  9.         $this->addText('name');
  10.         $this->onSuccess[] = $this->createUser;
  11.     }
  12.  
  13.     public function createUser(Form $form)
  14.     {
  15.         $this->dep->...
  16.     }
  17. }
  18.  
  19. interface MyFormFactory
  20. {
  21.     /** @return MyForm */
  22.     function create();
  23. }
  24.  
  25.  
  26. ////////////////////////
  27.  
  28.  
  29. class MyFormControl extends Nette\Application\UI\Control
  30. {
  31.     private $dep;
  32.  
  33.     public function __construct(Dep $dep)
  34.     {
  35.         parent::__construct();
  36.         $this->dep = $dep;
  37.     }
  38.  
  39.     protected function createComponentForm()
  40.     {
  41.         $form = new Nette\Application\UI\Form;
  42.         $form->addText('name');
  43.         $form->onSuccess[] = $this->createUser;
  44.         return $form;
  45.     }
  46.  
  47.     public function createUser(Form $form)
  48.     {
  49.         $this->dep->...
  50.     }
  51. }
  52.  
  53. interface MyFormControlFactory
  54. {
  55.     /** @return MyFormControl */
  56.     function create();
  57. }
Advertisement
Add Comment
Please, Sign In to add comment