Last active
August 29, 2015 14:06
-
-
Save miroslav-mrazek/12f63fce1e80b4a8273c to your computer and use it in GitHub Desktop.
Generované továrničky s parametrem (Nette ~2.3.0@dev)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
- | |
create: App\Components\Foo | |
implement: App\Components\IFooFactory | |
# - App\Components\IFooFactory # tohle bude stačit po schválení pullrequestu s opravou bugu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{block content} | |
{control foo} | |
{/block} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{$bar} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Components; | |
use Nette\Application\UI\Control; | |
class Foo extends Control | |
{ | |
/** @var string */ | |
protected $bar; | |
/** | |
* @param string | |
*/ | |
public function __construct($bar) | |
{ | |
parent::__construct(); | |
$this->bar = $bar; | |
} | |
public function render() | |
{ | |
$this->template->bar = $this->bar; | |
$this->template->setFile( 'foo.latte' ); | |
$this->template->render(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Presenters; | |
class HomepagePresenter extends BasePresenter | |
{ | |
public function renderDefault() | |
{ | |
} | |
/** @var \App\Components\IFooFactory @inject */ | |
public $fooFactory; | |
public function createComponentFoo() | |
{ | |
return $this->fooFactory->create('ahoj'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Components; | |
interface IFooFactory | |
{ | |
/** | |
* @param string $bar | |
* @return Foo | |
*/ | |
function create($bar); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment