Skip to content

Instantly share code, notes, and snippets.

@jsifalda
Created October 21, 2013 06:32
Show Gist options
  • Save jsifalda/7079493 to your computer and use it in GitHub Desktop.
Save jsifalda/7079493 to your computer and use it in GitHub Desktop.
Nette link service inject to model
<?php
class FooFactory extends Nette\Object
{
private $link;
public function injectLinkProvider($provider)
{
$this->link = callback($provider);
}
public function create()
{
$url = $this->link->invoke('Homepage:');
}
}
class MyPresenter
{
protected function createComponentForm()
{
$factory = new FooFactory;
$factory->injectLinkProvider($this->link); // Nette magie
return $factory->create();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment