Skip to content

Commit b456906

Browse files
committed
application: improved info about attributes, added #[Deprecated]
1 parent fb1dd4e commit b456906

File tree

4 files changed

+18
-24
lines changed

4 files changed

+18
-24
lines changed

application/cs/presenters.texy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,14 @@ class MyPresenter extends Nette\Application\UI\Presenter
493493
Je důležité zdůraznit, že pokud povolíte metodu `OPTIONS`, musíte ji následně také patřičně obsloužit v rámci svého presenteru. Metoda je často používána jako tzv. preflight request, který prohlížeč automaticky odesílá před skutečným požadavkem, když je potřeba zjistit, zda je požadavek povolený z hlediska CORS (Cross-Origin Resource Sharing) politiky. Pokud metodu povolíte, ale neimplementujete správnou odpověď, může to vést k nekonzistencím a potenciálním bezpečnostním problémům.
494494

495495

496+
Označení zastaralých akcí .{data-version:3.2.3}
497+
-----------------------------------------------
498+
499+
Atribut `#[Deprecated]` slouží k označení akcí, signálů nebo celých presenterů, které jsou zastaralé a měly by být v budoucnu odstraněny. Při generování odkazů na takto označené části aplikace Nette vyhodí varování, které vývojáře upozorní.
500+
501+
Atribut lze aplikovat jak na celou třídu presenteru, tak na jednotlivé metody `action<Action>()`, `render<View>()` a `handle<Signal>()`.
502+
503+
496504
Další četba
497505
===========
498506

application/en/presenters.texy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,14 @@ class MyPresenter extends Nette\Application\UI\Presenter
493493
It's important to emphasize that if you enable the `OPTIONS` method, you must subsequently handle it appropriately within your presenter. This method is often used as a so-called preflight request, which the browser automatically sends before the actual request when it's necessary to determine if the request is permissible according to the CORS (Cross-Origin Resource Sharing) policy. If you enable the method but don't implement the correct response, it can lead to inconsistencies and potential security problems.
494494

495495

496+
Marking Deprecated Actions .{data-version:3.2.3}
497+
------------------------------------------------
498+
499+
The `#[Deprecated]` attribute marks actions, signals, or entire presenters as deprecated and scheduled for future removal. When generating links to deprecated parts of the application, Nette throws a warning to alert developers.
500+
501+
You can apply the attribute to either the entire presenter class or to individual `action<Action>()`, `render<View>()`, and `handle<Signal>()` methods.
502+
503+
496504
Further Reading
497505
===============
498506

nette/cs/vulnerability-protection.texy

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,7 @@ Nette Framework **automaticky chrání formuláře a signály v presenterech** p
4848
$form->allowCrossOrigin();
4949
```
5050

51-
nebo v případě signálu přidejte anotaci `@crossOrigin`:
52-
53-
```php
54-
/**
55-
* @crossOrigin
56-
*/
57-
public function handleXyz()
58-
{
59-
}
60-
```
61-
62-
V Nette Application 3.2 můžete použít také atributy:
51+
nebo v případě signálu přidejte atribut:
6352

6453
```php
6554
use Nette\Application\Attributes\Requires;

nette/en/vulnerability-protection.texy

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,7 @@ Nette Framework **automatically protects forms and signals in presenters** again
4848
$form->allowCrossOrigin();
4949
```
5050

51-
or in the case of a signal, add the `@crossOrigin` annotation:
52-
53-
```php
54-
/**
55-
* @crossOrigin
56-
*/
57-
public function handleXyz()
58-
{
59-
}
60-
```
61-
62-
In Nette Application 3.2, you can also use attributes:
51+
or in the case of a signal, add the attribute:
6352

6453
```php
6554
use Nette\Application\Attributes\Requires;

0 commit comments

Comments
 (0)