Permalink
Browse files

used ::class

  • Loading branch information...
dg committed Mar 18, 2018
1 parent dd4e62a commit 0fc64247438a302f03efdc4ae80c2b64aacee187
Showing with 12 additions and 12 deletions.
  1. +4 −4 cs/components.texy
  2. +2 −2 cs/di-extensions.texy
  3. +4 −4 en/components.texy
  4. +2 −2 en/di-extensions.texy
@@ -346,9 +346,9 @@ Nette\ComponentModel\Component .{toc: Component}

[api:Nette\ComponentModel\Component] je standardní implementací `IComponent`. Je společným předkem všech komponent, vycházejí z ní všechny prvky formulářů. Obsahuje metody zjišťují příbuznost objektů a hlavně propojení (provázání) s rodiči:

[lookup($type)|api:Nette\ComponentModel\Component::lookup()] vyhledá v hierarchii směrem nahoru objekt požadované třídy nebo rozhraní. Například `$component->lookup('Nette\Application\UI\Presenter')` vrací presenter, pokud je k němu, i přes několik úrovní, komponenta připojena.
[lookup($type)|api:Nette\ComponentModel\Component::lookup()] vyhledá v hierarchii směrem nahoru objekt požadované třídy nebo rozhraní. Například `$component->lookup(Nette\Application\UI\Presenter::class)` vrací presenter, pokud je k němu, i přes několik úrovní, komponenta připojena.

[lookupPath($type)|api:Nette\ComponentModel\Component::lookupPath()] vrací tzv. cestu, což je řetězec vzniklý spojením jmen všech komponent na cestě mezi aktuální a hledanou komponentou. Takže např. `$component->lookupPath('Nette\Application\UI\Presenter')` vrací jedinečný identifikátor komponenty vůči presenteru.
[lookupPath($type)|api:Nette\ComponentModel\Component::lookupPath()] vrací tzv. cestu, což je řetězec vzniklý spojením jmen všech komponent na cestě mezi aktuální a hledanou komponentou. Takže např. `$component->lookupPath(Nette\Application\UI\Presenter::class)` vrací jedinečný identifikátor komponenty vůči presenteru.


Nette\ComponentModel\IContainer .{toc: IContainer}
@@ -429,7 +429,7 @@ class UploadControl extends Nette\Forms\Controls\BaseControl
{
public function __construct($label)
{
$this->monitor('Nette\Forms\Form');
$this->monitor(Nette\Forms\Form::class);
// ...
}

@@ -462,7 +462,7 @@ Například takto nějak se "interně"((dělá to framework sám v jádru, není

/--php
$valid = true;
foreach ($form->getComponents(true, 'Nette\Forms\IControl') as $control) {
foreach ($form->getComponents(true, Nette\Forms\IControl::class) as $control) {
if (!$control->getRules()->validate()) {
$valid = false;
break;
@@ -27,7 +27,7 @@ class BlogExtension extends Nette\DI\CompilerExtension
{
$builder = $this->getContainerBuilder();
$builder->addDefinition($this->prefix('articles'))
->setFactory('App\Model\HomepageArticles', ['@connection'])
->setFactory(App\Model\HomepageArticles::class, ['@connection'])
->addSetup('setLogger', ['@logger']);
}
}
@@ -89,7 +89,7 @@ class BlogExtension extends Nette\DI\CompilerExtension
// ['postsPerPage' => 10, 'comments' => true]

$builder->addDefinition($this->prefix('articles'))
->setFactory('App\Model\HomepageArticles', ['@connection'])
->setFactory(App\Model\HomepageArticles::class, ['@connection'])
->addSetup('setPostsPerPage', [$this->config['postsPerPage']]);

if (!$this->config['comments']) {
@@ -345,9 +345,9 @@ Nette\ComponentModel\Component .{toc: Component}

[api:Nette\ComponentModel\Component] is a standard implementation of `IComponent`. It is common ancestor of all components including form elements. It has several methods for traversing:

[lookup($type)|api:Nette\ComponentModel\Component::lookup()] looks up object of given class or interface up in the hierarchy. For example `$component->lookup('Nette\Application\UI\Presenter')` returns presenter if the components is bound to it (even deep in the hierarchy).
[lookup($type)|api:Nette\ComponentModel\Component::lookup()] looks up object of given class or interface up in the hierarchy. For example `$component->lookup(Nette\Application\UI\Presenter::class)` returns presenter if the components is bound to it (even deep in the hierarchy).

[lookupPath($type)|api:Nette\ComponentModel\Component::lookupPath()] returns path - a string made by concatenating names of all components on the way between current and component of `$type`. For example `$component->lookupPath('Nette\Application\UI\Presenter')` returns unique identifier of component toward presenter.
[lookupPath($type)|api:Nette\ComponentModel\Component::lookupPath()] returns path - a string made by concatenating names of all components on the way between current and component of `$type`. For example `$component->lookupPath(Nette\Application\UI\Presenter::class)` returns unique identifier of component toward presenter.


Nette\ComponentModel\IContainer .{toc: IContainer}
@@ -426,7 +426,7 @@ class UploadControl extends Nette\Forms\Controls\BaseControl
{
public function __construct($label)
{
$this->monitor('Nette\Forms\Form');
$this->monitor(Nette\Forms\Form::class);
// ...
}

@@ -459,7 +459,7 @@ For example, this is the way how validation of forms is "internally"((this is do

/--php
$valid = true;
foreach ($form->getComponents(true, 'Nette\Forms\IControl') as $control) {
foreach ($form->getComponents(true, Nette\Forms\IControl::class) as $control) {
if (!$control->getRules()->validate()) {
$valid = false;
break;
@@ -27,7 +27,7 @@ class BlogExtension extends Nette\DI\CompilerExtension
{
$builder = $this->getContainerBuilder();
$builder->addDefinition($this->prefix('articles'))
->setFactory('App\Model\HomepageArticles', ['@connection'])
->setFactory(App\Model\HomepageArticles::class, ['@connection'])
->addSetup('setLogger', ['@logger']);
}
}
@@ -89,7 +89,7 @@ class BlogExtension extends Nette\DI\CompilerExtension
// ['postsPerPage' => 10, 'comments' => true]

$builder->addDefinition($this->prefix('articles'))
->setFactory('App\Model\HomepageArticles', ['@connection'])
->setFactory(App\Model\HomepageArticles::class, ['@connection'])
->addSetup('setPostsPerPage', [$this->config['postsPerPage']]);

if (!$this->config['comments']) {

0 comments on commit 0fc6424

Please sign in to comment.