{"id":466244,"date":"2025-07-07T15:11:26","date_gmt":"2025-07-07T15:11:26","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=466244"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=466244","title":{"rendered":"<span>\u041d\u043e\u0432\u043e\u0435 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445 Bitrix Framework: \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442! \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a\u0438\u0435 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445 \u044f\u0434\u0440\u0430 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u2014 \u044d\u0442\u043e \u0447\u0430\u0441\u0442\u044c <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Model-View-Controller\" rel=\"noopener noreferrer nofollow\">MVC<\/a> \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u0430.<\/p>\n<p>\u041f\u0440\u043e MVC \u043c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0430\u043a\u0446\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u044d\u0442\u043e\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. \u041b\u0443\u0447\u0448\u0435 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0441\u043e\u0441\u0442\u043e\u044f\u0442 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.<br \/> \u0410 \u0435\u0449\u0435 \u0434\u043b\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435. \u041c\u044b \u0443\u0436\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438 \u043e\u0431 \u044d\u0442\u043e\u043c <a href=\"https:\/\/docs.1c-bitrix.ru\/pages\/framework\/controllers.html#avtomaticheskoe-izvlechenie-parametrov\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0447\u0438\u0442\u0430\u043b\u0438, \u0442\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c. \u0422\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0433\u0447\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0442\u043e, \u043e \u0447\u0435\u043c \u043c\u044b \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0432\u0430\u043c \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c.<\/p>\n<p>\u0427\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u043a\u043e\u0434 \u0434\u043e \u0438\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438, \u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u043c\u0435\u0441\u0442\u043d\u043e \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0441\u0430\u043c\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a Content-Type.<br \/> \u0422\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 (\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043f\u0435\u0440\u0435\u0434 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430) \u043c\u044b \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c <strong>\u043f\u0440\u0435\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u043c\u0438<\/strong>. \u041a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 &#8212; <strong>\u043f\u043e\u0441\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u043c\u0438<\/strong><\/p>\n<h2>\u0424\u0438\u043b\u044c\u0442\u0440\u044b<\/h2>\n<p>\u0415\u0441\u0442\u044c 2 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c (\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u0435\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u043c\u0438 \u0438 \u043f\u043e\u0441\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u043c\u0438) \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. \u041f\u0435\u0440\u0432\u044b\u0439 &#8212; \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 configureActions:<\/p>\n<pre><code class=\"php\">&lt;?php  use Bitrix\\Main\\Engine\\ActionFilter\\Authentication; use Bitrix\\Main\\Engine\\Controller;  final class Entity extends Controller { public function configureActions() { return [ 'get' =&gt; [ 'prefilters' =&gt; [ new Authentication(), ], ], ]; }  public function getAction(string $id) { \/\/ ... } } <\/code><\/pre>\n<p>\u0421\u043a\u043e\u0440\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u2014 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0431\u043e\u043b\u0435\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0438 \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439, \u043d\u043e \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u0441\u0451, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <code>configureActions<\/code>:<\/p>\n<pre><code class=\"php\">&lt;?php  use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Prefilters; use Bitrix\\Main\\Engine\\ActionFilter\\Authentication; use Bitrix\\Main\\Engine\\Controller;  final class Entity extends Controller { #[Prefilters([ new Authentication() ])] public function getAction(string $id) { \/\/ ... } } <\/code><\/pre>\n<p>\u041e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e \u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0442\u0440\u0435\u0447\u0435\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c <code>Bitrix\\Main\\Engine\\Exception\\ActionConfigurationException<\/code>.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0435 \u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u044e\u0449\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438. \u0421\u0442\u0430\u0440\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0447\u0435\u0440\u0435\u0437 <code>configureActions<\/code>:<\/p>\n<pre><code class=\"php\">&lt;?php  use Bitrix\\Main\\Engine\\ActionFilter\\Authentication; use Bitrix\\Main\\Engine\\ActionFilter\\Csrf; use Bitrix\\Main\\Engine\\Controller;  final class Entity extends Controller { public function configureActions() { return [ 'get' =&gt; [ '+prefilters' =&gt; [ new Authentication(), ], '-prefilters' =&gt; [ new Csrf(), ], ], ]; }  public function getAction(string $id) { \/\/ ... } } <\/code><\/pre>\n<p>\u041d\u043e\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0447\u0435\u0440\u0435\u0437 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b:<\/p>\n<pre><code class=\"php\">&lt;?php  use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\DisablePrefilters; use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\EnablePrefilters; use Bitrix\\Main\\Engine\\ActionFilter\\Authentication; use Bitrix\\Main\\Engine\\ActionFilter\\Csrf; use Bitrix\\Main\\Engine\\Controller;  final class Entity extends Controller { #[EnablePrefilters([ new Authentication() ])] #[DisablePrefilters([ new Csrf() ])] public function getAction(string $id) { \/\/ ... } } <\/code><\/pre>\n<p>\u0418 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432:<\/p>\n<pre><code class=\"php\">&lt;?php  use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\DisablePostfilters; use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\EnablePostfilters; use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Postfilters; use Bitrix\\Main\\Engine\\ActionFilter\\ClosureWrapper; use Bitrix\\Main\\Engine\\ActionFilter\\Cors; use Bitrix\\Main\\Engine\\Controller;  final class Entity extends Controller { #[Postfilters([ new Cors(), ])] #[EnablePostfilters([ new Cors(), ])] #[DisablePostfilters([ new ClosureWrapper(), ])] public function getAction(string $id) { \/\/ ... } } <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0440\u0435- \u0438 \u043f\u043e\u0441\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b:<\/p>\n<pre><code class=\"php\">&lt;?php  use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Authentication; use Bitrix\\Main\\Engine\\Controller;  final class Entity extends Controller { #[Authentication()] public function getAction(string $id) { \/\/ ... } } <\/code><\/pre>\n<p>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c \u0441\u0430\u043c\u0438\u0445 \u044d\u043a\u0448\u043d \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 <code>filterType<\/code>. \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u044f \u044d\u043a\u0448\u043d \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432.<\/p>\n<p>\u041d\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u0435\u0442\u043e\u0434\u044b <code>get<\/code> \u0438 <code>list<\/code> \u0431\u0443\u0434\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u043f\u0440\u0435\u0444\u0438\u043b\u044c\u0442\u0440\u044b:<\/p>\n<pre><code class=\"php\">&lt;?php  use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule; use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\DisablePrefilters; use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\EnablePrefilters; use Bitrix\\Main\\Engine\\ActionFilter\\Authentication; use Bitrix\\Main\\Engine\\ActionFilter\\Csrf; use Bitrix\\Main\\Engine\\ActionFilter\\FilterType; use Bitrix\\Main\\Engine\\Controller;  final class Entity extends Controller { #[EnablePrefilters([ new Authentication() ])] #[DisablePrefilters([ new Csrf() ])] public function getAction(string $id) { \/\/ ... }  #[Rule\\Authentication(type: FilterType::EnablePrefilter)] #[Rule\\Csrf(type: FilterType::DisablePrefilter)] public function listAction() { \/\/ ... } } <\/code><\/pre>\n<p>\u0418\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u044d\u043a\u0448\u043d \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432, \u043f\u0440\u043e\u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b:<\/p>\n<ul>\n<li>\n<p><code>Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Authentication<\/code><\/p>\n<\/li>\n<li>\n<p><code>Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\CloseSession<\/code><\/p>\n<\/li>\n<li>\n<p><code>Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\ContentType<\/code><\/p>\n<\/li>\n<li>\n<p><code>Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Cors<\/code><\/p>\n<\/li>\n<li>\n<p><code>Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Csrf<\/code><\/p>\n<\/li>\n<li>\n<p><code>Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\HttpMethod<\/code><\/p>\n<\/li>\n<li>\n<p><code>Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Scope<\/code><\/p>\n<\/li>\n<li>\n<p><code>Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Token<\/code><\/p>\n<\/li>\n<\/ul>\n<h3>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c<\/h3>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u0441\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <code>Cors<\/code>:<\/p>\n<pre><code class=\"php\">&lt;?php  declare(strict_types=1);  namespace Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule;  use Attribute; use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\FilterAttributeInterface; use Bitrix\\Main\\Engine\\ActionFilter\\FilterType;  #[Attribute(Attribute::TARGET_METHOD)] final class Cors implements FilterAttributeInterface { public function __construct( private readonly ?string $origin = null, private readonly ?bool $credentials = null, private readonly FilterType $type = FilterType::EnablePrefilter, ) {  }  public function getFilters(): array { if ($this-&gt;type-&gt;isNegative()) { return [\\Bitrix\\Main\\Engine\\ActionFilter\\Cors::class]; }  return [new \\Bitrix\\Main\\Engine\\ActionFilter\\Cors($this-&gt;origin, $this-&gt;credentials)]; }  public function getType(): FilterType { return $this-&gt;type; } } <\/code><\/pre>\n<p>\u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u043e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u0430\u043c <code>\\Bitrix\\Main\\Engine\\ActionFilter\\Cors<\/code>.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435, \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0435 \u0435\u0441\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>FilterType<\/code> \u2014 \u043e\u043d \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0438\u043f \u0444\u0438\u043b\u044c\u0442\u0440\u0430. \u0412\u043e\u0442 \u0442\u0430\u043a \u043e\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442:<\/p>\n<pre><code class=\"php\">enum FilterType: string { case Prefilter = 'prefilters'; case Postfilter = 'postfilters';  case EnablePrefilter = '+prefilters'; case DisablePrefilter = '-prefilters';  case EnablePostfilter = '+postfilters'; case DisablePostfilter = '-postfilters';  public function isNegative(): bool { return in_array($this, [self::DisablePrefilter, self::DisablePostfilter], true); } } <\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u043a\u043b\u044e\u0447\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b \u043c\u0435\u0442\u043e\u0434\u0443 <code>configureActions<\/code>.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b <code>CloseSession<\/code> \u0431\u044b\u043b \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d, \u0442\u043e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"php\">class Task extends \\Bitrix\\Main\\Engine\\Controller { #[\\Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\CloseSession(type: FilterType::DisablePrefilter)] public function getAction(int $id): ?array { \/\/ ...  return $task; } } <\/code><\/pre>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0435 \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u043b\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0438 \u043f\u0440\u0435\u0444\u0438\u043b\u044c\u0442\u0440\u044b, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c\u0438 <code>\\Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Prefilters<\/code>, <code>\\Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Postfilters<\/code><\/p>\n<pre><code class=\"php\">class Task extends \\Bitrix\\Main\\Engine\\Controller { #[Prefilters([new Csrf(), new ContentType([ContentType::JSON])])] public function getAction(int $id): ?array { \/\/ ...  return $task; } } <\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u044b \u0422\u041e\u041b\u042c\u041a\u041e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0444\u0438\u043b\u044c\u0442\u0440\u044b, \u0430 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u2014 \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441 \u043f\u043e\u0441\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u043c\u0438<\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0432\u043e\u0438\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043f\u0440\u0435\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432<\/h3>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<ul>\n<li>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0430\u043c \u0444\u0438\u043b\u044c\u0442\u0440 (\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a Base)<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"php\">interface FilterAttributeInterface { \/**  * @return (Base|string)[]  *\/ public function getFilters(): array;  public function getType(): FilterType; } <\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"php\">#[Attribute(Attribute::TARGET_METHOD)] class MyCustomFilter implements \\Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\FilterAttributeInterface { public function __construct( private readonly array $args, private readonly FilterType $type = FilterType::EnablePrefilter, ) {  } public function getFilters(): array { return [new MyCustomBaseFilter($this-&gt;args)] }  public function getType(): FilterType { return $this-&gt;type; } } <\/code><\/pre>\n<h2>\u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f<\/h2>\n<p>\u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445. \u041d\u043e\u0432\u043e\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u043c\u044b \u043f\u043e\u0441\u0432\u044f\u0442\u0438\u043b\u0438 <a href=\"https:\/\/habr.com\/ru\/companies\/bitrix\/articles\/854370\/\" rel=\"noopener noreferrer nofollow\">\u0446\u0435\u043b\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e<\/a>.<\/p>\n<p>\u041e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u043d\u0435\u0439, \u0435\u0441\u043b\u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u043d\u0435 \u0432\u0438\u0434\u0435\u043b\u0438 \u2014 \u044d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0436\u0435 \u043c\u044b \u0443\u043b\u0443\u0447\u0448\u0438\u043b\u0438 \u0441\u0432\u044f\u0437\u043a\u0443 \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u043c\u0438 \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0435\u0439.<\/p>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0431\u044b\u043b\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u043a\u0438\u043d\u0443\u0442\u044c \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u043e\u0431\u0435\u0440\u0442\u043a\u0443 &#8212; <code>\\Bitrix\\Main\\Validation\\Engine\\AutoWire\\ValidationParameter<\/code>:<\/p>\n<pre><code class=\"php\">class UserController extends Controller {     public function getAutoWiredParameters()     {         return [             new \\Bitrix\\Main\\Validation\\Engine\\AutoWire\\ValidationParameter(                 CreateUserDto::class,                 fn() =&gt; CreateUserDto::createFromRequest($this-&gt;getRequest()),             ),         ];     }          public function createAction(CreateUserDto $dto): Result     {         \/\/ create logic ...     } } <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438 \u0431\u0435\u0437 \u044f\u0432\u043d\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f <code>\\Bitrix\\Main\\Validation\\Engine\\AutoWire\\ValidationParameter<\/code>. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u044b\u0445.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"php\"> class UserController extends \\Bitrix\\Main\\Engine\\Controller { public function createAction( #[\\Bitrix\\Main\\Validation\\Rule\\PhoneOrEmail] string $login, #[\\Bitrix\\Main\\Validation\\Rule\\NotEmpty] string $password, #[\\Bitrix\\Main\\Validation\\Rule\\NotEmpty] string $passwordRepeat ): array { \/\/ logic here } } <\/code><\/pre>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u043a\u0430\u043a \u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442, \u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 <code>getAutoWiredParameters<\/code> \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u043c\u0443 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <code>Validatable<\/code>:<\/p>\n<pre><code class=\"php\"> class UserController extends \\Bitrix\\Main\\Engine\\Controller { public function createAction( #[\\Bitrix\\Main\\Validation\\Rule\\Recursive\\Validatable] CreateUserDto $dto) : Result { \/\/ create logic ... } } <\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043f\u0430\u043a\u0435\u0442 \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u0441\u044f \u043a \u0432\u044b\u043f\u0443\u0441\u043a\u0443 \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u043e\u0434\u0443\u043b\u044f main \u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u0441\u043a\u043e\u0440\u043e (\u0432 \u044d\u0442\u043e\u043c \u0440\u0435\u043b\u0438\u0437\u0435) \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0432\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043d\u0430 \u0431\u0430\u0437\u0435 Bitrix Framework.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/924732\/\"> https:\/\/habr.com\/ru\/articles\/924732\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442! \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a\u0438\u0435 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445 \u044f\u0434\u0440\u0430 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u2014 \u044d\u0442\u043e \u0447\u0430\u0441\u0442\u044c <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Model-View-Controller\" rel=\"noopener noreferrer nofollow\">MVC<\/a> \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u0430.<\/p>\n<p>\u041f\u0440\u043e MVC \u043c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0430\u043a\u0446\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u044d\u0442\u043e\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. \u041b\u0443\u0447\u0448\u0435 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0441\u043e\u0441\u0442\u043e\u044f\u0442 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.<br \/> \u0410 \u0435\u0449\u0435 \u0434\u043b\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435. \u041c\u044b \u0443\u0436\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438 \u043e\u0431 \u044d\u0442\u043e\u043c <a href=\"https:\/\/docs.1c-bitrix.ru\/pages\/framework\/controllers.html#avtomaticheskoe-izvlechenie-parametrov\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0447\u0438\u0442\u0430\u043b\u0438, \u0442\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c. \u0422\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0433\u0447\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0442\u043e, \u043e \u0447\u0435\u043c \u043c\u044b \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0432\u0430\u043c \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c.<\/p>\n<p>\u0427\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u043a\u043e\u0434 \u0434\u043e \u0438\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438, \u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u043c\u0435\u0441\u0442\u043d\u043e \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0441\u0430\u043c\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a Content-Type.<br \/> \u0422\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 (\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043f\u0435\u0440\u0435\u0434 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430) \u043c\u044b \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c <strong>\u043f\u0440\u0435\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u043c\u0438<\/strong>. \u041a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 &#8212; <strong>\u043f\u043e\u0441\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u043c\u0438<\/strong><\/p>\n<h2>\u0424\u0438\u043b\u044c\u0442\u0440\u044b<\/h2>\n<p>\u0415\u0441\u0442\u044c 2 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c (\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u0435\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u043c\u0438 \u0438 \u043f\u043e\u0441\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u043c\u0438) \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. \u041f\u0435\u0440\u0432\u044b\u0439 &#8212; \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 configureActions:<\/p>\n<pre><code class=\"php\">&lt;?php  use Bitrix\\Main\\Engine\\ActionFilter\\Authentication; use Bitrix\\Main\\Engine\\Controller;  final class Entity extends Controller { public function configureActions() { return [ 'get' =&gt; [ 'prefilters' =&gt; [ new Authentication(), ], ], ]; }  public function getAction(string $id) { \/\/ ... } } <\/code><\/pre>\n<p>\u0421\u043a\u043e\u0440\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u2014 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0431\u043e\u043b\u0435\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0438 \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439, \u043d\u043e \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u0441\u0451, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <code>configureActions<\/code>:<\/p>\n<pre><code class=\"php\">&lt;?php  use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Prefilters; use Bitrix\\Main\\Engine\\ActionFilter\\Authentication; use Bitrix\\Main\\Engine\\Controller;  final class Entity extends Controller { #[Prefilters([ new Authentication() ])] public function getAction(string $id) { \/\/ ... } } <\/code><\/pre>\n<p>\u041e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e \u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0442\u0440\u0435\u0447\u0435\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c <code>Bitrix\\Main\\Engine\\Exception\\ActionConfigurationException<\/code>.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0435 \u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u044e\u0449\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438. \u0421\u0442\u0430\u0440\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0447\u0435\u0440\u0435\u0437 <code>configureActions<\/code>:<\/p>\n<pre><code class=\"php\">&lt;?php  use Bitrix\\Main\\Engine\\ActionFilter\\Authentication; use Bitrix\\Main\\Engine\\ActionFilter\\Csrf; use Bitrix\\Main\\Engine\\Controller;  final class Entity extends Controller { public function configureActions() { return [ 'get' =&gt; [ '+prefilters' =&gt; [ new Authentication(), ], '-prefilters' =&gt; [ new Csrf(), ], ], ]; }  public function getAction(string $id) { \/\/ ... } } <\/code><\/pre>\n<p>\u041d\u043e\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0447\u0435\u0440\u0435\u0437 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b:<\/p>\n<pre><code class=\"php\">&lt;?php  use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\DisablePrefilters; use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\EnablePrefilters; use Bitrix\\Main\\Engine\\ActionFilter\\Authentication; use Bitrix\\Main\\Engine\\ActionFilter\\Csrf; use Bitrix\\Main\\Engine\\Controller;  final class Entity extends Controller { #[EnablePrefilters([ new Authentication() ])] #[DisablePrefilters([ new Csrf() ])] public function getAction(string $id) { \/\/ ... } } <\/code><\/pre>\n<p>\u0418 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432:<\/p>\n<pre><code class=\"php\">&lt;?php  use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\DisablePostfilters; use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\EnablePostfilters; use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Postfilters; use Bitrix\\Main\\Engine\\ActionFilter\\ClosureWrapper; use Bitrix\\Main\\Engine\\ActionFilter\\Cors; use Bitrix\\Main\\Engine\\Controller;  final class Entity extends Controller { #[Postfilters([ new Cors(), ])] #[EnablePostfilters([ new Cors(), ])] #[DisablePostfilters([ new ClosureWrapper(), ])] public function getAction(string $id) { \/\/ ... } } <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0440\u0435- \u0438 \u043f\u043e\u0441\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b:<\/p>\n<pre><code class=\"php\">&lt;?php  use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Authentication; use Bitrix\\Main\\Engine\\Controller;  final class Entity extends Controller { #[Authentication()] public function getAction(string $id) { \/\/ ... } } <\/code><\/pre>\n<p>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c \u0441\u0430\u043c\u0438\u0445 \u044d\u043a\u0448\u043d \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 <code>filterType<\/code>. \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u044f \u044d\u043a\u0448\u043d \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432.<\/p>\n<p>\u041d\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u0435\u0442\u043e\u0434\u044b <code>get<\/code> \u0438 <code>list<\/code> \u0431\u0443\u0434\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u043f\u0440\u0435\u0444\u0438\u043b\u044c\u0442\u0440\u044b:<\/p>\n<pre><code class=\"php\">&lt;?php  use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule; use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\DisablePrefilters; use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\EnablePrefilters; use Bitrix\\Main\\Engine\\ActionFilter\\Authentication; use Bitrix\\Main\\Engine\\ActionFilter\\Csrf; use Bitrix\\Main\\Engine\\ActionFilter\\FilterType; use Bitrix\\Main\\Engine\\Controller;  final class Entity extends Controller { #[EnablePrefilters([ new Authentication() ])] #[DisablePrefilters([ new Csrf() ])] public function getAction(string $id) { \/\/ ... }  #[Rule\\Authentication(type: FilterType::EnablePrefilter)] #[Rule\\Csrf(type: FilterType::DisablePrefilter)] public function listAction() { \/\/ ... } } <\/code><\/pre>\n<p>\u0418\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u044d\u043a\u0448\u043d \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432, \u043f\u0440\u043e\u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b:<\/p>\n<ul>\n<li>\n<p><code>Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Authentication<\/code><\/p>\n<\/li>\n<li>\n<p><code>Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\CloseSession<\/code><\/p>\n<\/li>\n<li>\n<p><code>Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\ContentType<\/code><\/p>\n<\/li>\n<li>\n<p><code>Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Cors<\/code><\/p>\n<\/li>\n<li>\n<p><code>Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Csrf<\/code><\/p>\n<\/li>\n<li>\n<p><code>Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\HttpMethod<\/code><\/p>\n<\/li>\n<li>\n<p><code>Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Scope<\/code><\/p>\n<\/li>\n<li>\n<p><code>Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Token<\/code><\/p>\n<\/li>\n<\/ul>\n<h3>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c<\/h3>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u0441\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <code>Cors<\/code>:<\/p>\n<pre><code class=\"php\">&lt;?php  declare(strict_types=1);  namespace Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule;  use Attribute; use Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\FilterAttributeInterface; use Bitrix\\Main\\Engine\\ActionFilter\\FilterType;  #[Attribute(Attribute::TARGET_METHOD)] final class Cors implements FilterAttributeInterface { public function __construct( private readonly ?string $origin = null, private readonly ?bool $credentials = null, private readonly FilterType $type = FilterType::EnablePrefilter, ) {  }  public function getFilters(): array { if ($this-&gt;type-&gt;isNegative()) { return [\\Bitrix\\Main\\Engine\\ActionFilter\\Cors::class]; }  return [new \\Bitrix\\Main\\Engine\\ActionFilter\\Cors($this-&gt;origin, $this-&gt;credentials)]; }  public function getType(): FilterType { return $this-&gt;type; } } <\/code><\/pre>\n<p>\u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u043e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u0430\u043c <code>\\Bitrix\\Main\\Engine\\ActionFilter\\Cors<\/code>.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435, \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0435 \u0435\u0441\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>FilterType<\/code> \u2014 \u043e\u043d \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0438\u043f \u0444\u0438\u043b\u044c\u0442\u0440\u0430. \u0412\u043e\u0442 \u0442\u0430\u043a \u043e\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442:<\/p>\n<pre><code class=\"php\">enum FilterType: string { case Prefilter = 'prefilters'; case Postfilter = 'postfilters';  case EnablePrefilter = '+prefilters'; case DisablePrefilter = '-prefilters';  case EnablePostfilter = '+postfilters'; case DisablePostfilter = '-postfilters';  public function isNegative(): bool { return in_array($this, [self::DisablePrefilter, self::DisablePostfilter], true); } } <\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u043a\u043b\u044e\u0447\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b \u043c\u0435\u0442\u043e\u0434\u0443 <code>configureActions<\/code>.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b <code>CloseSession<\/code> \u0431\u044b\u043b \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d, \u0442\u043e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"php\">class Task extends \\Bitrix\\Main\\Engine\\Controller { #[\\Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\CloseSession(type: FilterType::DisablePrefilter)] public function getAction(int $id): ?array { \/\/ ...  return $task; } } <\/code><\/pre>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0435 \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u043b\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0438 \u043f\u0440\u0435\u0444\u0438\u043b\u044c\u0442\u0440\u044b, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c\u0438 <code>\\Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Prefilters<\/code>, <code>\\Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\Rule\\Postfilters<\/code><\/p>\n<pre><code class=\"php\">class Task extends \\Bitrix\\Main\\Engine\\Controller { #[Prefilters([new Csrf(), new ContentType([ContentType::JSON])])] public function getAction(int $id): ?array { \/\/ ...  return $task; } } <\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u044b \u0422\u041e\u041b\u042c\u041a\u041e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0444\u0438\u043b\u044c\u0442\u0440\u044b, \u0430 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u2014 \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441 \u043f\u043e\u0441\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u043c\u0438<\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0432\u043e\u0438\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043f\u0440\u0435\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432<\/h3>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<ul>\n<li>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0430\u043c \u0444\u0438\u043b\u044c\u0442\u0440 (\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a Base)<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"php\">interface FilterAttributeInterface { \/**  * @return (Base|string)[]  *\/ public function getFilters(): array;  public function getType(): FilterType; } <\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"php\">#[Attribute(Attribute::TARGET_METHOD)] class MyCustomFilter implements \\Bitrix\\Main\\Engine\\ActionFilter\\Attribute\\FilterAttributeInterface { public function __construct( private readonly array $args, private readonly FilterType $type = FilterType::EnablePrefilter, ) {  } public function getFilters(): array { return [new MyCustomBaseFilter($this-&gt;args)] }  public function getType(): FilterType { return $this-&gt;type; } } <\/code><\/pre>\n<h2>\u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f<\/h2>\n<p>\u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445. \u041d\u043e\u0432\u043e\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u043c\u044b \u043f\u043e\u0441\u0432\u044f\u0442\u0438\u043b\u0438 <a href=\"https:\/\/habr.com\/ru\/companies\/bitrix\/articles\/854370\/\" rel=\"noopener noreferrer nofollow\">\u0446\u0435\u043b\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e<\/a>.<\/p>\n<p>\u041e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u043d\u0435\u0439, \u0435\u0441\u043b\u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u043d\u0435 \u0432\u0438\u0434\u0435\u043b\u0438 \u2014 \u044d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0436\u0435 \u043c\u044b \u0443\u043b\u0443\u0447\u0448\u0438\u043b\u0438 \u0441\u0432\u044f\u0437\u043a\u0443 \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u043c\u0438 \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0435\u0439.<\/p>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0431\u044b\u043b\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u043a\u0438\u043d\u0443\u0442\u044c \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u043e\u0431\u0435\u0440\u0442\u043a\u0443 &#8212; <code>\\Bitrix\\Main\\Validation\\Engine\\AutoWire\\ValidationParameter<\/code>:<\/p>\n<pre><code class=\"php\">class UserController extends Controller {     public function getAutoWiredParameters()     {         return [             new \\Bitrix\\Main\\Validation\\Engine\\AutoWire\\ValidationParameter(                 CreateUserDto::class,                 fn() =&gt; CreateUserDto::createFromRequest($this-&gt;getRequest()),             ),         ];     }          public function createAction(CreateUserDto $dto): Result     {         \/\/ create logic ...     } } <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438 \u0431\u0435\u0437 \u044f\u0432\u043d\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f <code>\\Bitrix\\Main\\Validation\\Engine\\AutoWire\\ValidationParameter<\/code>. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u044b\u0445.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"php\"> class UserController extends \\Bitrix\\Main\\Engine\\Controller { public function createAction( #[\\Bitrix\\Main\\Validation\\Rule\\PhoneOrEmail] string $login,<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-466244","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/466244","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=466244"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/466244\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=466244"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=466244"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=466244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}