{"id":209526,"date":"2014-01-18T15:00:02","date_gmt":"2014-01-18T11:00:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=209526"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=209526","title":{"rendered":"<span class=\"post_title\">\u0412\u0441\u044f \u043f\u0440\u0430\u0432\u0434\u0430 \u043e \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u0430\u0445 \u0432 yii1<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442, \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043b\u0435\u0436\u0438\u0442 \u0443 \u043c\u0435\u043d\u044f \u0432 \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a\u0430\u0445 \u0443\u0436\u0435 \u0433\u043e\u0434. \u042f \u0432\u0441\u0435 \u043e\u0442\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u043b \u0435\u0451 \u043d\u0430 \u043f\u043e\u0442\u043e\u043c, \u043a\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043d\u043e, \u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0441\u043a\u043e\u0440\u044b\u043c \u0432\u044b\u0445\u043e\u0434\u043e\u043c yii2, \u044f \u0440\u0435\u0448\u0438\u043b \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0435\u0451 \u0438 \u0432\u044b\u043b\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u043e\u0431\u043e\u0437\u0440\u0435\u043d\u0438\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>  \u0412\u043e\u0442 \u0443\u0436\u0435 \u043a\u0430\u043a 3 \u0433\u043e\u0434\u0430 \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u043d\u0430\u0434 \u043e\u0434\u043d\u0438\u043c \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0443\u043f\u043d\u044b\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u0432 megaflowers. \u0418, \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043a\u043e\u0433\u0434\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0441\u0442\u0430\u043b\u043e \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e, \u0430 \u0438\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u043b\u0438 \u0432\u0438\u0434\u0430 <code>ContentDiscount<\/code>, <code>ItemDiscount<\/code>, \u044f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u0441 \u044d\u0442\u0438\u043c \u0447\u0442\u043e-\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0438 \u0440\u0435\u0448\u0438\u043b \u0432\u0432\u0435\u0441\u0442\u0438 \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u044b \u0432 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442. \u041d\u0443, \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, <s>\u0433\u0443\u043b\u044f\u0442\u044c \u0442\u0430\u043a \u0433\u0443\u043b\u044f\u0442\u044c<\/s> \u0435\u0441\u043b\u0438 \u0432\u0432\u043e\u0434\u0438\u0442\u044c, \u0442\u043e \u0432\u0435\u0437\u0434\u0435 \u0441\u0440\u0430\u0437\u0443, \u0430 \u043d\u0435 \u0442\u0430\u043c \u0447\u0443\u0442\u044c-\u0447\u0443\u0442\u044c \u0438 \u0442\u0430\u043c, \u0430 \u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u043d\u0435\u0442.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0418\u0442\u0430\u043a, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u00ab\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c\u00bb \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<h4>\u041e\u0441\u043d\u043e\u0432\u044b<\/h4>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u044f \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0437\u0434\u0435 \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u044b, \u0442\u043e \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u043a\u043e\u0440\u043d\u0435\u0432\u044b\u043c \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u043e\u043c <code>app<\/code> (\u043d\u0443 \u0443\u0436 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043b\u0438\u043d\u043d\u044b\u0439 <code>application<\/code>). \u041e\u0434\u043d\u0430\u043a\u043e yii \u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435(\u043c\u043e\u0436\u043d\u043e \u0438 \u0432 index.php), \u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043a\u043e\u043d\u0444\u0438\u0433 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u043b\u0441\u044f \u043f\u043e \u043f\u0443\u0442\u0438 \u043a \u043d\u0435\u043c\u0443, \u0438, \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435 \u0441\u043c\u043e\u0433 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>Yii::setPathOfAlias<\/code> (\u043c\u043e\u0436\u0435\u0442 \u0441\u0435\u0439\u0447\u0430\u0441 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0430\u0441\u044c?), \u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432\u0438\u0434\u043e\u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c index.php.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u043e\u0442 \u0442\u0430\u043a \u0441\u0442\u0430\u043b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043c\u043e\u0439 index.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">$yii=dirname(__FILE__).'\/yii\/framework\/yii.php'; $config=dirname(__FILE__).'\/protected\/config\/main.php'; \/\/ remove the following lines when in production mode defined('YII_DEBUG') or define('YII_DEBUG',true); \/\/ specify how many levels of call stack should be shown in each log message defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3); \/\/ \u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c Yii, \u0447\u0442\u043e\u0431 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0430\u0432\u0442\u043e\u043b\u043e\u0430\u0434\u0435\u0440\u043e\u043c require_once($yii); \/\/ \u0417\u0430\u0442\u0435\u043c, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433, \u0438\u043d\u0430\u0447\u0435 \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0430\u043b\u044c\u044f\u0441 $config=require($config); Yii::createWebApplication($config)-&gt;run(); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u043e\u043d\u0444\u0438\u0433<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">\/\/ \u0418\u0437-\u0437\u0430 \u0433\u043b\u044e\u043a\u0430 \u0432 yii, \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Yii::getPathOfAlias Yii::setPathOfAlias('app', dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR); \/\/ \u0430 \u0442\u0430\u043a \u0436\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0443\u0442\u0443 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 define(NS_SEPARATOR,NAMESPACE_SEPARATOR); \/\/ \u0441\u0430\u043c \u043a\u043e\u043d\u0444\u0438\u0433 return array( \/\/ .... ); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b<\/h4>\n<p>  \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b \u0442\u0443\u0442 \u0432\u0441\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u2014 \u0443\u043a\u0430\u0437\u0430\u043b controllerNamespace \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u0448 \u0430\u043b\u044c\u044f\u0441 <code>app<\/code>, \u0438 \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e. \u0410 \u0432\u043e\u0442 \u0438 \u043d\u0435\u0442! \u0414\u043e \u043f\u043e\u0440\u044b, \u0434\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0432\u0430\u043b\u0438\u0442\u0441\u044f \u0432\u0441\u0435 \u044d\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043b\u0435\u0436\u0438\u0442 \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0430\u043f\u043a\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, test \u0438 \u0432 \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u0435 <code>app\\test<\/code>. Yii \u0438\u0449\u0435\u0442 \u0435\u0433\u043e \u0432 \u043f\u0430\u043f\u043a\u0435 test, \u043d\u043e \u0432 \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u0435 <code>app<\/code>. \u0422\u0430\u043a \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430\u0434\u043e, \u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u0431\u0430\u0433-\u0440\u0435\u043f\u043e\u0440\u0442 \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0443\u043b-\u0440\u0435\u043a\u0432\u0435\u0441\u0442 \u043d\u0435 \u0431\u044b\u043b\u043e (\u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c), \u0442\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0451 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u0441\u044f \u043e\u0442 <code>CWepApplication<\/code> \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b \u043c\u0435\u0442\u043e\u0434 <code>createController<\/code>. \u0412\u044b\u0448\u043b\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043a\u0440\u0430\u0441\u0438\u0432\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0439\u043c\u0443 \u043a\u043e\u0434\u0430, \u043d\u043e, \u043c\u043d\u0435 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0442\u044c \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">WepApplication<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">\tclass WebApplication extends CWebApplication { \t\t\/\/ \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441 \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0447\u0442\u043e\u0431 \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \t\tpublic $controllerNamespace='app'; \t\tpublic function createController($route,$owner=null) \t\t{ \t\t\tif($owner===null) \t\t\t\t$owner=$this;  \t\t\tif(($route=trim($route,'\/'))==='') \t\t\t\t$route=$owner-&gt;defaultController; \t\t\t$caseSensitive=$this-&gt;getUrlManager()-&gt;caseSensitive;  \t\t\t$route.='\/'; \t\t\twhile(($pos=strpos($route,'\/'))!==false) \t\t\t{ \t\t\t\t$id=substr($route,0,$pos); \t\t\t\tif(!preg_match('\/^\\w+$\/',$id)) \t\t\t\t\treturn null; \t\t\t\tif(!$caseSensitive) \t\t\t\t\t$id=strtolower($id); \t\t\t\t$route=(string)substr($route,$pos+1); \t\t\t\tif(!isset($basePath))  \/\/ first segment \t\t\t\t{ \t\t\t\t\tif(isset($owner-&gt;controllerMap[$id])) \t\t\t\t\t{ \t\t\t\t\t\treturn array( \t\t\t\t\t\t\t\\Yii::createComponent($owner-&gt;controllerMap[$id],$id,$owner===$this?null:$owner), \t\t\t\t\t\t\t$this-&gt;parseActionParams($route), \t\t\t\t\t\t); \t\t\t\t\t} \t\t\t\t\t\/** @var $module \\base\\BaseModule *\/ \t\t\t\t\tif(($module=$owner-&gt;getModule($id))!==null){ \t\t\t\t\t\treturn $this-&gt;createController($route,$module); \t\t\t\t\t}  \t\t\t\t\t$basePath=$owner-&gt;getControllerPath(); \t\t\t\t\t$controllerID=''; \t\t\t\t} \t\t\t\telse \t\t\t\t\t$controllerID.='\/';  \t\t\t\t$className=ucfirst($id).'Controller'; \t\t\t\t$classFile=$basePath.DIRECTORY_SEPARATOR.$className.'.php';  \t\t\t\t\/\/ \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0434\u0435\u0441\u044c \u043b\u043e\u0433\u0438\u043a\u0430 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \t\t\t\tif($owner-&gt;controllerNamespace!==null) \t\t\t\t\t$className=$owner-&gt;controllerNamespace.NS_SEPARATOR.str_replace('\/',NS_SEPARATOR,$controllerID).$className;  \t\t\t\tif(is_file($classFile)) \t\t\t\t{ \t\t\t\t\tif(!class_exists($className,false)) \t\t\t\t\t\trequire($classFile); \t\t\t\t\tif(class_exists($className,false) && is_subclass_of($className,'CController')) \t\t\t\t\t{ \t\t\t\t\t\t$id[0]=strtolower($id[0]); \t\t\t\t\t\treturn array( \t\t\t\t\t\t\tnew $className($controllerID.$id,$owner===$this?null:$owner), \t\t\t\t\t\t\t$this-&gt;parseActionParams($route), \t\t\t\t\t\t); \t\t\t\t\t} \t\t\t\t\treturn null; \t\t\t\t}  \t\t\t\t$controllerID.=$id; \t\t\t\t$basePath.=DIRECTORY_SEPARATOR.$id; \t\t\t} \t\t} \t}  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0410 \u0432\u043e\u0442 \u0442\u0430\u043a \u0441\u0442\u0430\u043b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043d\u0430\u0448 index.php:<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">\/\/ change the following paths if necessary $yii=dirname(__FILE__).'\/yii\/framework\/yii.php'; $config=dirname(__FILE__).'\/protected\/config\/main.php'; \/\/ remove the following lines when in production mode defined('YII_DEBUG') or define('YII_DEBUG',true); \/\/ specify how many levels of call stack should be shown in each log message defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3); \/\/ \u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c Yii, \u0447\u0442\u043e\u0431 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0430\u0432\u0442\u043e\u043b\u043e\u0430\u0434\u0435\u0440\u043e\u043c require_once($yii); \/\/ \u0417\u0430\u0442\u0435\u043c, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433 $config=require($config); \/\/ \u0418, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 $app=new app\\components\\WebApplication($config); $app-&gt;run(); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>\u041c\u043e\u0434\u0443\u043b\u0438<\/h4>\n<p>  \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u0440\u044b \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435, \u043d\u043e \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0438\u0445 \u0432 \u043c\u043e\u0434\u0443\u043b\u0438? \u041c\u043e\u0434\u0443\u043b\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u043c \u0434\u043b\u044f <code>Yii::createComponent<\/code>, \u0442\u043e \u0435\u0441\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0443\u043a\u0430\u0437\u0430\u0432 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043a\u043e\u043d\u0444\u0438\u0433<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">array( \t'modules'=&gt;array( \t\t'front'=&gt;array( \t\t\t'class'=&gt;'front\\FrontModule' \t\t) \t) )  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0442\u0430\u043a \u043a\u0430\u043a yii \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043f\u0440\u043e \u0430\u043b\u044c\u044f\u0441 <code>front<\/code>. \u041c\u043e\u0436\u043d\u043e \u043f\u043e \u0442\u043e\u043c\u0443 \u0436\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443, \u0447\u0442\u043e \u0438 \u0434\u043b\u044f \u0430\u043b\u044c\u044f\u0441\u0430 <code>app<\/code>, \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435, \u043d\u043e \u043c\u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u0432 \u0432\u0438\u0434\u0443 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043f\u0438\u0441\u0430\u043d\u0438\u043d\u044b \u043a\u043e\u0434\u0430 (\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043c\u0435\u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u0435\u0439), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043b \u043f\u0440\u043e\u0449\u0435 \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043b \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u043e\u0442\u043e\u043c\u043a\u0430 <code>CWebApplication<\/code>.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">WebApplication<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">class WebApplication extends CWebApplication { \/\/ ....  \t\/** \t * \u041f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u0430\u0432\u0438\u0442 \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441 \u0434\u043b\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0441 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c(\u043a\u0440\u0430\u0442\u043a\u0438\u043c, \u0431\u0435\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430) \t * @param array $modules \t *\/ \tpublic function setModules($modules) \t{ \t\t$modulesConfig=array(); \t\tforeach($modules as $id=&gt;$module){ \t\t\tif(is_int($id)) \t\t\t{ \t\t\t\t$id=$module; \t\t\t\t$module=array(); \t\t\t} \t\t\tif(!isset($module['class'])) \t\t\t{ \t\t\t\t\/\/ \u0441\u0442\u0430\u0432\u0438\u043c \u0430\u043b\u044c\u044f\u0441 \t\t\t\t\\Yii::setPathOfAlias($id,$this-&gt;getModulePath().DIRECTORY_SEPARATOR.$id); \t\t\t\t$module['class']=NS_SEPARATOR.$id.NS_SEPARATOR.ucfirst($id).'Module'; \t\t\t} \t\t\t$modulesConfig[$id]=$module; \t\t} \t\tparent::setModules($modulesConfig); \t} }  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e, \u0434\u0430 \u0438 \u0431\u0430\u0433-\u0440\u0435\u043f\u043e\u0440\u0442 \u0431\u044b \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c (\u043f\u043e\u0447\u0435\u043c\u0443, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044f \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u043c\u043e\u0434\u0443\u043b\u044f, yii \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0435\u0433\u043e \u043d\u0430\u0439\u0442\u0438? \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0433\u043e \u0432\u0438\u0434\u0430 <code>app.modules.ModuleClass<\/code>). \u0421\u0435\u0439\u0447\u0430\u0441 \u0436\u0435 \u044f \u0434\u0443\u043c\u0430\u044e, \u0432\u0441\u0435 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0438 \u043f\u043e\u043c\u0435\u043d\u044c\u0448\u0435 \u0442\u0440\u043e\u0433\u0430\u0442\u044c <code>CWebApplication<\/code>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433 \u0432 \u043f\u0430\u043f\u043a\u0435 \u0441 \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0430\u043b\u044c\u044f\u0441\u0430 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0435\u0433\u043e \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c\u0443 \u043a\u043e\u043d\u0444\u0438\u0433\u0443.<\/p>\n<p>  \u0421 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u043d\u043e, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u043b\u043e \u0434\u043e\u0439\u0434\u0435\u0442 \u0434\u043e \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0442\u043e \u043c\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0435\u043c\u0441\u044f \u0441 \u0442\u043e\u0439 \u0436\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439. \u0414\u0430 \u0438, \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435, \u043d\u0443\u0436\u043d\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c <code>controllerNamespace<\/code>. \u0418\u0441\u043f\u0440\u0430\u0432\u0438\u043c \u044d\u0442\u043e, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">BaseModule<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">class BaseModule extends \\CWebModule { \t\/** \t * \u0424\u0438\u043a\u0441 \u0434\u043b\u044f \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u043e\u0432 + \u0438\u043c\u043f\u043e\u0440\u0442 \t *\/ \tprotected function init()    \t{ \t\tparent::init(); \t\t\/\/ \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u043c, \u0447\u0442\u043e\u0431 \u043d\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \t\t$namespace=implode(NS_SEPARATOR, array_slice(explode(NS_SEPARATOR,get_class($this)),0,-1)); \t\t$this-&gt;controllerNamespace=$namespace.NS_SEPARATOR.'controllers';    \t} \t \t\/** \t * \u041f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u0430\u0432\u0438\u0442 \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441 \u0434\u043b\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0441 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c(\u043a\u0440\u0430\u0442\u043a\u0438, \u0431\u0435\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430) \t * @param array $modules \t *\/ \tpublic function setModules($modules) \t{ \t\t$modulesConfig=array(); \t\tforeach($modules as $id=&gt;$module){ \t\t\tif(is_int($id)) \t\t\t{ \t\t\t\t$id=$module; \t\t\t\t$module=array(); \t\t\t} \t\t\tif(!isset($module['class'])) \t\t\t{ \t\t\t\t\\Yii::setPathOfAlias($id,$this-&gt;getModulePath().DIRECTORY_SEPARATOR.$id); \t\t\t\t$module['class']=NS_SEPARATOR.$id.NS_SEPARATOR.ucfirst($id).'Module'; \t\t\t} \t\t\t$modulesConfig[$id]=$module; \t\t} \t\tparent::setModules($modulesConfig); \t} }  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0427\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432 \u0442\u0440\u0435\u0439\u0442\u044b, \u043d\u043e, \u044f \u043e\u0441\u0442\u0430\u0432\u043b\u044e \u044d\u0442\u043e \u0432\u0430\u043c.<\/p>\n<h4>\u041a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/h4>\n<p>  \u0421 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0430 \u0443 \u043c\u0435\u043d\u044f \u043d\u0435 \u0432\u044b\u0448\u043b\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u00ab\u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u043d\u0443\u044e\u00bb \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0433\u043e \u043d\u0430 <code>commandNampespace<\/code> \u044f \u043d\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u043d\u0438 \u0432 `CConsoleApplication`, \u043d\u0438 \u0432 `CConsoleCommandRunner` (\u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043e \u0444\u0438\u0447\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c?). \u0421\u0442\u0430\u043b \u043a\u043e\u043f\u0430\u0442\u044c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 <code>commandMap<\/code>, \u043d\u043e \u0438 \u0442\u0443\u0442 \u043c\u0435\u043d\u044f \u0436\u0434\u0430\u043b\u043e \u0440\u0430\u0437\u043e\u0447\u0430\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043a\u043e\u043d\u0444\u0438\u0433 console.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">\/\/ \u043d\u0443\u0436\u0435\u043d \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0439 \u043f\u0443\u0442\u044c, \u0438\u043d\u0430\u0447\u0435 \u0430\u043b\u044c\u044f\u0441 \u0431\u0443\u0434\u0435\u0442 \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0442\u0443\u0434\u0430 Yii::setPathOfAlias('app',dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR); \/\/... \t'commandMap'=&gt;array( \t\t'import'=&gt;'\\app\\commands\\ImportCommand', \t),  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u043e\u0434 \u0432\u0430\u043b\u0438\u043b\u0441\u044f \u0440\u0443\u0433\u0430\u044f\u0441\u044c \u043d\u0430 \u043d\u0430 \u0442\u043e \u0447\u0442\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u043a\u043b\u0430\u0441\u0441 <code>ImportCom<\/code>.<\/p>\n<p>  \u041c\u0435\u0442\u043e\u0434\u043e\u043c \u043f\u0440\u043e\u0431 \u0438 \u043e\u0448\u0438\u0431\u043e\u043a \u0432\u0441\u0435 \u0436\u0435 \u0431\u044b\u043b\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">console.php<\/b><\/p>\n<div class=\"spoiler_text\">:  <\/p>\n<pre><code class=\"php\">\/\/ \u043d\u0443\u0436\u0435\u043d \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0439 \u043f\u0443\u0442\u044c, \u0438\u043d\u0430\u0447\u0435 \u0430\u043b\u044c\u044f\u0441 \u0431\u0443\u0434\u0435\u0442 \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0442\u0443\u0434\u0430 Yii::setPathOfAlias('app',dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR); \/\/... \t'commandMap'=&gt;array( \t\t\/\/ \u043d\u0430\u0448\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \t\t'import'=&gt;array( \t\t\t'class'=&gt;'\\app\\commands\\ImportCommand', \t\t) \t),  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0418\u0437 \u043c\u0438\u043d\u0443\u0441\u043e\u0432 \u044d\u0442\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u0433\u043e \u0438\u043c\u0435\u043d\u0438 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043a\u043e\u043c\u0430\u043d\u0434.<\/p>\n<p>  \u041d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u0439 \u0434\u0435\u043d\u044c \u044d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043d\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c.<\/p>\n<h4>\u041c\u043e\u0434\u0435\u043b\u0438<\/h4>\n<p>  \u0412\u043e\u0442 \u043c\u044b \u0438 \u0434\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0434\u043e \u043c\u043e\u0434\u0435\u043b\u0435\u0439. \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b \u0442\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c, \u0432\u0435\u0434\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0442\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u0430\u0445, \u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u044f \u0443\u0432\u0438\u0434\u0435\u043b \u043a\u0430\u043a \u0441\u0442\u0430\u043b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043c\u0435\u0442\u043e\u0434 relations, \u044f \u0440\u0435\u0448\u0438\u043b \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c. \u0421\u043f\u0435\u0440\u0432\u0430 \u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u043b \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0430: <code>const CLASS_NAME=__CLASS_NAME__;<\/code>. <\/p>\n<p>  \u041f\u043e\u0442\u043e\u043c \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043f\u0440\u043e\u0449\u0435, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c(\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u0432 yii2).<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c NamespaceRecord<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">class NamespaceRecord extends CActiveRecord { \tpublic static function className() \t{ \t\treturn get_called_class(); \t} } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u0445 \u043d\u0430\u0448\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u0442\u0430\u043b\u0438 \u043f\u0440\u043e\u0449\u0435 \u0438 \u00ab\u043a\u0440\u0430\u0441\u0438\u0432\u0435\u0435\u00bb.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0411\u044b\u043b\u043e:<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">\tpublic function relations(){ \t\treturn array( \t\t\t'country'=&gt;'app\\location\\Country', \t\t) \t}  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u0442\u0430\u043b\u043e:<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">\tpublic function relations(){ \t\treturn array( \t\t\t'country'=&gt;Country::className(), \t\t) \t}  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0411\u044b\u043b\u0438 \u0435\u0449\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0444\u043e\u0440\u043c\u0430\u043c\u0438, \u043d\u043e, \u0432 yii \u0443\u0436\u0435 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438 \u044d\u0442\u043e.<\/p>\n<h4>\u0412\u0438\u0434\u0436\u0435\u0442\u044b<\/h4>\n<p>  \u0414\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u044f \u043f\u0438\u0441\u0430\u043b \u0432 \u0441\u0432\u043e\u0438\u0445 \u0432\u044c\u044e\u0445\u0430\u0445 <code>$this-&gt;widget('\u041c\u043e\u0439 \u0434\u043b\u0438\u043d\u044b\u0439 \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441 \u0432\u0438\u0434\u0436\u0435\u0442\u0430\\\u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430')<\/code>, \u043e\u0434\u043d\u0430\u043a\u043e, \u0441 \u0432\u044b\u0445\u043e\u0434\u043e\u043c yii2, \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0441\u0432\u043e\u0438 \u0432\u0438\u0434\u0436\u0435\u0442\u044b \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0445\u043e\u0436\u0438\u043c\u0438 \u043d\u0430 yii2. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u0432\u0438\u0434\u0436\u0435\u0442 NSWidget<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">class NSWidget extends \\CWidget{ \t\/** \t * @param array $options \t * @return \\CWidget \t *\/ \tpublic static function begin($options=array()) \t{ \t\treturn \\Yii::app()-&gt;controller-&gt;beginWidget(get_called_class(),$options); \t}  \t\/** \t * @return \\CWidget \t *\/ \tpublic static function end() \t{ \t\treturn \\Yii::app()-&gt;controller-&gt;endWidget(); \t}  \t\/** \t * @param array $options \t * @return string widget content \t *\/ \tpublic static function runWidget($options=array()) \t{ \t\treturn \\Yii::app()-&gt;controller-&gt;widget(get_called_class(),$options,true); \t} }  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u0441\u0435, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u043e \u0432\u044c\u044e\u0445\u0430\u0445<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">echo MyWidgetNS\\MyWidget::begin($options); echo MyWidgetNS\\MyWidget::end(); \/\/... echo MyWidget2NS\\MyWidget2::runWidget($options);  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u0438\u0434\u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u0441\u0442\u0430\u0442\u044c\u0435 \u2014 \u043f\u0438\u0448\u0438\u0442\u0435, \u043f\u043e\u043f\u0440\u0430\u0432\u043b\u044e.    \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\/209526\/\"> http:\/\/habrahabr.ru\/post\/209526\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442, \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043b\u0435\u0436\u0438\u0442 \u0443 \u043c\u0435\u043d\u044f \u0432 \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a\u0430\u0445 \u0443\u0436\u0435 \u0433\u043e\u0434. \u042f \u0432\u0441\u0435 \u043e\u0442\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u043b \u0435\u0451 \u043d\u0430 \u043f\u043e\u0442\u043e\u043c, \u043a\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043d\u043e, \u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0441\u043a\u043e\u0440\u044b\u043c \u0432\u044b\u0445\u043e\u0434\u043e\u043c yii2, \u044f \u0440\u0435\u0448\u0438\u043b \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0435\u0451 \u0438 \u0432\u044b\u043b\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u043e\u0431\u043e\u0437\u0440\u0435\u043d\u0438\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>  \u0412\u043e\u0442 \u0443\u0436\u0435 \u043a\u0430\u043a 3 \u0433\u043e\u0434\u0430 \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u043d\u0430\u0434 \u043e\u0434\u043d\u0438\u043c \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0443\u043f\u043d\u044b\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u0432 megaflowers. \u0418, \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043a\u043e\u0433\u0434\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0441\u0442\u0430\u043b\u043e \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e, \u0430 \u0438\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u043b\u0438 \u0432\u0438\u0434\u0430 <code>ContentDiscount<\/code>, <code>ItemDiscount<\/code>, \u044f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u0441 \u044d\u0442\u0438\u043c \u0447\u0442\u043e-\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0438 \u0440\u0435\u0448\u0438\u043b \u0432\u0432\u0435\u0441\u0442\u0438 \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u044b \u0432 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442. \u041d\u0443, \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, <s>\u0433\u0443\u043b\u044f\u0442\u044c \u0442\u0430\u043a \u0433\u0443\u043b\u044f\u0442\u044c<\/s> \u0435\u0441\u043b\u0438 \u0432\u0432\u043e\u0434\u0438\u0442\u044c, \u0442\u043e \u0432\u0435\u0437\u0434\u0435 \u0441\u0440\u0430\u0437\u0443, \u0430 \u043d\u0435 \u0442\u0430\u043c \u0447\u0443\u0442\u044c-\u0447\u0443\u0442\u044c \u0438 \u0442\u0430\u043c, \u0430 \u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u043d\u0435\u0442.  <\/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-209526","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/209526","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=209526"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/209526\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=209526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=209526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=209526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}