{"id":159155,"date":"2012-11-18T16:46:03","date_gmt":"2012-11-18T12:46:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=159155"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=159155","title":{"rendered":"<span class=\"post_title\">\u041f\u0438\u0448\u0435\u043c CLI \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f Zend Framework 2<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t<img decoding=\"async\" src=\"http:\/\/framework.zend.com\/images\/manual\/zf2_logo.png\" alt=\"image\" align=\"left\"\/><br \/>  \u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e, \u0445\u0430\u0431\u0440\u0430\u0436\u0438\u0442\u0435\u043b\u0438!<\/p>\n<p>  \u042d\u0442\u043e \u043c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0445\u0430\u0431\u0440\u0435, \u043d\u043e \u043f\u043e\u043c\u043e\u0439\u043c\u0443 \u044f \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b.<\/p>\n<p>  \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043d\u0430\u0447\u0430\u043b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 Zend Framework 2, \u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c cli \u043c\u043e\u0434\u0443\u043b\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f Zend 2 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u043e\u0434\u0443\u043b\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b, \u043a\u0430\u043a \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u0432 packagist.org<\/p>\n<p>  <i>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438: \u041c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0430\u0434 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u044d\u0442\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f.<\/i><\/p>\n<h4><b>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0444\u0440\u044d\u0439\u043c\u0432\u043e\u0440\u043a\u0430<\/b><\/h4>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0444\u0440\u044d\u0439\u043c\u0432\u043e\u0440\u043a\u0430, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u0430\u0440\u043a\u0430\u0441\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c ZendSkeletonApplication<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u043c ZendSkeletonApplication, \u044d\u0442\u043e \u0441\u043a\u0435\u043b\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<br \/>  cd projects_dir\/<br \/>  git clone git:\/\/github.com\/zendframework\/ZendSkeletonApplication.git<br \/>  \/\/\u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u0443\u0435\u043c \u0432 SampleZendModule<br \/>  mv ZendSkeletonApplication SampleZendModule<br \/>  \/\/\u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u0430\u043c zendframework \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u043f\u043e\u0437\u0435\u0440<br \/>  php composer.phar self-update<br \/>  php composer.phar install<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u0442\u0430\u0440\u0442 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c<br \/>  <a href=\"http:\/\/framework.zend.com\/manual\/2.0\/en\/index.html\">framework.zend.com\/manual\/2.0\/en\/index.html<\/a> \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 User Guide<\/p>\n<h4><b>\u041e\u0431\u0449\u0435\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/b><\/h4>\n<p>  \u041a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441 Zend 2 \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u043f\u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 MVC \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0432\u0435\u0431 MVC, \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430, \u043b\u0438\u0448\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0435\u0439\u0441\u044f \u0432 \u0441\u0432\u044f\u0437\u0438 \u0441\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u043e\u0439 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<p>  \u0420\u043e\u0443\u0442\u0435\u0440 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u0430\u043a\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0435\u043c\u0443 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>  \u0427\u0442\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u043e, \u0434\u043b\u044f \u0432\u0435\u0431 \u0438 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435\u0436\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b, \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u043f\u043e\u0436\u0430\u043b\u0443\u0439 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 Zend\\Console\\Request \u0432\u043c\u0435\u0441\u0442\u043e Zend\\Http\\Request \u0438 Zend\\Console\\Response \u0432\u043c\u0435\u0441\u0442\u043e Zend\\Http\\Response, \u043e\u0431\u044a\u0435\u043a\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<p>  \u0422\u043e\u0447\u043a\u043e\u0439 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u043c\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430, \u0442\u0430 \u0436\u0435 \u0447\u0442\u043e \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0432\u0435\u0431 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u0442.\u0435. \u043e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \/project\/public\/index.php<\/p>\n<h4><b>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0430\u0440\u043a\u0430\u0441\u0430 \u043c\u043e\u0434\u0443\u043b\u044f<\/b><\/h4>\n<p>  \u0412\u0432\u0438\u0434\u0443 \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0432 Zend 2 \u0432\u0441\u0435 \u0435\u0449\u0451 \u043d\u0435\u0442\u0443 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u0445 \u0443\u0442\u0438\u043b\u0438\u0442 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430, \u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0440\u0443\u043a\u0430\u043c\u0438.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432 \u043e\u0442 \u043a\u043e\u0440\u043d\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430<br \/>  \/project\/<br \/>  &#8212;\/module\/ \u2014 \u043e\u0431\u0449\u0430\u044f \u043f\u0430\u043f\u043a\u0430 \u0441 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0442\u0430\u043c Application \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e<br \/>  &#8212;-\/knyzev\/ \u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u0440\u0443\u043f\u043f\u044b \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0438\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u043e \u0435\u0441\u043b\u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0448\u044c \u043d\u0430 packagist.org, \u0442\u043e \u043e\u043d \u0445\u043e\u0447\u0435\u0442 \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u0438\u0434\u0430 group\/package<br \/>  &#8212;&#8212;\/zend-db-migrations\/ \u2014 \u044d\u0442\u043e \u0441\u0430\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043c\u043e\u0434\u0443\u043b\u044f<br \/>  &#8212;&#8212;&#8212;\/config\/ \u2014 \u043f\u0430\u043f\u043a\u0430 \u0434\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432<br \/>  &#8212;&#8212;&#8212;\/src\/ \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0430\u043f\u043a\u0430 \u0441 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438<br \/>  &#8212;&#8212;&#8212;-\/ZendDbMigrations\/ \u2014 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0443 \u0438\u043c\u0435\u043d<br \/>  &#8212;&#8212;&#8212;&#8212;\/Controller\/ \u2014 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b<br \/>  &#8212;&#8212;&#8212;&#8212;\/Library\/ \u2014 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439<br \/>  &#8212;&#8212;&#8212;&#8212;Module.php \u2014 \u043a\u043b\u0430\u0441\u0441 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043e\u0431\u0449\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043c\u043e\u0434\u0443\u043b\u0435<br \/>  &#8212;&#8212;&#8212;&#8212;README.md \u2014 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f<br \/>  &#8212;&#8212;&#8212;&#8212;composer.json \u2014 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 packagist.org<\/p>\n<p>  \u0412 Zend 2 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b, \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438 \u0442.\u0434.<\/p>\n<h5><b>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f<\/b><\/h5>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u0430\u043f\u043a\u0438 config, \u0437\u0434\u0435\u0441\u044c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b module.config.php \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043a\u043e\u043d\u0444\u0438\u0433, \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430.<\/p>\n<pre><code class=\"php\">&lt;?php return array(     'migrations' =&gt; array(         'dir' =&gt; dirname(__FILE__) . '\/..\/..\/..\/..\/migrations',         'namespace' =&gt; 'ZendDbMigrations\\Migrations',         'show_log' =&gt; true     ),     'console' =&gt; array(         'router' =&gt; array(             'routes' =&gt; array(                 'db_migrations_version' =&gt; array(                     'type'    =&gt; 'simple',                     'options' =&gt; array(                         'route'    =&gt; 'db_migrations_version [--env=]',                         'defaults' =&gt; array(                             'controller' =&gt; 'ZendDbMigrations\\Controller\\Migrate',                             'action'     =&gt; 'version'                         )                     )                 ),                 'db_migrations_migrate' =&gt; array(                     'type'    =&gt; 'simple',                     'options' =&gt; array(                         'route'    =&gt; 'db_migrations_migrate [&lt;version&gt;] [--env=]',                         'defaults' =&gt; array(                             'controller' =&gt; 'ZendDbMigrations\\Controller\\Migrate',                             'action'     =&gt; 'migrate'                         )                     )                 ),                 'db_migrations_generate' =&gt; array(                     'type'    =&gt; 'simple',                     'options' =&gt; array(                         'route'    =&gt; 'db_migrations_generate [--env=]',                         'defaults' =&gt; array(                             'controller' =&gt; 'ZendDbMigrations\\Controller\\Migrate',                             'action'     =&gt; 'generateMigrationClass'                         )                     )                 )             )         )     ),     'controllers' =&gt; array(         'invokables' =&gt; array(             'ZendDbMigrations\\Controller\\Migrate' =&gt; 'ZendDbMigrations\\Controller\\MigrateController'         ),     ),     'view_manager' =&gt; array(         'template_path_stack' =&gt; array(             __DIR__ . '\/..\/view',         ),     ), ); <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0435 controllers \u0438 view_manager \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0433\u0434\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0438 \u043a\u0430\u043a\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u044f \u043f\u043e\u043d\u044f\u043b \u044d\u0442\u043e \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0435, \u0432\u0438\u0434\u0438\u043c\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0441\u044f \u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u044d\u0442\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439.<\/p>\n<p>  Migrations \u2014 \u044d\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u043e\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0437\u0430\u0434\u0430\u044e\u0449\u0438\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439, \u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043a\u043e\u0440\u043d\u0435\u0432\u0430\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430, namespace \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0432 \u043a\u043b\u0430\u0441\u0441\u0430\u0445 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u0438 show_log \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0439 \u0432\u044b\u0432\u043e\u0434 \u043b\u043e\u0433\u043e\u0432 \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c.<\/p>\n<p>  Console \u2014 \u044d\u0442\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430, \u0432 Zend 2 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0432 \u0432\u0435\u0431 \u0447\u0430\u0441\u0442\u0438<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0443\u0442<br \/>  <a href=\"http:\/\/framework.zend.com\/manual\/2.0\/en\/modules\/zend.console.routes.html\">framework.zend.com\/manual\/2.0\/en\/modules\/zend.console.routes.html<\/a><\/p>\n<p>  \u041f\u0440\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 http \u0440\u043e\u0443\u0442\u0438\u043d\u0433 \u0437\u0434\u0435\u0441\u044c<br \/>  <a href=\"http:\/\/framework.zend.com\/manual\/2.0\/en\/modules\/zend.mvc.routing.html\">framework.zend.com\/manual\/2.0\/en\/modules\/zend.mvc.routing.html<\/a><\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0440\u043e\u0443\u0442\u044b. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0442\u0440\u0438 \u0440\u043e\u0443\u0442\u0430<br \/>  1. db_migrations_version \u2014 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0438\u043d\u0444\u0443 \u043e \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<br \/>  2. db_migrations_migrate [] [&#8212;env=] \u2014 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043b\u0438\u0431\u043e \u043e\u0442\u043a\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<br \/>  3. db_migrations_generate \u2014 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0443 \u0434\u043b\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0440\u043e\u0443\u0442\u0430:  <\/p>\n<pre><code class=\"php\">'db_migrations_migrate' =&gt; array(                     'type'    =&gt; 'simple',                     'options' =&gt; array(                         'route'    =&gt; 'db_migrations_migrate [&lt;version&gt;] [--env=]',                         'defaults' =&gt; array(                             'controller' =&gt; 'ZendDbMigrations\\Controller\\Migrate',                             'action'     =&gt; 'migrate'                         )                     )                 ), <\/code><\/pre>\n<p>  type \u2014 \u0442\u0438\u043f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430,<br \/>  options\/route \u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0438 \u043e\u043f\u0446\u0438\u044f\u043c\u0438, \u0435\u0441\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u043d \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0432 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0432\u044b\u0448\u0435.<br \/>  options\/defaults\/controller \u2014 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442<br \/>  options\/defaults\/action \u2014 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435<\/p>\n<h5><b>\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440<\/b><\/h5>\n<p>  <\/p>\n<pre><code class=\"php\"> &lt;?php \/**  * Zend Framework (http:\/\/framework.zend.com\/)  *  * @link      http:\/\/github.com\/zendframework\/ZendSkeletonApplication for the canonical source repository  * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http:\/\/www.zend.com)  * @license   http:\/\/framework.zend.com\/license\/new-bsd New BSD License  *\/  namespace ZendDbMigrations\\Controller;  use Zend\\Mvc\\Controller\\AbstractActionController; use Zend\\View\\Model\\ViewModel; use Zend\\Console\\Request as ConsoleRequest; use ZendDbMigrations\\Library\\Migration; use ZendDbMigrations\\Library\\MigrationException; use ZendDbMigrations\\Library\\GeneratorMigrationClass; use ZendDbMigrations\\Library\\OutputWriter;  \/**  * \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u044b\u0437\u043e\u0432 \u043a\u043e\u043c\u0430\u043d\u0434 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439  *\/ class MigrateController extends AbstractActionController {     \/**      * \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439      * @return \\Migrations\\Library\\Migration      *\/     protected function getMigration(){         $adapter = $this-&gt;getServiceLocator()-&gt;get('Zend\\Db\\Adapter\\Adapter');         $config = $this-&gt;getServiceLocator()-&gt;get('Configuration');                  $console = $this-&gt;getServiceLocator()-&gt;get('console');                  $output = null;                  if($config['migrations']['show_log'])         {             $output = new OutputWriter(function($message) use($console) {                         $console-&gt;write($message . &quot;\\n&quot;);                 });         }                  return new Migration($adapter, $config['migrations']['dir'], $config['migrations']['namespace'], $output);     }          \/**      * \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438      * @return integer      *\/     public function versionAction(){         $migration = $this-&gt;getMigration();                  return sprintf(&quot;Current version %s\\n&quot;, $migration-&gt;getCurrentVersion());     }          \/**      * \u041c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c      *\/     public function migrateAction(){         $migration = $this-&gt;getMigration();                  $version = $this-&gt;getRequest()-&gt;getParam('version');                  if(is_null($version) && $migration-&gt;getCurrentVersion() &gt;= $migration-&gt;getMaxMigrationNumber($migration-&gt;getMigrationClasses()))             return &quot;No migrations to execute.\\n&quot;;                  try{             $migration-&gt;migrate($version);             return &quot;Migrations executed!\\n&quot;;         }         catch (MigrationException $e) {             return &quot;ZendDbMigrations\\Library\\MigrationException\\n&quot; . $e-&gt;getMessage() . &quot;\\n&quot;;         }     }          \/**      * \u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u0440\u043a\u0430\u0441\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438      *\/     public function generateMigrationClassAction(){         $adapter = $this-&gt;getServiceLocator()-&gt;get('Zend\\Db\\Adapter\\Adapter');         $config = $this-&gt;getServiceLocator()-&gt;get('Configuration');                  $generator = new GeneratorMigrationClass($config['migrations']['dir'], $config['migrations']['namespace']);         $className = $generator-&gt;generate();                  return sprintf(&quot;Generated class %s\\n&quot;, $className);     } }  <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0438\u043f\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 (Action), \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430 \u0438\u043c\u0435\u0435\u0442 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u0438\u0434\u0430 [name]Action, Action \u2014 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c, \u0430 name \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b.<\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043a\u043b\u0430\u0441\u0441\u044b Zend\/Console\/Request, \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u044b\u0439 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430<br \/>  $this-&gt;getRequest()-&gt;getParam(&#8216;version&#8217;) \u2014 \u0442\u0430\u043a \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 version \u0438\u0437 \u0440\u043e\u0443\u0442\u0430 db_migrations_migrate []<\/p>\n<p>  \u0412\u0441\u0435 \u0447\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435 plain text \u043a\u0430\u043a \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u043e \u0432 ViewModel \u0438 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043e \u043f\u0440\u044f\u043c\u043e \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c.<\/p>\n<p>  \u0414\u043b\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043f\u043e \u043c\u0435\u0440\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Zend\/Console\/Response \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0432\u0438\u0441 \u043b\u043e\u043a\u0430\u0442\u043e\u0440 $this-&gt;getServiceLocator()-&gt;get(&#8216;console&#8217;), \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u044b write, writeAt, writeLine. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<h5><b>Module.php<\/b><\/h5>\n<p>   <\/p>\n<pre><code class=\"php\"> &lt;?php  namespace ZendDbMigrations;  use Zend\\Mvc\\ModuleRouteListener; use Zend\\ModuleManager\\Feature\\AutoloaderProviderInterface; use Zend\\ModuleManager\\Feature\\ConfigProviderInterface; use Zend\\ModuleManager\\Feature\\ConsoleUsageProviderInterface; use Zend\\Console\\Adapter\\AdapterInterface as Console; use Zend\\ModuleManager\\Feature\\ConsoleBannerProviderInterface;  class Module implements     AutoloaderProviderInterface,     ConfigProviderInterface,     ConsoleUsageProviderInterface,     ConsoleBannerProviderInterface {          public function onBootstrap($e)     {         $e-&gt;getApplication()-&gt;getServiceManager()-&gt;get('translator');         $eventManager        = $e-&gt;getApplication()-&gt;getEventManager();         $moduleRouteListener = new ModuleRouteListener();         $moduleRouteListener-&gt;attach($eventManager);     }      public function getConfig()     {         return include __DIR__ . '\/config\/module.config.php';     }      public function getAutoloaderConfig()     {         return array(             'Zend\\Loader\\StandardAutoloader' =&gt; array(                 'namespaces' =&gt; array(                     __NAMESPACE__ =&gt; __DIR__ . '\/src\/' . __NAMESPACE__,                 ),             ),         );     }          public function getConsoleBanner(Console $console){         return 'DB Migrations Module';     }      public function getConsoleUsage(Console $console){         \/\/description command         return array(             'db_migrations_version' =&gt; 'Get current migration version',             'db_migrations_migrate [&lt;version&gt;]' =&gt; 'Execute migrate',             'db_migrations_generate' =&gt; 'Generate new migration class'         );     } } <\/code><\/pre>\n<p>  \u0424\u0430\u0439\u043b Module.php \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043c\u043e\u0434\u0443\u043b\u0435, \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b Module.php \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0441 \u0446\u0435\u043b\u044c\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043b\u0430\u0441\u0441 Module \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p>  \u0421\u0442\u043e\u0438\u0442 \u043e\u0441\u043e\u0431\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043e\u043d \u0432\u044b\u0432\u043e\u0434\u0438\u043b \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434, \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 ConsoleUsageProviderInterface \u0438 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0432\u043e\u0434 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043a\u0430\u043a \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435.<\/p>\n<p>  \u0422\u0430\u043a \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<br \/>  php public\/index.php<br \/>  \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u044b \u0432\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 getConsoleUsage \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f.<\/p>\n<h5><b>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 PHPUnit<\/b><\/h5>\n<p>  \u0422\u0435\u0441\u0442\u044b \u0432 MVC Zend 2 \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u0430\u043f\u043a\u0435 tests \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u043c\u043e\u0434\u0443\u043b\u044f.<\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440<br \/>  \/project\/<br \/>  -\/module\/<br \/>  &#8212;\/knyzev\/<br \/>  &#8212;\/zend-db-migrations\/<br \/>  &#8212;-\/src\/<br \/>  &#8212;&#8212;\/ZendDbMigrations\/<br \/>  &#8212;&#8212;\/Controller\/<br \/>  &#8212;&#8212;-\/MigrateController.php<br \/>  -\/tests\/<br \/>  &#8212;\/knyzev\/<br \/>  &#8212;\/zend-db-migrations\/<br \/>  &#8212;-\/src\/<br \/>  &#8212;&#8212;\/ZendDbMigrations\/<br \/>  &#8212;&#8212;\/Controller\/<br \/>  &#8212;&#8212;-\/MigrateControllerTest.php<\/p>\n<p>  \u0418 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0435\u0441\u0442\u043e\u0432 \u043d\u0430 \u043a\u043b\u0430\u0441\u0441 MigrateController<\/p>\n<pre><code class=\"php\"> &lt;?php  namespace Tests\\ZendDbMigrations\\Controller;  use ZendDbMigrations\\Controller\\MigrateController; use Zend\\Console\\Request as ConsoleRequest; use Zend\\Console\\Response; use Zend\\Mvc\\MvcEvent; use Zend\\Mvc\\Router\\RouteMatch; use PHPUnit_Framework_TestCase; use \\Bootstrap; use Zend\\Db\\Adapter\\Adapter; use Zend\\Db\\Metadata\\Metadata;  \/**  * \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 MigrateController  *\/ class MigrateControllerTest extends PHPUnit_Framework_TestCase {      protected $controller;     protected $request;     protected $response;     protected $routeMatch;     protected $event;     protected $eventManager;     protected $serviceManager;     protected $dbAdapter;     protected $connection;     protected $metadata;       protected $folderMigrationFixtures;      \/**      * \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438      *\/     protected function setUp() {         $bootstrap = \\Zend\\Mvc\\Application::init(Bootstrap::getAplicationConfiguration());         $this-&gt;request = new ConsoleRequest();         $this-&gt;routeMatch = new RouteMatch(array('controller' =&gt; 'migrate'));         $this-&gt;event = $bootstrap-&gt;getMvcEvent();         $this-&gt;event-&gt;setRouteMatch($this-&gt;routeMatch);         $this-&gt;eventManager = $bootstrap-&gt;getEventManager();         $this-&gt;serviceManager = $bootstrap-&gt;getServiceManager();                  $this-&gt;dbAdapter = $bootstrap-&gt;getServiceManager()-&gt;get('Zend\\Db\\Adapter\\Adapter');                           $this-&gt;connection = $this-&gt;dbAdapter-&gt;getDriver()-&gt;getConnection();         $this-&gt;metadata = new Metadata($this-&gt;dbAdapter);          $this-&gt;folderMigrationFixtures = dirname(__FILE__) . '\/..\/MigrationsFixtures';                  $this-&gt;initController();         $this-&gt;tearDown();     }          protected function tearDown(){         $this-&gt;dbAdapter-&gt;query('DROP TABLE IF EXISTS migration_version CASCADE;', Adapter::QUERY_MODE_EXECUTE);         $this-&gt;dbAdapter-&gt;query('DROP TABLE IF EXISTS test_migrations CASCADE;', Adapter::QUERY_MODE_EXECUTE);         $this-&gt;dbAdapter-&gt;query('DROP TABLE IF EXISTS test_migrations2 CASCADE;', Adapter::QUERY_MODE_EXECUTE);                  $iterator = new \\GlobIterator($this-&gt;folderMigrationFixtures . '\/tmp\/*', \\FilesystemIterator::KEY_AS_FILENAME);                  foreach ($iterator as $item) {             if($item-&gt;isFile())             {                 unlink($item-&gt;getPath() . '\/' . $item-&gt;getFilename());             }         }                  chmod($this-&gt;folderMigrationFixtures . '\/tmp', 0775);     }          protected function initController(){         $this-&gt;controller = new MigrateController();         $this-&gt;controller-&gt;setEvent($this-&gt;event);         $this-&gt;controller-&gt;setEventManager($this-&gt;eventManager);         $this-&gt;controller-&gt;setServiceLocator($this-&gt;serviceManager);     }      \/**      * \u0422\u0435\u0441\u0442 \u043c\u0435\u0442\u043e\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0435\u0433\u043e \u043d\u043e\u043c\u0435\u0440 \u0432\u0435\u0440\u0441\u0438\u0438      *\/     public function testVersion() {         $this-&gt;routeMatch-&gt;setParam('action', 'version');          $result = $this-&gt;controller-&gt;dispatch($this-&gt;request);         $response = $this-&gt;controller-&gt;getResponse();                  $this-&gt;assertEquals(200, $response-&gt;getStatusCode(), 'Status code is 200 OK!');         $this-&gt;assertInstanceOf('Zend\\View\\Model\\ViewModel', $result, 'Method return object Zend\\View\\Model\\ViewModel!');         $this-&gt;assertEquals(&quot;Current version 0\\n&quot;, $result-&gt;getVariable('result'), 'Returt value is correctly!');                  \/\/\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0432\u0435\u0440\u0441\u0438\u0438         $this-&gt;connection-&gt;execute('INSERT INTO migration_version (version) VALUES (12345678910)');         \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c         $result = $this-&gt;controller-&gt;dispatch($this-&gt;request);         $response = $this-&gt;controller-&gt;getResponse();         $this-&gt;assertEquals(&quot;Current version 12345678910\\n&quot;, $result-&gt;getVariable('result'), 'Returt value is correctly!');     }      \/**      * \u0422\u0435\u0441\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u0435\u0441\u043b\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u043d\u0435\u0442\u0443      *\/     public function testMigrateIfNotMigrations() {         $this-&gt;routeMatch-&gt;setParam('action', 'migrate');                  $result = $this-&gt;controller-&gt;dispatch($this-&gt;request);         $response = $this-&gt;controller-&gt;getResponse();                  $this-&gt;assertEquals(200, $response-&gt;getStatusCode(), 'Status code is 200 OK!');         $this-&gt;assertInstanceOf('Zend\\View\\Model\\ViewModel', $result, 'Method return object Zend\\View\\Model\\ViewModel!');         $this-&gt;assertEquals(&quot;No migrations to execute.\\n&quot;, $result-&gt;getVariable('result'), 'Return correct info if no exists not executable migations!');     }          \/**      * \u0422\u0435\u0441\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f      *\/     public function testMigrationIfExistsMigrations(){         \/\/\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043d\u043e\u0432\u043e\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438         copy($this-&gt;folderMigrationFixtures . '\/MigrationsGroup1\/Version20121110210200.php',                  $this-&gt;folderMigrationFixtures . '\/tmp\/Version20121110210200.php');          $this-&gt;routeMatch-&gt;setParam('action', 'migrate');         $result = $this-&gt;controller-&gt;dispatch($this-&gt;request);         $response = $this-&gt;controller-&gt;getResponse();                  $this-&gt;assertEquals(200, $response-&gt;getStatusCode(), 'Status code is 200 OK!');         $this-&gt;assertEquals(&quot;Migrations executed!\\n&quot;, $result-&gt;getVariable('result'), 'Return correct info if executed migrations!');                  \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0447\u0442\u043e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430         $this-&gt;assertTrue(in_array('test_migrations', $this-&gt;metadata-&gt;getTableNames()), 'Migration real executed!');              \/\/\u0442\u0435\u0441\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0438 \u043e\u043d\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439         $this-&gt;initController();                  $this-&gt;routeMatch-&gt;setParam('action', 'migrate');         $this-&gt;routeMatch-&gt;setParam('version', 20121110210200);         $result = $this-&gt;controller-&gt;dispatch($this-&gt;request);         $response = $this-&gt;controller-&gt;getResponse();                  $this-&gt;assertEquals(200, $response-&gt;getStatusCode(), 'Status code is 200 OK!');         $this-&gt;assertContains(&quot;Migration version 20121110210200 is current version!\\n&quot;, $result-&gt;getVariable('result'), 'Starting the migration with a current version works correctly!');     }      \/**      * \u0422\u0435\u0441\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u0438      *\/     public function testMigrateWithVersion() {                  copy($this-&gt;folderMigrationFixtures . '\/MigrationsGroup2\/Version20121111150900.php',                  $this-&gt;folderMigrationFixtures . '\/tmp\/Version20121111150900.php');                  copy($this-&gt;folderMigrationFixtures . '\/MigrationsGroup2\/Version20121111153700.php',                  $this-&gt;folderMigrationFixtures . '\/tmp\/Version20121111153700.php');                  $this-&gt;routeMatch-&gt;setParam('action', 'migrate');         $this-&gt;routeMatch-&gt;setParam('version', 20121111150900);                  $result = $this-&gt;controller-&gt;dispatch($this-&gt;request);         $response = $this-&gt;controller-&gt;getResponse();                  $this-&gt;assertEquals(200, $response-&gt;getStatusCode(), 'Status code is 200 OK!');         $this-&gt;assertTrue(in_array('test_migrations', $this-&gt;metadata-&gt;getTableNames()), 'Migration 20121111150900 execucte ok!');         $this-&gt;assertFalse(in_array('test_migrations2', $this-&gt;metadata-&gt;getTableNames()), 'Migration 20121111153700 not execucte ok!');     }          \/**      * \u0422\u0435\u0441\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0438 \u0434\u043b\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439      *\/     public function testGenerateMigrationClass() {         $this-&gt;routeMatch-&gt;setParam('action', 'generateMigrationClass');          $result = $this-&gt;controller-&gt;dispatch($this-&gt;request);         $response = $this-&gt;controller-&gt;getResponse();                  $this-&gt;assertEquals(200, $response-&gt;getStatusCode(), 'Status code is 200 OK!');         $this-&gt;assertInstanceOf('Zend\\View\\Model\\ViewModel', $result, 'Method return object Zend\\View\\Model\\ViewModel!');         $this-&gt;assertContains(&quot;Generated class &quot;,                  $result-&gt;getVariable('result'), 'Return result info ok!');                  $fileName = sprintf('Version%s.php',  date('YmdHis', time()));         $this-&gt;assertFileExists($this-&gt;folderMigrationFixtures . '\/tmp\/' . $fileName, 'Generate command real generated class!');     } } <\/code><\/pre>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c<br \/>  <a href=\"http:\/\/framework.zend.com\/manual\/2.0\/en\/user-guide\/unit-testing.html\">framework.zend.com\/manual\/2.0\/en\/user-guide\/unit-testing.html<\/a><\/p>\n<p>  \u0422\u0443\u0442 \u0435\u0441\u0442\u044c \u043d\u044e\u0430\u043d\u0441, \u0432 \u0437\u0435\u043d\u0434 2 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u044b\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u043e\u0439.<\/p>\n<h4><b>Composer.json \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f \u043d\u0430 packagist.org<\/b><\/h4>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u0432 \u043a\u043e\u043c\u043f\u043e\u0437\u0435\u0440 json \u0438 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e.<br \/>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432 \u043a\u043e\u0440\u043d\u0435 \u043c\u043e\u0434\u0443\u043b\u044f \u0444\u0430\u0439\u043b composer.json \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439  <\/p>\n<pre><code class=\"javascript\">{     &quot;name&quot;: &quot;knyzev\/zend-db-migrations&quot;,     &quot;description&quot;: &quot;Module for managment database migrations.&quot;,     &quot;type&quot;: &quot;library&quot;,     &quot;license&quot;: &quot;BSD-3-Clause&quot;,     &quot;keywords&quot;: [         &quot;database&quot;,         &quot;db&quot;,         &quot;migrations&quot;,         &quot;zf2&quot;     ],     &quot;homepage&quot;: &quot;https:\/\/github.com\/vadim-knyzev\/ZendDbMigrations&quot;,     &quot;authors&quot;: [         {             &quot;name&quot;: &quot;Vadim Knyzev&quot;,             &quot;email&quot;: &quot;vadim.knyzev@gmail.com&quot;,             &quot;homepage&quot;: &quot;http:\/\/vadim-knyzev.blogspot.com\/&quot;         }     ],     &quot;require&quot;: {         &quot;php&quot;: &quot;&gt;=5.3.3&quot;,         &quot;zendframework\/zendframework&quot;: &quot;2.*&quot;     },     &quot;autoload&quot;: {         &quot;psr-0&quot;: {             &quot;ZendDbMigrations&quot;: &quot;src\/&quot;         },         &quot;classmap&quot;: [             &quot;.\/Module.php&quot;         ]     } } <\/code><\/pre>\n<p>  name \u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f, \u043e\u043d\u043e \u0436\u0435 \u0431\u0443\u0434\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u043f\u043a\u0438 \u043c\u043e\u0434\u0443\u043b\u044f.<br \/>  require \u2014 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438<br \/>  \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e \u043f\u043e\u0434\u043e\u0431\u0438\u044e.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u043d\u0430 <a href=\"https:\/\/github.com\">github.com<\/a>, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439, \u0432\u0432\u043e\u0434\u0438\u043c \u0438\u043c\u044f \u0432\u0438\u0434\u0430 MyZendModule<br \/>  \u041d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u043c \u0433\u0438\u0442 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439, \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431<br \/>  git init<br \/>  git remote add origin <a href=\"https:\/\/github.com\/knyzev\/zend-db-migrations\">github.com\/knyzev\/zend-db-migrations<\/a><br \/>  git add -A<br \/>  git commit -m \u00abInit commit\u00bb<br \/>  git push<\/p>\n<p>  \u041d\u0430 \u0441\u0430\u0439\u0442\u0435 <a href=\"http:\/\/packagist.org\/\">packagist.org\/<\/a> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c\u0441\u044f, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c submit package \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 github, \u043e\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c composer.json \u0438 \u0441\u043e\u043e\u0431\u0449\u0438\u0442 \u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0445 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0435\u0441\u0442\u044c.<\/p>\n<p>  \u0412\u0441\u0451, \u0442\u0435\u043f\u0435\u0440\u044c \u0432 \u043d\u043e\u0432\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438\u043b\u0438 \u043a\u0442\u043e-\u043b\u0438\u0431\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u043c\u043e\u0436\u0435\u0442 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 composer.json<br \/>  \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 knyzev\/zend-db-migrations<br \/>  \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b<br \/>  php composer.phar self-update<br \/>  php composer.phar update<br \/>  \u0418 \u043c\u043e\u0434\u0443\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d, \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0433\u043e \u0432 config\/application.config.php<\/p>\n<h4><b>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 Symfony 2 + Doctrine 2 \u0438 Zend 2<\/b><\/h4>\n<p>  \u041c\u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f Symfony 2 \u0438 Doctrine 2-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0438 \u043f\u043e\u0441\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u043c\u0438, \u043f\u043e\u043b\u043d\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 (\u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0430 \u0432\u0441\u0435 \u0441\u043b\u0443\u0447\u0430\u0438) \u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, ORM \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 Doctrine, zend \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u0440\u0430\u0447\u043d\u043e \u0438 \u043d\u0435 \u0443\u044e\u0442\u043d\u043e, \u043d\u0443 \u044d\u0442\u043e \u043b\u0438\u0447\u043d\u043e \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043c\u043d\u0435\u043d\u0438\u0435, \u0445\u043e\u0442\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 \u043f\u0430\u043c\u044f\u0442\u0438. \u0422\u0430\u043a\u043e\u0435 \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0438\u0437-\u0437\u0430 \u043d\u0435\u0434\u043e\u0434\u0435\u043b\u0430\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0441\u0442\u0430\u0440\u0442\u0430, \u0442.\u0435. \u0432\u0441\u0435 \u043d\u0443\u0436\u043d\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0434\u043e\u0434\u0435\u043b\u044b\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443.<br \/>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441 Symfony \u0441\u0442\u0430\u043b \u043f\u043e\u0434\u0443\u043c\u044b\u0432\u0430\u0442\u044c \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 Java Spring + Hibernate.<\/p>\n<p>  \u0421\u0430\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0434\u0435\u0441\u044c<br \/>  <a href=\"https:\/\/github.com\/vadim-knyzev\/ZendDbMigrations\">github.com\/vadim-knyzev\/ZendDbMigrations<\/a><br \/>  \u0422\u0435\u0441\u0442\u044b \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0432 \u043c\u043e\u0434\u0443\u043b\u044c, \u0442.\u043a. \u043f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u043c \u0442\u0438\u043f\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043c\u043e\u0434\u0443\u043b\u044f zend 2, \u0442\u0435\u0441\u0442\u044b \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0435.<\/p>\n<p>  PS: \u041a\u0442\u043e \u043d\u0438\u0431\u0443\u0434\u044c \u0437\u043d\u0430\u0435\u0442 \u043a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043c\u043e\u0434\u0443\u043b\u044f\u0445 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 \u0437\u0435\u043d\u0434\u0430 <a href=\"http:\/\/modules.zendframework.com\/\">modules.zendframework.com\/<\/a>? \t\t\t \t\t\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\/159155\/\"> http:\/\/habrahabr.ru\/post\/159155\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t<img decoding=\"async\" src=\"http:\/\/framework.zend.com\/images\/manual\/zf2_logo.png\" alt=\"image\" align=\"left\"\/><br \/>  \u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e, \u0445\u0430\u0431\u0440\u0430\u0436\u0438\u0442\u0435\u043b\u0438!<\/p>\n<p>  \u042d\u0442\u043e \u043c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0445\u0430\u0431\u0440\u0435, \u043d\u043e \u043f\u043e\u043c\u043e\u0439\u043c\u0443 \u044f \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b.<\/p>\n<p>  \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043d\u0430\u0447\u0430\u043b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 Zend Framework 2, \u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c cli \u043c\u043e\u0434\u0443\u043b\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f Zend 2 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u043e\u0434\u0443\u043b\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b, \u043a\u0430\u043a \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u0432 packagist.org<\/p>\n<p>  <i>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438: \u041c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0430\u0434 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u044d\u0442\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f.<\/i><\/p>\n<h4><b>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0444\u0440\u044d\u0439\u043c\u0432\u043e\u0440\u043a\u0430<\/b><\/h4>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0444\u0440\u044d\u0439\u043c\u0432\u043e\u0440\u043a\u0430, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u0430\u0440\u043a\u0430\u0441\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c ZendSkeletonApplication  <\/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-159155","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/159155","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=159155"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/159155\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=159155"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=159155"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=159155"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}