{"id":229457,"date":"2014-07-11T00:00:02","date_gmt":"2014-07-10T20:00:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=229457"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=229457","title":{"rendered":"<span class=\"post_title\">YII 2, \u0441\u0442\u0430\u0440\u0442 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u0430<\/span>"},"content":{"rendered":"<div class=\"content html_format\">     \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/725\/4e2\/0af\/7254e20afe3ec7fab7be38b495916b05.png\" alt=\"image\" align=\"left\"\/>\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0430\u0439\u0442\u044b \u043d\u0430 YII2, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0412\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440, PHP 5.4, Git, Composer, \u0437\u043d\u0430\u043d\u0438\u0435 \u00ab\u041e\u041e\u041f \u0432 PHP\u00bb \u0438 \u0410\u0439\u041a\u044c\u044e &gt; 103. \u041d\u0430\u0434\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0438 \u0441\u043b\u043e\u0436\u043d\u043e, \u043d\u043e \u0438 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0440\u0442\u0430\u043d\u0443\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 YII2 \u0441\u0430\u043c\u043e\u043c\u0443 \u0434\u043d\u0443 \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438: \u00ab\u0448\u043a\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u00bb \u0438 \u0441\u0442\u0430\u0440\u043f\u0435\u0440\u0430\u043c \u2014 \u0430\u0434\u0435\u043f\u0442\u0430\u043c CodeIgniter. \u0414\u0440\u0443\u0433\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u043b\u0438\u0431\u043e \u0435\u0449\u0435 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u044b (\u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 YII2 \u0435\u0449\u0435 \u043d\u0435\u0442), \u043b\u0438\u0431\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043b \u0442\u044b\u0441\u044f\u0447\u0443 YII1 \u0438 \u0441\u043e\u0442\u043d\u044e YII2 \u0441\u0430\u0439\u0442\u043e\u0432. \u042f \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0438 \u0441\u0442\u0430\u0442\u044c\u044e \u044f \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435 \u0442\u0430\u043a\u0443\u044e, \u0430 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u0443\u044e, \u0432\u0435\u0434\u044c \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u043c\u043e\u0439 \u043a\u043e\u043d\u0441\u043f\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0432\u0435\u043b \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f YII2. <a name=\"habracut\"><\/a><\/p>\n<ol>\n<li><a href=\"#step1\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/a><\/li>\n<li><a href=\"#step2\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/a><\/li>\n<li><a href=\"#step3\">\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f<\/a><\/li>\n<li><a href=\"#step4\">\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440<\/a><\/li>\n<li><a href=\"#step5\">\u041c\u043e\u0434\u0435\u043b\u044c<\/a><\/li>\n<li><a href=\"#step6\">\u0412\u044c\u044e<\/a><\/li>\n<li><a href=\"#step7\">\u0412\u0438\u0434\u0436\u0435\u0442\u044b<\/a><\/li>\n<li><a href=\"#step8\">\u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f<\/a><\/li>\n<li><a href=\"#step9\">\u041c\u043e\u0434\u0443\u043b\u0438<\/a><\/li>\n<li><a href=\"#step10\">\u041f\u043e\u0441\u043b\u0435\u0441\u043b\u043e\u0432\u0438\u0435<\/a><\/li>\n<\/ol>\n<p>  <a name=\"step1\"><\/a><\/p>\n<h2>\u0428\u0430\u0433 1. \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435.<\/h2>\n<p>  \u041a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u0438\u0434\u0442\u0438 \u0434\u0430\u043b\u044c\u0448\u0435:<\/p>\n<p>  1) Composer. \u042d\u0442\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u043c\u0438 composer.json, \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043f\u0430\u043f\u043a\u0443 vendor \u0438 \u0437\u0430\u043a\u0430\u0447\u0430\u0435\u0442 \u0442\u0443\u0434\u0430 \u0447\u0435\u0440\u0435\u0437 Git \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e YII2 \u0438 \u0432\u0441\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u00ab\u043f\u0430\u043a\u0435\u0442\u044b\u00bb, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a. <a href=\"http:\/\/habrahabr.ru\/post\/145946\/\">\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435<\/a>. \u0421\u0440\u0430\u0437\u0443 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0443, \u0432 Windows \u043c\u043e\u0436\u043d\u043e \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u043a\u0443\u0447\u0435\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435.<\/p>\n<p>  2) PSR-4. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0445\u043e\u043b\u0438\u0432\u0430\u0440\u044f\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0442\u0430\u0431, \u043a\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438 \u0442.\u0434. \u0421\u0435\u0439\u0447\u0430\u0441 \u0442\u0440\u0435\u043d\u0434 \u0442\u0430\u043a\u043e\u0439, \u0447\u0442\u043e \u0442\u0430\u0431 \u2014 \u044d\u0442\u043e 4\u0440\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u0430, \u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f PSR-4. \u0418\u043c\u0435\u043d\u043d\u043e \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0435 PSR-4 \u041a\u043e\u043c\u043f\u043e\u0441\u0435\u0440 \u043a\u043e\u043c\u043f\u043e\u043d\u0443\u0435\u0442 \u0441\u043a\u0430\u0447\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b:<\/p>\n<p>  vendor\/vendor_name\/package_name\/<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 composer.json, YII2 \u043b\u0435\u0436\u0438\u0442 \u0432 <\/p>\n<p>  vendor\/yiisoft\/yii2<\/p>\n<p>  \u0422\u0443\u0434\u0430 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u0430\u043f\u043a\u0438 framework \u0438\u0437 <a href=\"https:\/\/github.com\/yiisoft\/yii2\">\u0413\u0438\u0442\u0445\u0430\u0431\u0430 YII2<\/a>.<\/p>\n<p>  \u0412\u043e\u043e\u0431\u0449\u0435, \u043a\u0442\u043e \u043d\u0435 \u0432 \u0442\u0435\u043c\u0435, \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e PSR. \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043b\u043e\u0445\u043e\u0439 \u043f\u0430\u0440\u0435\u043d\u044c, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439_\u043c\u0435\u0442\u043e\u0434\u044b_\u0432\u043e\u0442_\u0442\u0430\u043a, \u043d\u043e \u0431\u0443\u0434\u044c\u0442\u0435 \u0433\u043e\u0442\u043e\u0432\u044b, \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u0441\u043a\u043e\u0440\u0435 \u0432\u0441\u0435 \u044d\u0442\u043e \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e \u0437\u0430\u043f\u0430\u0445\u043d\u0435\u0442, \u0432\u0430\u043c \u0442\u0430\u043a\u0438 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0447\u0438\u043d\u0438\u0442\u044c\u0441\u044f YII \u0438 \u0440\u043e\u0434\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 getYour_method \u2014 \u0430\u0434 \u043f\u0435\u0440\u0444\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0441\u0442\u0430.<\/p>\n<p>  3) Namespace. \u041f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d \u0431\u044b\u043b\u0438 \u0432\u0432\u0435\u0434\u0435\u043d\u044b \u0432 PHP 5.3. \u0414\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0439 \u043a\u0443\u0445\u043d\u0438, \u043e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 <a href=\"https:\/\/github.com\/yiisoft\/yii2\/blob\/master\/framework\/classes.php\">vendor\/yiisoft\/yii2\/classes.php<\/a>. \u0417\u0434\u0435\u0441\u044c \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b \u043a\u043b\u0430\u0441\u0441\u044b, \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0435 YII2. \u0413\u043b\u0430\u0432\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <a href=\"https:\/\/github.com\/yiisoft\/yii2\/blob\/master\/framework\/web\/Application.php\">web\/application.php<\/a>. \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0435\u0433\u043e \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441 \u2014 yii\\web. \u0427\u0442\u043e \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442? \u0414\u0430 \u043f\u043e\u043a\u0430 \u043d\u0438\u0447\u0435\u0433\u043e, \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<p>  $application = new \\yii\\web\\Application;<\/p>\n<p>  \u0410 \u0435\u0441\u043b\u0438 \u043f\u043e\u0442\u043e\u043c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u043e\u0439 class Application, \u0435\u0433\u043e \u043c\u044b \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u0435\u0433\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441, \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<p>  $application2 = new \\vasya\\megasoft\\Application;<\/p>\n<p>  \u0414\u043e PHP 5.3 \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c.<\/p>\n<p>  \u0412\u0441\u0435 \u043a\u043b\u0430\u0441\u0441\u044b classes.php \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u043e \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u0430\u043c \\yii\\**\\**, \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430. \u041d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u044b \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0441\u043a\u0438\u0434\u0430\u0435\u043c \u043f\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u0430\u043c \u0438 YII \u0441\u043c\u043e\u0436\u0435\u0442 \u043f\u043e \u043d\u0438\u043c \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435. <\/p>\n<p>  4) MVC. \u041d\u0438\u0447\u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u0441\u0445\u0435\u043c\u044b MVC (\u043c\u043e\u0434\u0435\u043b\u044c-\u0432\u0438\u0434-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440) \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u044b\u043b\u043e \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u043e, \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043f\u043e \u044d\u0442\u043e\u0439 \u0441\u0445\u0435\u043c\u0435. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043b\u044e\u0431\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 (\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e) \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0438 (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e) \u041c\u043e\u0434\u0435\u043b\u044c \u0438 (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e) \u0412\u044c\u044e. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e, \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u043d\u043e \u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u043e, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u2014 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0438 \u043e\u0442 \u043a\u0443\u0434\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u0440\u0447\u0430\u0442\u044c (\u0441 \u0443\u0436\u0430\u0441\u043e\u043c \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u0435 \u0432\u0430\u0448 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0435 \u043d\u0430 MVC).<\/p>\n<p>  \u0412\u043e\u0442 \u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 YII2, \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0449\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0438 \u043c\u043e\u0434\u0435\u043b\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0444\u0430\u0439\u043b\u044b \u0448\u0430\u0431\u043b\u043e\u043d\u0430:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.yiiframework.com\/doc-2.0\/yii-web-controller.html\">yii\\web\\Controller<\/a><\/li>\n<li><a href=\"http:\/\/www.yiiframework.com\/doc-2.0\/yii-base-model.html\">yii\\base\\Model<\/a><\/li>\n<li><a href=\"http:\/\/www.yiiframework.com\/doc-2.0\/yii-web-view.html\">yii\\web\\View<\/a><\/li>\n<\/ul>\n<p>  5) CRUD. Create, Read, Update, Delete. \u041f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043d\u0430 \u044d\u0442\u0438\u0445 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0431\u0443\u043a\u0432\u0430\u0445. \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c, \u0447\u0438\u0442\u0430\u0435\u043c, \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c, \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <a name=\"step2\"><\/a><\/p>\n<h2>\u0428\u0430\u0433 2. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430.<\/h2>\n<p>  \u0412 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c composer.json \u0441 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0435\u0439 require:<\/p>\n<pre><code>{     &quot;minimum-stability&quot;: &quot;dev&quot;,     &quot;require&quot;: {         &quot;yiisoft\/yii2&quot;: &quot;*&quot;     } } <\/code><\/pre>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u0432\u044b\u0439\u0434\u0435\u0442 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f YII2, \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 (minimum-stability) \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442\u043f\u0430\u0434\u0435\u0442. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u041a\u043e\u043c\u043f\u043e\u0441\u0435\u0440\u0443. \u0412 Linux \u043d\u0430\u0434\u043e \u0432 \u043f\u0430\u043f\u043a\u0435 \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c composer install. \u0412 Windows \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0433\u0430\u043b\u043e\u0447\u043a\u0443 \u00ab\u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u043e\u0432\u043e\u0434\u043d\u0438\u043a\u00bb \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u0430\u0432\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443 \u043c\u044b\u0448\u0438 (\u041f\u041a\u041c \u043f\u043e \u043f\u0430\u043f\u043a\u0435 \u0441 composer.json).<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u041e\u041a, \u0441\u043e\u0437\u0434\u0430\u0441\u0442\u0441\u044f \u043f\u0430\u043f\u043a\u0430 vendor, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043c\u0435\u0449\u0435\u043d YII2 \u0438 \u0432\u0441\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b. \u0412 \u043f\u0430\u043f\u043a\u0435 \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0436\u0430\u0442\u044c autoload.php, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442 \u0432\u0441\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b.<\/p>\n<p>  \u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0435\u0449\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u0435\u0431\u0430\u0433\u043e\u0432\u0430\u044f \u043f\u0430\u043d\u0435\u043b\u044c \u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430. \u0421\u0440\u0430\u0437\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0432 require:<\/p>\n<pre><code>{     &quot;minimum-stability&quot;: &quot;dev&quot;,     &quot;require&quot;: {         &quot;yiisoft\/yii2&quot;: &quot;*&quot;,         &quot;yiisoft\/yii2-debug&quot;: &quot;*&quot;,         &quot;yiisoft\/yii2-gii&quot;: &quot;*&quot;     } } <\/code><\/pre>\n<p>  \u0418 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435: composer update.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043a\u043b\u0435\u043f\u0430\u0442\u044c \u0441\u0430\u0439\u0442\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u043a\u0430\u0440\u043a\u0430\u0441\u043e\u0432. \u0421\u043c. <a href=\"http:\/\/www.yiiframework.com\/download\/\">\u0442\u0443\u0442<\/a>, \u043a\u0430\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0438\u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u043a\u0430\u0440\u043a\u0430\u0441 YII2 \u0441\u0430\u0439\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 \u041a\u043e\u043c\u043f\u043e\u0441\u0435\u0440, \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0441\u0430\u043c\u0438\u043c YII.<\/p>\n<p>  <a name=\"step3\"><\/a><\/p>\n<h2>\u0428\u0430\u0433 3. \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f.<\/h2>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u2014 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f. \u041d\u0430\u0448\u0435 \u0431\u0443\u0434\u0443\u0449\u0435\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 CodeIgniter \u043f\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435. \u041d\u043e \u0432\u043e\u043e\u0431\u0449\u0435, \u0432 YII2 \u043c\u043e\u0436\u043d\u043e (\u043d\u043e \u043b\u0443\u0447\u0448\u0435 \u043d\u0435 \u043d\u0430\u0434\u043e) \u043c\u0443\u0442\u0438\u0442\u044c \u0441 \u043f\u0430\u043f\u043a\u0430\u043c\u0438 \u0438 \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u0430\u043c\u0438 \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 application \u0438 \u0432 \u043d\u0435\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0430\u043f\u043e\u043a: config, controllers, models, views, components, runtime (\u0441\u044e\u0434\u0430 YII \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u043b\u043e\u0433\u0438).<\/p>\n<p>  index.php \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a, \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0435\u0433\u043e \u0432 \\yii\\web\\Application:<\/p>\n<pre><code class=\"php\">&lt;?php \/\/\u042d\u0442\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0443\u0431\u0435\u0440\u0435\u043c, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c define('YII_DEBUG', true); define('YII_ENV_DEV', true);  \/\/\u0410\u0432\u0442\u043e\u043b\u043e\u0434\u0435\u0440 \u043a\u043e\u043c\u043f\u043e\u0441\u0435\u0440\u0430 require 'vendor\/autoload.php';  \/\/\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u044f\u0434\u0440\u0430 require 'vendor\/yiisoft\/yii2\/Yii.php';  \/\/\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0430 $config = require dirname(__FILE__).'\/application\/config\/config.php';  \/\/\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0430 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 $app = new \\yii\\web\\Application($config); \/\/\u042d\u043a\u0437\u0435\u043a\u0443\u0446\u0438\u044f $app-&gt;run(); <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0432\u043e\u043e\u0431\u0449\u0435 \u0434\u0435\u043b\u0430\u0435\u043c. yii\\web\\Application \u2014 \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u0430\u043a \u0438 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0432 YII. \u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"http:\/\/www.yiiframework.com\/doc-2.0\/yii-web-application.html\">\u0432\u043e\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a> \u043d\u0430 \u044d\u0442\u043e\u0442, \u0432 \u043d\u0435\u0439 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u043a\u0430\u0436\u0434\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0438 \u043c\u0435\u0442\u043e\u0434. \u041f\u043e\u0441\u043b\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u043d\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u041f\u0440\u043e \u00ab\u0445\u043e\u0440\u043e\u0448\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e\u00bb \u2014 \u044f \u0441\u043b\u0443\u043a\u0430\u0432\u0438\u043b, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u00ab\u0441\u043a\u043e\u0440\u043e \u0431\u0443\u0434\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e\u00bb, \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 YII2 \u0432 \u0441\u0442\u0430\u0434\u0438\u0438 \u0431\u0435\u0442\u044b \u0438 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a\u0443\u0447\u0430 \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p>  \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 application\/config\/config.php \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0433\u043e \u0441 \u0431\u0430\u0437\u043e\u0439:<\/p>\n<pre><code class=\"php\">&lt;?php $config = [ 'id' =&gt; 'HelloPage', 'name' =&gt; 'My first web application', 'basePath' =&gt; dirname(dirname(__FILE__)), 'vendorPath' =&gt; dirname(dirname(dirname(__FILE__))).'\/vendor', 'components' =&gt; [     'db' =&gt; [         'class' =&gt; 'yii\\db\\Connection',         'dsn' =&gt; 'mysql:host=localhost;dbname=yii2',         'username' =&gt; 'root',         'password' =&gt; '***',         ],     ],     \/\/\u0414\u0440\u0443\u0433\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b YII2: ]; \/\/\u041d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u0435\u0431\u0430\u0433\u043e\u0432\u0430\u044f \u043f\u0430\u043d\u0435\u043b\u044c \u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430 if (YII_ENV_DEV) {     $config['bootstrap'][] = 'debug';     $config['modules']['debug'] = 'yii\\debug\\Module';      $config['bootstrap'][] = 'gii';     $config['modules']['gii'] = 'yii\\gii\\Module'; }  return $config; <\/code><\/pre>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442 \u043e\u0434\u0438\u043d \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u2014 \u043a\u043b\u0430\u0441\u0441 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0411\u0414. \u0418, \u0435\u0441\u043b\u0438 \u0432 index.php \u043f\u0440\u043e\u0434\u0435\u0444\u0430\u0439\u043d\u0435\u043d\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043f\u0430\u0440\u0443 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0434\u043b\u044f \u0432\u0441\u0435\u043c\u0438\u0443\u0432\u0430\u0436\u0430\u0435\u043c\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0432\u0441\u0435 \u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u0430\u043f\u043a\u0443 assets \u0441 \u00ab\u0445\u043e\u0440\u0448\u0438\u043c\u0438\u00bb \u043f\u0440\u0430\u0432\u0430\u043c\u0438, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043a\u043e\u0434\u0430 <a href=\"http:\/\/site.lc\/?r=gii\">site.lc\/?r=gii<\/a>. \u041f\u043e\u043f\u0443\u0442\u043d\u043e \u0446\u0435\u043d\u0438\u043c \u0434\u0435\u0431\u0430\u0433\u043e\u0432\u0443\u044e \u043f\u0430\u043d\u0435\u043b\u044c \u0441\u043d\u0438\u0437\u0443. \u0421\u043a\u0430\u0437\u043a\u0430.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438, \u0434\u043e\u043c\u0430\u0448\u043d\u0438\u043c \u0437\u0430\u0434\u0430\u043d\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0432\u043e\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0411\u0414, \u0430 \u0442\u0430\u043a\u0436\u0435 CRUD \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. <\/p>\n<p>  <a name=\"step4\"><\/a><\/p>\n<h2>\u0428\u0430\u0433 4. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440.<\/h2>\n<p>  \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u2014 \u043a\u043b\u0430\u0441\u0441, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0448\u0438\u0439 \u044d\u043a\u0448\u0435\u043d\u044b, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041a\u0430\u0436\u0434\u044b\u0439 \u044d\u043a\u0448\u0435\u043d \u2014 \u044d\u0442\u043e \u043d\u0435\u043a\u0430\u044f \u043a\u043d\u043e\u043f\u043a\u0430 \u043d\u0430 \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043d\u0435\u043b\u0438. \u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u2014 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<p>  \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432 YII2 \u2014 SiteController, \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043b\u0435\u0436\u0430\u0442\u044c \u0432 \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u0435 app\\controllers (\u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0437\u0430\u0434\u0430\u0432 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u043a\u043b\u044e\u0447 controllerNamespace). \u042d\u043a\u0448\u0435\u043d \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u2014 Index. \u0421\u043e\u0437\u0434\u0430\u0435\u043c application\/controllers\/SiteController.php. \u041f\u043e\u043c\u043d\u0438\u0442\u0435 \u043f\u0440\u043e PSR? \u0422\u0430\u043a \u0432\u043e\u0442, \u043a\u043b\u0430\u0441\u0441\u044b \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0441 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0431\u0443\u043a\u0432\u044b, \u043a\u0430\u043a \u0438 \u0444\u0430\u0439\u043b\u044b, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435 \u043a\u043b\u0430\u0441\u0441. \u0410 \u043c\u0435\u0442\u043e\u0434\u044b \u2014 \u0441 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0439 \u0431\u0443\u043a\u0432\u044b.<\/p>\n<pre><code class=\"php\">&lt;?php namespace app\\controllers;  use Yii; use \\yii\\web\\Controller; \/\/\u041d\u0430\u0448 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 YII2.  class SiteController extends Controller { \tpublic function actionIndex() \t{ \t\t$message = &quot;Hello, world!&quot;; \t\treturn $message; \t} } <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u0432\u0441\u0435 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u0423\u0432\u0438\u0434\u0438\u043c \u0445\u0435\u043b\u043b\u043e \u0432\u043e\u0440\u043b\u0434, \u0432\u044b\u0437\u0432\u0430\u0432 \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u0430\u0439\u0442\u0430. \u041a\u043e\u043c\u0443 \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0437\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u0435\u043d \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0432\u043e\u043e\u0431\u0449\u0435, \u0442\u043e\u0442 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u044d\u043a\u0448\u043d:<\/p>\n<pre><code class=\"php\">\tpublic function actionVasya() \t{ \t\treturn 'Hello, Vasya'; \t} <\/code><\/pre>\n<p>  \u0418 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \/?r=site\/vasya. \u041c\u0430\u0442\u0435\u0440\u044c \u0431\u043e\u0436\u044c\u044f, \u0434\u0430 YII \u043f\u043e _GET[r] \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b, \u0447\u0442\u043e \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u043c\u0435\u0442\u043e\u0434 actionVasya \u043a\u043b\u0430\u0441\u0441\u0430 SiteController. \u0414\u0430\u043b\u0435\u0435 \u0432 \u043c\u0435\u0442\u043e\u0434\u0430\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f if-else, \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0431\u0430\u0437\u044b \u0447\u0435\u0440\u0435\u0437 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0448\u0430\u0431\u043b\u043e\u043d (\u0432\u044c\u044e).<\/p>\n<p>  \u0427\u0438\u0442\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0443\u0438\u0438\u0448\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 <a href=\"http:\/\/www.yiiframework.com\/doc-2.0\/yii-web-controller.html\">yii\\web\\Controller<\/a>, \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0437\u0430\u0438\u043c\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430.<\/p>\n<p>  \u041f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u043d\u0430\u0448\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0431\u0435\u043a\u0435\u043d\u0434\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432 \u0441\u0432\u043e\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 CRUD \u043c\u0435\u0442\u043e\u0434\u044b: actionRead, actionUpdate, actionDelete, actionCreate, \u043a\u0430\u0436\u0434\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c\u0438 \u0434\u0435\u043b\u0430\u043c\u0438, \u043d\u043e \u0432\u0441\u0435 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0449\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c. \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u044d\u0442\u0438\u0445 \u044d\u043a\u0448\u0435\u043d\u043e\u0432 \u044f \u0443\u043f\u0443\u0449\u0443 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u0420\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u0436\u0434\u044b\u0439, \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u043c \u0437\u0430\u0434\u0430\u043d\u0438\u0438.<\/p>\n<p>  <a name=\"step5\"><\/a><\/p>\n<h2>\u0428\u0430\u0433 4. \u041c\u043e\u0434\u0435\u043b\u044c.<\/h2>\n<p>  \u041c\u043e\u0434\u0435\u043b\u044c \u0432 YII \u2014 \u0441\u0430\u043c\u0430\u044f \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0432\u0435\u0449\u044c, \u0438\u043c\u0435\u043d\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u0432\u0441\u0435 \u0447\u0430\u0441\u0442\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438. \u041c\u043e\u0434\u0435\u043b\u044c \u0432 YII2 \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u0430 \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0415\u0441\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0438 \u0435\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0435\u0435. <\/p>\n<p>  \u0422\u0443\u0442 \u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044e \u0441\u0435\u0431\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u043e\u0442 YII. \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0432 YII, \u043d\u0430\u0434\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u043e\u043e\u0431\u0449\u0435. \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u041e\u041e\u041f, \u0432\u0441\u0435 \u0432 \u043c\u0438\u0440\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u2014 \u0440\u0435\u0447\u043a\u0430, \u0447\u0435\u043b\u043e\u0432\u0435\u043a, \u043f\u0435\u0441\u043e\u043a, \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440. \u041b\u0443\u0447\u0448\u0435, \u0435\u0441\u043b\u0438 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0442\u043e\u0436\u0435 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u2014 \u043d\u043e\u0437\u0434\u0440\u044f, \u043f\u0430\u043b\u044c\u0446\u044b \u043d\u043e\u0433 \u0438 \u0442.\u0434. \u041d\u0443 \u0434\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u0430\u043b\u0435\u043a\u043e, \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043c\u043e\u0434\u0435\u043b\u0438. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0441\u043a\u043e\u0439 \u0444\u0438\u0440\u043c\u044b, \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u2014 \u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e (\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 private \u043c\u0435\u0442\u043e\u0434\u044b, \u043d\u043e \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u043a\u043e \u043c\u044b \u0437\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c). \u0412\u043e\u043a\u0440\u0443\u0433 \u041e\u041e\u041e \u043a\u0440\u0443\u0442\u044f\u0442\u0441\u044f \u0432\u0441\u0435 \u043f\u0438\u0440\u043e\u0433\u0438 \u0444\u0438\u0440\u043c\u044b, \u044d\u0442\u043e \u0435\u0435 \u043e\u0441\u043d\u043e\u0432\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0444\u0438\u0440\u043c\u044b \u2014 \u044d\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u041e\u041e\u041e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u044d\u0442\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 PHP \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c application\/models\/OOO.php<\/p>\n<pre><code class=\"php\">&lt;?php namespace app\\models; class OOO {     private $name = NULL;     private $founders = [];      function __construct($name, array $founders) {         $this-&gt;name = $name;         $this-&gt;founders = $founders;     } }  <\/code><\/pre>\n<p>  \u0412\u0441\u0435, \u0434\u0430\u043b\u044c\u0448\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0434\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 (use app\\models), \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0433\u043e\u0434\u043d\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0438\u043c\u0435\u043d\u0430\u043c\u0438 \u0438 \u0443\u0447\u0440\u0435\u0434\u0438\u0442\u0435\u043b\u044f\u043c\u0438, \u043a\u0430\u043a \u0443\u0433\u043e\u0434\u043d\u043e \u043a\u0440\u0443\u0442\u0438\u0442\u044c-\u0432\u0435\u0440\u0442\u0435\u0442\u044c \u044d\u0442\u0438\u043c\u0438 \u041e\u041e\u041e \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 \u0438 \u0432\u044c\u044e\u0445\u0430\u0445.<\/p>\n<pre><code class=\"php\">$ooo1 = new OOO('Test1', array('Vasya', 'Petya')); $ooo2 = new OOO('Test2', array('Nina')); <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u043d\u0430\u0434\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u041e\u041e\u041e \u2014 \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u043d\u043e \u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043b\u0438\u044f\u043d\u0438\u044f. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 merge, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438, \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u0443\u0434\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u0441\u043b\u0438\u044f\u043d\u0438\u044f.<\/p>\n<pre><code class=\"php\">$ooo1 = new OOO('Test1', array('Vasya', 'Petya')); $ooo2 = new OOO('Test2', array('Nina')); $ooo1-&gt;merge($ooo2); <\/code><\/pre>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u044e \u0436\u0438\u0437\u043d\u044c. \u0427\u0435\u043c \u043d\u0430\u043c \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 YII2? \u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u2014 \u043a\u043b\u0430\u0441\u0441 \\yii\\db\\ActiveRecord (\u0441\u043e\u0432\u0435\u0442\u0443\u044e <a href=\"http:\/\/www.yiiframework.com\/doc-2.0\/guide-active-record.html\">\u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0437\u0443\u0447\u0438\u0442\u044c<\/a>), \u0442\u0430\u043c \u043a\u0443\u0447\u0430 \u0432\u0441\u0435\u0433\u043e, \u0447\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438 MySQL. \u041d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c \u0435\u0433\u043e \u0438 \u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c.<\/p>\n<p>  \u041a\u0441\u0442\u0430\u0442\u0438, \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0410\u043a\u0442\u0438\u0432\u0420\u0435\u043a\u043e\u0440\u0434 \u0442\u044f\u043d\u0435\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 <a href=\"http:\/\/www.yiiframework.com\/doc-2.0\/yii-base-model.html\">yii\\base\\Model<\/a>, \u0438\u0437\u0443\u0447\u0438\u0432 \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441, \u0432\u044b \u043f\u043e\u0439\u043c\u0435\u0442\u0435, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0432 YII. \u042d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445, \u044d\u0442\u043e \u00ab\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b\u00bb, \u044d\u0442\u043e \u00ab\u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f\u00bb, \u044d\u0442\u043e \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0433\u0435\u0442\u0442\u0435\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u043c \u0432\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  \u0412 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0442\u0440\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u0440\u0442\u044f\u043d\u043a\u0430 SQL<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">CREATE TABLE IF NOT EXISTS `founders` (`id` int(11) NOT NULL, `name` varchar(255) NOT NULL) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; INSERT INTO `founders` (`id`, `name`) VALUES(1, 'Vasya'),(2, 'Petya');  CREATE TABLE IF NOT EXISTS `founders_to_ooo` (`founder_id` int(11) NOT NULL,`ooo_id` int(11) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8; ALTER TABLE `founders` ADD PRIMARY KEY (`id`); INSERT INTO `founders_to_ooo` (`founder_id`, `ooo_id`) VALUES(1, 1),(2, 1);  CREATE TABLE IF NOT EXISTS `ooo` (`id` int(11) NOT NULL,`name` varchar(255) NOT NULL) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; ALTER TABLE `ooo` ADD PRIMARY KEY (`id`); INSERT INTO `ooo` (`id`, `name`) VALUES(1, 'Test1'); <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u2014 ooo. \u0412 founders \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0443\u0447\u0440\u0435\u0434\u0438\u0442\u0435\u043b\u0438. founders_to_ooo \u2014 \u0441\u0432\u044f\u0437\u0443\u044e\u0449\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0433\u043e\u0434\u043d\u043e \u0443\u0447\u0440\u0435\u0434\u0438\u0442\u0435\u043b\u0435\u0439 \u043a \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 ooo.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c application\/models\/OOO.php:<\/p>\n<pre><code class=\"php\">&lt;?php namespace app\\models; use app\\models\\Founder;  class OOO extends \\yii\\db\\ActiveRecord {      public static function tableName()     {         return 'ooo';     }      \/\/\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d YII2 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 $ooo-&gt;founders     \/\/\u042d\u0442\u043e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 PHP 5 (\u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0433\u0435\u0442\u0442\u0435\u0440\u044b-\u0441\u0435\u0442\u0442\u0435\u0440\u044b) \u0438 yii\\base\\Model     \/\/\u041c\u044b \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u0432\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 &quot;via Table&quot; \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442     public function getFounders()     {         \/\/\u0410 \u044d\u0442\u043e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 ActiveRecord         return $this-&gt;hasMany(Founder::className(), ['id' =&gt; 'founder_id'])-&gt;viaTable('founders_to_ooo', ['ooo_id' =&gt; 'id']);     }      public function setFounders($ids)     {         \/\/\u0410 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 $model-&gt;founders = [1,2,3];         \/\/\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0443\u0447\u0440\u0435\u0434\u0438\u0442\u0435\u043b\u0435\u0439 \u0432 \u0431\u0430\u0437\u0443     }      \/\/\u041e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0438     public function rules()     {         return [['name', 'required']];     }      \/\/\u041f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c     public function attributeLabels()     {         return [             'id' =&gt; '\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440',             'name' =&gt; '\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435',             'founders' =&gt; '\u0423\u0447\u0440\u0435\u0434\u0438\u0442\u0435\u043b\u0438'         ];     } } <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0443\u0447\u0440\u0435\u0434\u0438\u0442\u0435\u043b\u0435\u0439 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c Founder.<\/p>\n<pre><code class=\"php\">&lt;?php namespace app\\models;  class Founder extends \\yii\\db\\ActiveRecord {      public static function tableName()     {         return 'founders';     }      public function rules()     {         return [['name', 'required']];     }      public function attributeLabels()     {         return [             'id' =&gt; '\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440',             'name' =&gt; '\u0418\u043c\u044f'         ];     } } <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435, \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c use app\\models\\OOO; \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0438\u043d\u0444\u0443 \u043e \u041e\u041e\u041e \u0441 id=1  <\/p>\n<pre><code class=\"php\">\/\/$model = OOO::findOne(1); \/\/\u0412\u043e\u0442 \u0442\u0430\u043a \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043e\u0434\u043d\u0443 \u041e\u041e\u041e \u043f\u043e ID $model = OOO::findAll(['id' =&gt; [1, 2]]); \/\/\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0430\u0440\u043e\u0447\u043a\u0443 \u041e\u041e\u041e  \/\/\u0412\u044b\u0432\u043e\u0434\u0438\u043c foreach($model as $ooo) {     echo $ooo-&gt;name;     print_r($ooo-&gt;founders); } <\/code><\/pre>\n<p>  \u041d\u043e\u0442 \u0431\u044d\u0434.<\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u0442\u0430\u043a \u043c\u043e\u0436\u043d\u043e (\u043d\u0443\u0436\u043d\u043e) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 yii\\base\\model\\load() \u0432 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u0441 yii\\db\\ActiveRecord\\save() \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0411\u0414:<\/p>\n<pre><code class=\"php\">if ($model-&gt;load(Yii::$app-&gt;request-&gt;post()) && $model-&gt;save()) {     \/\/\u0420\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u0438\u043c \u043a\u0443\u0434\u0430 \u043d\u0430\u0434\u043e \u0438\u043b\u0438 \u0434\u0435\u043b\u0430\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0435\u0449\u0438 } <\/code><\/pre>\n<p>  YII \u0432 load \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442 \u0432\u0441\u044e \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u0432 rules \u043c\u043e\u0434\u0435\u043b\u0438, \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 save(), \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b \u2014 \u0432\u043e \u0432\u044c\u044e\u0445\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0443\u0436\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0440\u044f\u0434\u043e\u043c \u0441 \u043f\u043e\u043b\u0435\u043c. \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043c\u044b \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0431\u0430\u0437\u0443 \u0447\u0435\u0440\u0435\u0437 \u0410\u041f\u0418 YII, \u043c\u044b \u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u0438\u043c \u0441\u0435\u0431\u044f \u043e\u0442 \u043b\u044e\u0431\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0439. \u041d\u043e\u0442 \u0431\u044d\u0434.<\/p>\n<p>  <a name=\"step6\"><\/a><\/p>\n<h2>\u0428\u0430\u0433 6. \u0412\u044c\u044e.<\/h2>\n<p>  \u042d\u0442\u043e \u0448\u0430\u0431\u043b\u043e\u043d \u0441\u0430\u0439\u0442\u0430. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 ($this-&gt;render(&#8216;index&#8217;, [&#8216;model&#8217; =&gt; $model]);) \u0438 \u044d\u0442\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440. \u0412 YII2 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u0434\u0432\u0430 \u0442\u0438\u043f\u0430: \u0441\u043b\u043e\u0439 \u0438 \u0432\u044c\u044e. \u0421\u043b\u043e\u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 views\/layouts, \u0432\u044c\u044e \u2014 \u0432 views\/{\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430}. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0438 \/application\/views\/layouts\/ \u0438 \/application\/views\/site\/<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043b\u043e\u0439 main.php (\u044d\u0442\u043e \u0441\u043b\u043e\u0439 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e). \u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u043e\u0439 YII2.<\/p>\n<pre><code class=\"php\">&lt;?php use yii\\helpers\\Html as Html; ?&gt; &lt;?php $this-&gt;beginPage() ?&gt; &lt;!doctype html&gt; &lt;html lang=&quot;&lt;?php \\Yii::$app-&gt;language?&gt;&quot;&gt; &lt;head&gt; &lt;meta charset=&quot;utf-8&quot; \/&gt; &lt;title&gt;&lt;?php echo Html::encode(\\Yii::$app-&gt;name); ?&gt;&lt;\/title&gt; &lt;?php $this-&gt;head() ?&gt; &lt;\/head&gt; &lt;?php $this-&gt;beginBody() ?&gt; &lt;h1&gt;&lt;?php echo Html::encode(\\Yii::$app-&gt;name); ?&gt;&lt;\/h1&gt; &lt;div class=&quot;content&quot;&gt;     &lt;?php echo $content?&gt; &lt;\/div&gt; &lt;?php $this-&gt;endBody() ?&gt; &lt;?php $this-&gt;endPage() ?&gt; <\/code><\/pre>\n<p>  \u0417\u0430\u0447\u0435\u043c \u0432\u0441\u0435 \u044d\u0442\u0438 &lt;?php $this-&gt;endBody() ?&gt; \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0442\u0435\u0433\u0430 ? \u0427\u0442\u043e\u0431\u044b \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u043c\u043e\u0433 \u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0440\u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0435, \u0442\u0443\u0434\u0430 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0438 \u0442.\u0434.<\/p>\n<p>  \u0425\u0435\u043b\u043f\u0435\u0440 html \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u043f\u043e\u0447\u0442\u0438 \u0432\u043e \u0432\u0441\u0435\u0445 \u0432\u044c\u044e\u0445\u0430\u0445, \u0438\u0437\u0443\u0447\u0438\u0442\u0435 <a href=\"http:\/\/www.yiiframework.com\/doc-2.0\/yii-helpers-html.html\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a> \u043f\u043e \u043d\u0435\u043c\u0443.<\/p>\n<p>  \u0421\u0430\u043c\u044b\u0435 \u0443\u043c\u043d\u044b\u0435 \u0443\u0436\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0432 $content \u0441\u043b\u043e\u044f YII \u0432\u0435\u0440\u043d\u0435\u0442 \u0432\u044c\u044e\u0445\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442 \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u044d\u043a\u0448\u0435\u043d\u0430. \u0421\u043e\u0437\u0434\u0430\u0435\u043c application\/views\/site\/index.php<\/p>\n<pre><code class=\"php\">&lt;h1&gt;\u041e\u041e\u041e\u0448\u043a\u0438&lt;\/h1&gt; &lt;ul&gt; &lt;?php foreach($model as $ooo) { ?&gt;     &lt;li&gt;&lt;h2&gt;&lt;?=$ooo-&gt;name;?&gt;&lt;\/h2&gt;&lt;pre&gt;&lt;?php print_r($ooo-&gt;founders); ?&gt;&lt;\/pre&gt;&lt;\/li&gt; &lt;?php } ?&gt; &lt;\/ul&gt; <\/code><\/pre>\n<p>  $model \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u044c\u044e \u0447\u0435\u0440\u0435\u0437 \u044d\u043a\u0448\u0435\u043d \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430.  <\/p>\n<pre><code class=\"php\">$model = OOO::findAll(['id' =&gt; [1, 2]]); return $this-&gt;render('index', ['model' =&gt; $model]); <\/code><\/pre>\n<p>  <a name=\"step7\"><\/a><\/p>\n<h2>\u0428\u0430\u0433 6. \u0412\u0438\u0434\u0436\u0435\u0442\u044b.<\/h2>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0446\u0435\u043b\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u2014 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0427\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u043e\u0434\u0430, \u0442\u0435\u043c \u043b\u0443\u0447\u0448\u0435. \u0410 \u043b\u0443\u0447\u0448\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434. \u0412\u0438\u0434\u0436\u0435\u0442 \u2014 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434. \u041f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u0438\u0434\u0436\u0435\u0442\u0430 \u2014 GridView, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u0439 \u043a\u043e\u043b\u043e\u043d\u043a\u0435.<\/p>\n<p>  \u0412\u0438\u0434\u043e\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430\u0448\u0443 \u0432\u044c\u044e:<\/p>\n<pre><code class=\"php\">&lt;?php use yii\\helpers\\HTML; use yii\\grid\\GridView; use yii\\grid\\ActionColumn; use yii\\grid\\CheckboxColumn; use yii\\grid\\SerialColumn; ?&gt; &lt;h1&gt;\u041e\u041e\u041e&lt;\/h1&gt; &lt;?php echo GridView::widget([     'id' =&gt; 'ooo-grid',     'dataProvider' =&gt; $dataProvider,     'filterModel' =&gt; $searchModel,     \/\/\u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043a\u043e\u043b\u043e\u043d\u043a\u0438     'columns' =&gt; [         [             'class' =&gt; CheckboxColumn::classname()         ],         [             'class' =&gt; SerialColumn::className(),         ],         [             'attribute' =&gt; 'name',             'format' =&gt; 'html',             'value' =&gt; function ($model) {                 return Html::a($model['name'], ['view', 'id' =&gt; $model['id']]);             }         ],         [             'class' =&gt; ActionColumn::className(),             'header' =&gt; '\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435'         ]     ] ]); <\/code><\/pre>\n<p>  \u0412\u0441\u0435, \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442? \u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b, \u043d\u043e \u043d\u0435\u0442, \u043d\u0430\u043c \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 $searchModel \u0438 $dataProvider. \u041f\u0435\u0440\u0432\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u2014 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u041e\u041e\u041e, \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e\u0449\u0430\u044f \u043f\u043e\u0438\u0441\u043a. \u0412\u0442\u043e\u0440\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u2014 \u044d\u0442\u0430 \u043d\u0430\u0448\u0430 \u0441\u0442\u0430\u0440\u0430\u044f $model, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0431\u043e\u0440\u043a\u0438, \u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u0435\u043d\u043d\u044b\u0439. \u0412\u0441\u0435 \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0447\u0435\u043c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b. \u041d\u043e \u043d\u0430 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435, \u043a\u0430\u043a \u0447\u0435\u0440\u0435\u0437 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u00ab\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u00bb \u043c\u0435\u0436\u0434\u0443 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u043c\u0438 \u0447\u0430\u0441\u0442\u044f\u043c\u0438 YII.<\/p>\n<p>  \u041c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u044d\u043a\u0448\u0435\u043d.<\/p>\n<pre><code class=\"php\">        $searchModel = new \\app\\models\\OOOSearch;         $dataProvider = $searchModel-&gt;search(Yii::$app-&gt;request-&gt;get()); \/\/\u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c _GET, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0436\u0435\u0442          return $this-&gt;render('index', [             'dataProvider' =&gt; $dataProvider,             'searchModel' =&gt; $searchModel         ]); <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c OOOSearch<\/p>\n<pre><code class=\"php\">&lt;?php namespace app\\models;  use Yii; use yii\\base\\Model; use yii\\data\\ActiveDataProvider; use app\\models\\OOO;  class OOOSearch extends Model {      public $name;      public function rules()     {         return [[['name'], 'string']];     }  \tpublic function search($params) \t{ \t\t$query = OOO::find(); \t\t$dataProvider = new ActiveDataProvider([ \t\t\t'query' =&gt; $query, \t\t\t'pagination' =&gt; [ \t\t\t    'pageSize' =&gt; 10 \t\t\t] \t\t]); \t\t \t\tif (!($this-&gt;load($params) && $this-&gt;validate())) { \t\t\treturn $dataProvider; \t\t}  \t\t$this-&gt;addCondition($query, 'name', true);  \t\treturn $dataProvider; \t}  \tprotected function addCondition($query, $attribute, $partialMatch = false)      {          $value = $this-&gt;$attribute;          if (trim($value) === '') {              return;          }          if ($partialMatch) {              $query-&gt;andWhere(['like', $attribute, $value]);          }         else {              $query-&gt;andWhere([$attribute =&gt; $value]);          }      } } <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u2014 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0443 \u0441 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0435\u0439 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435. \u041f\u043e\u0431\u043e\u0447\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442 \u043e\u0442 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u043e\u0434\u0433\u043e\u043d\u043a\u0438 \u043f\u043e\u0434 \u0441\u0435\u0431\u044f \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u2014 \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e-\u0442\u0430\u043a\u0438 \u043d\u0443\u0434\u043d\u043e\u0435 \u0437\u0430\u043d\u044f\u0442\u0438\u0435. \u0411\u043b\u0430\u0433\u043e, \u0435\u0441\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430 CRUD (\/?r=gii), \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c (\u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430, *\u0442\u0440\u043e\u043b\u043b\u0444\u0435\u0439\u0441*) \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c, \u0438 \u0432\u044c\u044e\u0445\u0443 \u0441 \u044d\u0442\u0438\u043c \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u043c.<\/p>\n<p>  \u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0432\u0438\u0434\u0436\u0435\u0442\u0435 yii\\widgets\\ActiveForm. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u0444\u043e\u0440\u043c\u044b \u043d\u0430 \u0441\u0430\u0439\u0442\u0435. \u0414\u0430\u043d\u043d\u044b\u0439 \u0432\u0438\u0434\u0436\u0435\u0442 \u0443\u043c\u0435\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0444\u043e\u0440\u043c\u044b \u0438 \u0432\u043e\u0437\u044c\u043c\u0435\u0442 \u043d\u0430 \u0441\u0435\u0431\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440. \u0412 \u0446\u0435\u043b\u043e\u043c \u2014 \u043e\u043d \u043a\u0440\u0430\u0439\u043d\u0435 \u043f\u0440\u043e\u0441\u0442. \u0412\u044b\u0432\u043e\u0434\u0438\u043c \u0444\u043e\u0440\u043c\u0443 \u0438 \u043e\u0434\u0438\u043d \u0438\u043d\u043f\u0443\u0442, \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0438\u043d\u043f\u0443\u0442\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u0441 rules, \u0447\u0442\u043e\u0431\u044b \u0432\u0438\u0434\u0436\u0435\u0442 \u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432\u0432\u0435\u0434\u0435\u043d\u043e \u0432 \u043a\u0430\u0436\u0434\u043e\u0435 \u043f\u043e\u043b\u0435:<\/p>\n<pre><code class=\"php\">&lt;?php use yii\\helpers\\Html; use yii\\widgets\\ActiveForm; ?&gt; &lt;?php $form = ActiveForm::begin(); ?&gt;     &lt;?= $form-&gt;field($model, 'name')-&gt;textInput(['maxlength' =&gt; 255]) ?&gt;     &lt;div class=&quot;form-group&quot;&gt;         &lt;?= Html::submitButton($model-&gt;isNewRecord ? 'Create' : 'Update', ['class' =&gt; $model-&gt;isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?&gt;     &lt;\/div&gt; &lt;?php ActiveForm::end(); ?&gt;  <\/code><\/pre>\n<p>  \u041f\u043e\u0432\u0442\u043e\u0440\u044e\u0441\u044c, \u0432 \u0438\u0434\u0435\u0430\u043b\u0435 \u0432\u0441\u044e \u044d\u0442\u0443 \u0433\u0430\u0434\u043e\u0441\u0442\u044c \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c, \u043d\u0430\u0434\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u0432\u043e\u0438\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430, \u0438 \u0432\u044c\u044e\u0445\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<p>  <a name=\"step8\"><\/a><\/p>\n<h2>\u0428\u0430\u0433 8. \u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f.<\/h2>\n<p>  \u0422\u0443\u0442 \u044f \u043f\u0440\u043e\u0446\u0438\u0442\u0438\u0440\u0443\u044e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 <a href=\"http:\/\/habrahabr.ru\/post\/208328\/\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438<\/a>.<\/p>\n<p>  \u0412 Yii \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0430\u043a\u0430\u044f \u0432\u0435\u0449\u044c \u043a\u0430\u043a \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f (behaviors).<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044e \u043b\u0438\u0448\u044c, \u0447\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c (\u0438\u0432\u0435\u043d\u0442\u0430\u043c). \u0410 \u0441\u0430\u043c\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u043a\u0430 \u043d\u0435\u0437\u0430\u0447\u0435\u043c, \u043e\u043d\u0430 \u043f\u043e\u043d\u044f\u0442\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043c, \u043a\u0442\u043e \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0442\u044b\u0441\u044f\u0447\u0438 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0439 YII \u0432 \u0441\u0432\u043e\u0435\u0439 \u0436\u0438\u0437\u043d\u0438.<\/p>\n<p>  \u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u2014 \u044d\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430\u043c\u0438 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\\\u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u0430\u043d\u0430\u043b\u043e\u0433 \u0445\u0443\u043a\u043e\u0432 \u0432 WordPress. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 WP \u043f\u043b\u0430\u0433\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0435\u0440\u0435\u0437 \u0445\u0443\u043a\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b WP \u0431\u043b\u043e\u0433\u0430. \u041a\u0430\u0436\u0434\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0446\u0435\u043f\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430 \u00ab\u0438\u0432\u0435\u043d\u0442\u00bb (\u0441\u043e\u0431\u044b\u0442\u0438\u0435) \u0432 \u043a\u0430\u043a\u043e\u043c-\u0442\u043e \u043a\u043b\u0430\u0441\u0441\u0435 YII2. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u0446\u0435\u043f\u0438\u0441\u044f \u0437\u0430 \u043a\u043b\u0430\u0441\u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 <a href=\"http:\/\/www.yiiframework.com\/doc-2.0\/yii-base-controller.html\">yii\\web\\Controller<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u0432\u0441\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e, \u043f\u0435\u0440\u0435\u043c\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0434\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0430 Events. \u0418\u0432\u0435\u043d\u0442\u0430 \u0443 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0430, \u0441 \u0433\u043e\u0432\u043e\u0440\u044f\u0449\u0438\u043c\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u043c\u0438: EVENT_AFTER_ACTION \u0438 EVENT_BEFORE_ACTION. \u0417\u0430\u0446\u0435\u043f\u0438\u043c\u0441\u044f \u0437\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u2014 *\u041f\u041e\u0421\u041b\u0415_\u0412\u042b\u041f\u041e\u041b\u041d\u0415\u041d\u0418\u042f_\u041b\u042e\u0411\u041e\u0413\u041e_\u042d\u041a\u0428\u0415\u041d\u0410* \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432 \u043b\u043e\u0433 \u0418\u041f \u0430\u0434\u0440\u0435\u0441, \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u043f\u0440\u043e\u0447\u0443\u044e \u0438\u043d\u0444\u0443.<\/p>\n<p>  \u041a\u0430\u043a \u0438 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0432 YII2, \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u043c. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 application\\components\\Log.php \u0432 \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u0435 app\\components<\/p>\n<pre><code class=\"php\">&lt;?php namespace app\\components;   use yii; use yii\\base\\Behavior; use yii\\web\\Controller;  class Log extends Behavior {      public $custom_info = NULL;      public function events()     {         return [             Controller::EVENT_BEFORE_ACTION =&gt; 'writeLog',             \/\/\u041c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0449\u0430 \u0447\u0442\u043e-\u0442\u043e \u0437\u0430\u0446\u0435\u043f\u0438\u0442\u044c\u0441\u044f         ];     }      public function writeLog() {         $controller = $this-&gt;owner;         file_put_contents('log.txt', &quot;{$_SERVER['REMOTE_ADDR']}|&quot;.time().&quot;|&quot;.$controller::className().&quot;|&quot;.$this-&gt;custom_info.&quot;\\n&quot;, FILE_APPEND);     } } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u043b\u044e\u0431\u043e\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430\u0448\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 behaivors:<\/p>\n<pre><code class=\"php\">    public function behaviors()     {         return [             'notification' =&gt; [                 'class' =&gt; 'app\\components\\Log',                 'custom_info' =&gt; 'Test'             ],         ];     } <\/code><\/pre>\n<p>  \u0413\u043e\u0442\u043e\u0432\u043e! \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043b\u043e\u0433\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u044d\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0441\u0430\u0439\u0442\u0430\u0445. \u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442, \u0431\u043e\u043b\u0435\u0435 \u0431\u043e\u0435\u0432\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"http:\/\/habrahabr.ru\/post\/208328\/\">\u0432 \u0442\u043e\u0439 \u0436\u0435 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>, \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0439 \u0432\u0430\u043c. \u041f\u0440\u0430\u0432\u0434\u0430, \u0442\u0430\u043c \u00ab\u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u00bb, \u0441\u0435\u0439\u0447\u0430\u0441 \u0432 YII \u0435\u0441\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 <a href=\"http:\/\/www.yiiframework.com\/doc-2.0\/yii-behaviors-attributebehavior.html\">yii\\behaviors\\SluggableBehavior<\/a>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0435 <a href=\"http:\/\/www.yiiframework.com\/doc-2.0\/yii-behaviors-attributebehavior.html\">yii\\behaviors\\AttributeBehavior<\/a> (\u043d\u0435 \u0437\u043d\u0430\u044e \u0442\u043e\u043b\u044c\u043a\u043e, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u0438 \u043a\u0438\u0440\u0438\u043b\u0438\u0446\u0430, \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b).<\/p>\n<p>  \u0418 \u0435\u0449\u0435 \u043f\u0440\u043e \u0418\u0432\u0435\u043d\u0442\u044b. \u041d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0438\u0432\u0435\u043d\u0442 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a:<\/p>\n<pre><code class=\"php\">$model = new OOO; \/\/OOO \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0410\u043a\u0442\u0438\u0432\u0420\u0435\u043a\u043e\u0440\u0434 \/\/\u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 $model-&gt;on($model::EVENT_BEFORE_INSERT, function($event) { \/* \u0414\u0435\u043b\u0430\u0435\u043c \u0447\u0442\u043e-\u0442\u043e \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 *\/ }); $model-&gt;load(['OOO' =&gt; ['name' =&gt; 'Test Name']]); \/\/\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0432 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043f\u0435\u0440\u0435\u0434 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u0430\u0437\u0443 $model-&gt;save(); <\/code><\/pre>\n<p>  <a name=\"step9\"><\/a><\/p>\n<h2>\u0428\u0430\u0433 8. \u041c\u043e\u0434\u0443\u043b\u0438.<\/h2>\n<p>  \u041a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u0432 \u0445\u043e\u0440\u043e\u0448\u0435\u043c \u041e\u041e\u041f \u043a\u043e\u0434\u0435 \u043d\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u044b\u043b\u043e \u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u0432\u0432\u043e\u0434\u043e\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438. \u041a\u0440\u043e\u043c\u0435 \u043e\u0434\u043d\u043e\u0439 \u2014 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438. \u041c\u043e\u0434\u0443\u043b\u044c \u2014 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041c\u043e\u0434\u0443\u043b\u044c \u2014 \u044d\u0442\u043e \u043f\u0430\u0447\u043a\u0430. \u041f\u0430\u0447\u043a\u0430 MVC, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0441\u0432\u043e\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b, \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0432\u044c\u044e\u0445\u0438, \u043e\u0442\u0433\u043e\u0440\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432, \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438 \u0432\u044c\u044e\u0445. \u041a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043a\u043e\u0433\u0434\u0430-\u0442\u043e \u0437\u0430\u0445\u043e\u0442\u0435\u043b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0440\u0430\u0437\u0434\u0435\u043b \u043d\u0430 \u0441\u0430\u0439\u0442, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043d\u0430 \u043f\u043e\u043c\u043e\u0439\u043a\u0443 \u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0438 \u043f\u043e\u043e\u0431\u0435\u0449\u0430\u043b, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0441\u0432\u043e\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0441 \u0431\u043b\u0435\u043a\u0434\u0436\u0435\u043a\u043e\u043c \u0438 \u0448\u043b\u044e\u0445\u0430\u043c\u0438. \u041d\u0443 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0432 YII.<\/p>\n<p>  \u041c\u043e\u0434\u0443\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"php\">'bootstrap' =&gt; ['ooo'], 'modules' =&gt; [     'ooo' =&gt; ['class' =&gt; 'application\/modules\/OOO'],     \/\/... ], <\/code><\/pre>\n<p>  \u0418\u043c\u0435\u043d\u043d\u043e \u00ab\u043c\u043e\u0434\u0443\u043b\u044c\u00bb \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430 gii, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0438 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043a \u0447\u0435\u043c\u0443, \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c vendor\/yiisoft\/yii2, \u0432\u0438\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441 \u043c\u043e\u0434\u0443\u043b\u044f Module.php, \u043f\u0430\u043f\u043a\u0443 controllers \u0438 views. \u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043f\u043e \u0442\u043e\u043c\u0443 \u0436\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u043c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c OOO \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u0441\u0430\u0439\u0442\u0435 \u0447\u0435\u0440\u0435\u0437 \u0432\u044b\u0437\u043e\u0432 \/?r=ooo<\/p>\n<p>  \u0427\u0438\u0442\u0430\u0435\u043c \u044d\u0442\u0443 <a href=\"http:\/\/habrahabr.ru\/post\/185236\/\">\u0441\u0442\u0430\u0442\u044c\u044e<\/a>. \u0422\u0430\u043c \u0432\u0441\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u044f\u0445. \u041e\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0435, \u044f \u0441\u0430\u043c \u0441\u0435\u0439\u0447\u0430\u0441 \u043a\u043e\u043f\u0430\u044e\u0441\u044c \u0442\u0430\u043c.<\/p>\n<p>  <a name=\"step10\"><\/a><\/p>\n<h2>\u0428\u0430\u0433 10. \u041f\u043e\u0441\u043b\u0435\u0441\u043b\u043e\u0432\u0438\u0435.<\/h2>\n<p>  \u0422\u0443\u0442 \u043b\u0438\u0448\u044c \u0445\u043e\u0447\u0443 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043e\u0448\u0443\u0449\u0435\u043d\u0438\u044f \u043e\u0442 YII2 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u0430. \u0414\u043e \u044d\u0442\u043e\u0433\u043e \u044f \u043f\u0438\u043b\u0438\u043b \u0441\u0430\u0439\u0442\u044b \u043d\u0430 CodeIgniter \u0438 \u0441\u0434\u0435\u043b\u0430\u043b \u0441\u0432\u043e\u0438 \u0442\u0443\u043b\u0437\u044b \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430, \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0444\u043e\u0440\u043c \u0438 \u0442.\u0434. \u0421\u0435\u0439\u0447\u0430\u0441 \u044f \u0432\u0438\u0436\u0443 \u0432\u0441\u0435 \u044d\u0442\u043e \u0432 YII2, \u043d\u043e \u0442\u0443\u0442 \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u0440\u0443\u0442\u043e \u0438 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e. \u0412\u043e\u0442 \u0438 \u0432\u0441\u0435 \u043e\u0449\u0443\u0449\u0435\u043d\u0438\u044f. \u0411\u0443\u0434\u0443 \u0434\u0430\u043b\u044c\u0448\u0435 \u0438\u0437\u0443\u0447\u0430\u0442\u044c YII, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0435\u0449\u0435 \u043a\u0443\u0447\u0430 \u0432\u0441\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e.      \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/229457\/\"> http:\/\/habrahabr.ru\/post\/229457\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">     \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/725\/4e2\/0af\/7254e20afe3ec7fab7be38b495916b05.png\" alt=\"image\" align=\"left\"\/>\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0430\u0439\u0442\u044b \u043d\u0430 YII2, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0412\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440, PHP 5.4, Git, Composer, \u0437\u043d\u0430\u043d\u0438\u0435 \u00ab\u041e\u041e\u041f \u0432 PHP\u00bb \u0438 \u0410\u0439\u041a\u044c\u044e &gt; 103. \u041d\u0430\u0434\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0438 \u0441\u043b\u043e\u0436\u043d\u043e, \u043d\u043e \u0438 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0440\u0442\u0430\u043d\u0443\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 YII2 \u0441\u0430\u043c\u043e\u043c\u0443 \u0434\u043d\u0443 \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438: \u00ab\u0448\u043a\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u00bb \u0438 \u0441\u0442\u0430\u0440\u043f\u0435\u0440\u0430\u043c \u2014 \u0430\u0434\u0435\u043f\u0442\u0430\u043c CodeIgniter. \u0414\u0440\u0443\u0433\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u043b\u0438\u0431\u043e \u0435\u0449\u0435 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u044b (\u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 YII2 \u0435\u0449\u0435 \u043d\u0435\u0442), \u043b\u0438\u0431\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043b \u0442\u044b\u0441\u044f\u0447\u0443 YII1 \u0438 \u0441\u043e\u0442\u043d\u044e YII2 \u0441\u0430\u0439\u0442\u043e\u0432. \u042f \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0438 \u0441\u0442\u0430\u0442\u044c\u044e \u044f \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435 \u0442\u0430\u043a\u0443\u044e, \u0430 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u0443\u044e, \u0432\u0435\u0434\u044c \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u043c\u043e\u0439 \u043a\u043e\u043d\u0441\u043f\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0432\u0435\u043b \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f YII2. <\/p>\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-229457","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/229457","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=229457"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/229457\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=229457"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=229457"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=229457"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}