Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyForm extends Nette\Application\UI\Form
- {
- private $dep;
- public function __construct(Dep $dep)
- {
- parent::__construct();
- $this->dep = $dep;
- $this->addText('name');
- $this->onSuccess[] = $this->createUser;
- }
- public function createUser(Form $form)
- {
- $this->dep->...
- }
- }
- interface MyFormFactory
- {
- /** @return MyForm */
- function create();
- }
- ////////////////////////
- class MyFormControl extends Nette\Application\UI\Control
- {
- private $dep;
- public function __construct(Dep $dep)
- {
- parent::__construct();
- $this->dep = $dep;
- }
- protected function createComponentForm()
- {
- $form = new Nette\Application\UI\Form;
- $form->addText('name');
- $form->onSuccess[] = $this->createUser;
- return $form;
- }
- public function createUser(Form $form)
- {
- $this->dep->...
- }
- }
- interface MyFormControlFactory
- {
- /** @return MyFormControl */
- function create();
- }
Advertisement
Add Comment
Please, Sign In to add comment