HosipLan

Untitled

Sep 2nd, 2012
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.43 KB | None | 0 0
  1. class FooFactory extends Nette\Object
  2. {
  3.     private $link;
  4.  
  5.     public function injectLinkProvider($provider)
  6.     {
  7.         $this->link = callback($provider);
  8.     }
  9.  
  10.     public function create()
  11.     {
  12.         $url = $this->link->invoke('Homepage:');
  13.     }
  14. }
  15.  
  16. class MyPresenter
  17. {
  18.  
  19.     protected function createComponentForm()
  20.     {
  21.         $factory = new FooFactory;
  22.         $factory->injectLinkProvider($this->link); // Nette magie
  23.         return $factory->create();
  24.     }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment