{"id":171915,"date":"2013-03-07T12:07:03","date_gmt":"2013-03-07T08:07:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=171915"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=171915","title":{"rendered":"<span class=\"post_title\">\u041f\u0435\u0440\u0432\u0430\u044f \u0431\u0435\u0442\u0430 Phalcon 1.0.0<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0433\u0440\u0430\u043f\u043f\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 Phalcon \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b\u043e \u043f\u0435\u0440\u0432\u0443\u044e \u0431\u0435\u0442\u0430-\u0432\u0435\u0440\u0441\u0438\u044e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 Phalcon 1.0.0. \u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0432 \u043a\u0443\u0440\u0441\u0435: Phalcon \u2014 \u044d\u0442\u043e PHP-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u0421\u0438 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043a\u0430\u043a \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043b\u044f PHP, \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e \u043d\u0435\u0433\u043e \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u043c\u043e\u0436\u043d\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 <a href=\"http:\/\/habrahabr.ru\/post\/159217\/\">Phalcon \u2014 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 PHP MVC Framework<\/a> \u0438 <a href=\"http:\/\/habrahabr.ru\/post\/160311\/\">Phalcon: \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/a>.<br \/>  \u0426\u0435\u043b\u044c \u0432\u044b\u043f\u0443\u0441\u043a\u0430 \u044d\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u2014 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u0438 \u043e\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0430 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/d12\/9a2\/d5c\/d129a2d5c108ff15eaf2d178fa3ee42a.jpg\"\/><\/p>\n<p>  \u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u0430\u043d\u043e\u043d\u0441 \u0432\u0430\u0436\u043d\u044b\u0445 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u044d\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438:  <\/p>\n<ol>\n<li><a href=\"#cache\">\u041c\u043d\u043e\u0433\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0435 \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/a><\/li>\n<li><a href=\"#volt\">\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0435 Volt<\/a><\/li>\n<li><a href=\"#sharding\">\u0413\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0448\u0430\u0440\u0434\u0438\u043d\u0433<\/a><\/li>\n<li><a href=\"#snapshots\">\u0417\u0430\u043f\u0438\u0441\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f (Record Snapshots)<\/a><\/li>\n<li><a href=\"#update\">\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435<\/a><\/li>\n<li><a href=\"#validation\">\u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f<\/a><\/li>\n<\/ol>\n<p>  <a name=\"habracut\"><\/a><br \/>  <a name=\"cache\"><\/a>  <\/p>\n<h4>1. \u041c\u043d\u043e\u0433\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0435 \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h4>\n<p>  \u041d\u043e\u0432\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u043a\u0435\u0448 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0440\u043e\u0432\u043d\u0435\u0439. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u043f\u0440\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u043a\u0435\u0448\u0430 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 (\u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f) \u0441 \u0440\u0430\u0437\u043d\u044b\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0436\u0438\u0437\u043d\u0438, \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043f\u043e\u043e\u0447\u0435\u0440\u0451\u0434\u043d\u044b\u043c \u0447\u0442\u0435\u043d\u0438\u0435\u043c \u0438\u0437 \u043d\u0438\u0445 \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e (\u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438) \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044f \u0441\u0430\u043c\u044b\u043c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c, \u043f\u043e\u043a\u0430 \u0441\u0440\u043e\u043a \u0436\u0438\u0437\u043d\u0438 \u0432\u043e \u0432\u0441\u0435\u0445 \u043d\u0438\u0445 \u043d\u0435 \u0438\u0441\u0442\u0435\u0447\u0435\u0442.  <\/p>\n<pre><code class=\"php\">&lt;?php  $ultraFastFrontend = new Phalcon\\Cache\\Frontend\\Data(array(     &quot;lifetime&quot; =&gt; 3600 ));  $fastFrontend = new Phalcon\\Cache\\Frontend\\Data(array(     &quot;lifetime&quot; =&gt; 86400 ));  $slowFrontend = new Phalcon\\Cache\\Frontend\\Data(array(     &quot;lifetime&quot; =&gt; 604800 ));  \/\/Backends are registered from the fastest to the slower $cache = new \\Phalcon\\Cache\\Multiple(array(   new Phalcon\\Cache\\Backend\\Apc($frontCache, array(         &quot;prefix&quot; =&gt; 'cache',     )),     new Phalcon\\Cache\\Backend\\Memcache($fastFrontCache, array(         &quot;prefix&quot; =&gt; 'cache',         &quot;host&quot; =&gt; &quot;localhost&quot;,         &quot;port&quot; =&gt; &quot;11211&quot;     )),     new Phalcon\\Cache\\Backend\\File($slowestFrontCache, array(         &quot;prefix&quot; =&gt; 'cache',         &quot;cacheDir&quot; =&gt; &quot;..\/app\/cache\/&quot;     )); ));  \/\/ \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u0432\u043e \u0432\u0441\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f $cache-&gt;save('my-key', $data);  \/\/ \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435, \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u0441\u043e \u0432\u0441\u0435\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0433\u0434\u0435 \u043a\u0435\u0448 \u0435\u0449\u0435 \u0436\u0438\u0432\u043e\u0439 $data = $cache-&gt;get('my-key'); <\/code><\/pre>\n<p>  <a name=\"volt\"><\/a>  <\/p>\n<h4>2. \u0423\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0435 Volt<\/h4>\n<p>  Volt (\u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0442\u0430\u043a \u0436\u0435 \u043d\u0430 \u0421\u0438) \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0432 \u044d\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u0432\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439:  <\/p>\n<pre><code class=\"php\">{# \u0422\u0435\u0440\u043d\u0430\u0440\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 #} {{ total &gt; 0 ? total|format('%0.2f') : '0.0' }}  {# \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 For-Else #} {% for robot in robots %}     {{ robot.name }} {% else %}     There are no robots {% endfor %}  {# \u0426\u0438\u043a\u043b\u044b \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 #} &lt;table&gt; {% for robot in robots %}     {% if loop.first %}         &lt;thead&gt;             &lt;tr&gt;                 &lt;th&gt;Position&lt;\/th&gt;                 &lt;th&gt;Id&lt;\/th&gt;                 &lt;th&gt;Name&lt;\/th&gt;             &lt;\/tr&gt;         &lt;\/thead&gt;ae         &lt;tbody&gt;     {% endif %}     &lt;tr&gt;         &lt;th&gt;{{ loop.index }}&lt;\/th&gt;         &lt;th&gt;{{ robot.id }}&lt;\/th&gt;         &lt;th&gt;{{ robot.name }}&lt;\/th&gt;     &lt;\/tr&gt;     {% if loop.last %}         &lt;tbody&gt;     {% endif %} {% endfor %} &lt;\/table&gt;  {# \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0438 (Space control delimiters) #} &lt;ul&gt;     {%- for robot in robots -%}     &lt;li&gt;  {{- robot.name -}}&lt;\/li&gt;     {%- endfor %} &lt;\/ul&gt; <\/code><\/pre>\n<p>  <a name=\"sharding\"><\/a>  <\/p>\n<h4>3. \u0413\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0448\u0430\u0440\u0434\u0438\u043d\u0433<\/h4>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. \u041f\u043e\u043b\u0435\u0437\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 master\/slave \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u0421\u0423\u0411\u0414:  <\/p>\n<pre><code class=\"php\">class Robots extends Phalcon\\Mvc\\Model {     public function initialize()     {         $this-&gt;setReadConnectionService('dbSlave');         $this-&gt;setWriteConnectionService('dbMaster');     } } <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u0448\u0430\u0440\u0434\u0438\u043d\u0433, \u043a\u043e\u0433\u0434\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:  <\/p>\n<pre><code class=\"php\">class Robots extends Phalcon\\Mvc\\Model {     public function selectReadConnection($intermediate, $bindParams, $bindTypes)     {         \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0435\u0441\u0442\u044c \u043b\u0438 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 'where'         if (isset($intermediate['where'])) {              $conditions = $intermediate['where'];              \/\/ \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u043c\u0443 \u0443\u0441\u043b\u043e\u0432\u0438\u044f             if ($conditions['left']['name'] == 'id') {                 $id = $conditions['right']['value'];                 if ($id &gt; 0 && $id &lt; 10000) {                     return $this-&gt;getDI()-&gt;get('dbShard1');                 }                 if ($id &gt; 10000) {                     return $this-&gt;getDI()-&gt;get('dbShard2');                 }             }         }          \/\/ \u0412 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e         return $this-&gt;getDI()-&gt;get('dbShard0');     }  } <\/code><\/pre>\n<p>  <a name=\"snapshots\"><\/a>  <\/p>\n<h4>4. \u0417\u0430\u043f\u0438\u0441\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f (Record Snapshots)<\/h4>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u043c\u043e\u0434\u0435\u043b\u044f\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u043e\u043b\u0435\u0439 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u0430\u0443\u0434\u0438\u0442\u0430 \u0438\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u043e\u043b\u0435\u0439 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u044b:   <\/p>\n<pre><code class=\"php\">class Robots extends Phalcon\\Mvc\\Model {     public function initalize()     {         $this-&gt;keepSnapshots(true);     } } <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u0438\u0445 \u043f\u043e\u043b\u0435\u0439 \u0431\u044b\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b:  <\/p>\n<pre><code class=\"php\">$robot = new Robots(); $robot-&gt;name = 'Other name'; var_dump($robot-&gt;getChangedFields()); \/\/ ['name'] var_dump($robot-&gt;hasChanged('name')); \/\/ true var_dump($robot-&gt;hasChanged('type')); \/\/ false <\/code><\/pre>\n<p>  <a name=\"update\"><\/a>  <\/p>\n<h4>5. \u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 ORM \u043f\u0440\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f SQL \u0437\u0430\u043f\u0440\u043e\u0441\u0430 UPDATE \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043d\u0451\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u043f\u043e\u043b\u044f, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u044b\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b, \u0430 \u043d\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u043e\u043b\u044f \u0438 \u0432\u0441\u0435 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442 \u0442\u0440\u0430\u0444\u0438\u043a \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u043b\u0430\u0433\u043e\u043f\u0440\u0438\u044f\u0442\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438:  <\/p>\n<pre><code class=\"php\">class Robots extends Phalcon\\Mvc\\Model {     public function initalize()     {         $this-&gt;useDynamicUpdate(true);     } } <\/code><\/pre>\n<p>  <a name=\"validation\"><\/a>  <\/p>\n<h4>6. \u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f<\/h4>\n<p>  \u041d\u043e\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 Phalcon\\Validation \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430\u0445 \u0443\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432 ORM \u0438 ODM. \u0421 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0438\u043b\u0438 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0435\u0439:<\/p>\n<pre><code class=\"php\">$validation = new Phalcon\\Validation();  $validation     -&gt;add('name', new PresenceOf(array(         'message' =&gt; '\u041f\u043e\u043b\u0435 name \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f'     )))     -&gt;add('name', new StringLength(array(         'min' =&gt; 5,         'minimumMessage' =&gt; '\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f name \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435'     )))     -&gt;add('email', new PresenceOf(array(         'message' =&gt; '\u041f\u043e\u043b\u0435 email \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f '     )))     -&gt;add('email', new Email(array(         'message' =&gt; 'Email \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0444\u043e\u0440\u043c\u0430\u0442\u0443'     )))     -&gt;add('login', new PresenceOf(array(         'message' =&gt; '\u041f\u043e\u043b\u0435 login \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f'     )));  $messages = $validation-&gt;validate($_POST); if (count($messages)) {     foreach ($messages as $message) {         echo $message;     } }  <\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u0432\u044b\u043f\u0443\u0441\u043a \u0442\u0430\u043a \u0436\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u0438\u0445 \u0432\u0441\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0432 \u043f\u043e\u043b\u043d\u044b\u0439 <a href=\"https:\/\/github.com\/phalcon\/cphalcon\/blob\/1.0.0\/CHANGELOG\">\u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439<\/a> \u0438\u043b\u0438 \u0435\u0433\u043e \u0436\u0435 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c \u0432 <a href=\"http:\/\/vk.com\/wall-45934290_24\">\u0440\u0443\u0441\u0441\u043a\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 Phalcon<\/a> \u0432\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435.<\/p>\n<h4>\u041f\u043e\u043c\u043e\u0447\u044c \u0441 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c<\/h4>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u0443 \u0432\u0435\u0440\u0441\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0441 GitHub \u0438\u0437 \u0432\u0435\u0442\u043a\u0438 1.0.0:<\/p>\n<pre><code class=\"php\">git clone http:\/\/github.com\/phalcon\/cphalcon cd build git checkout 1.0.0 sudo .\/install <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 Windows \u043c\u043e\u0433\u0443\u0442 <a href=\"http:\/\/phalconphp.com\/download\">\u0441\u043a\u0430\u0447\u0430\u0442\u044c<\/a> \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 DLL \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438.<\/p>\n<p>  \u0421 \u0440\u0430\u0434\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u0438\u043c\u0435\u043c \u0432\u0430\u0448\u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 <a href=\"http:\/\/forum.phalconphp.com\/\">Phosphorum<\/a>, <a href=\"http:\/\/stackoverflow.com\/questions\/tagged\/phalcon\">Stack Overflow<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/groups.google.com\/forum\/#!forum\/phalcon\">Google Group<\/a>. \u0415\u0441\u043b\u0438 \u0432\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0443 \u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442 \u0434\u043b\u044f \u0435\u0451 \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u2014 \u043e\u0442\u043f\u0440\u0430\u0432\u0442\u0435 \u043d\u0430\u043c pull request \u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 issue \u043d\u0430 <a href=\"https:\/\/github.com\/phalcon\/cphalcon\">GitHub<\/a>.<\/p>\n<p>  P.S. \u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f\u043c\u0438, \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b <a href=\"http:\/\/blog.phalconphp.com\/post\/44715359754\/phalcon-1-0-0-beta-released\">\u0437\u0434\u0435\u0441\u044c<\/a>.<br \/>  \u0414\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 <a href=\"http:\/\/vk.com\/phalconphp\">\u0433\u0440\u0443\u043f\u0430 \u0432\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0435<\/a>, <a href=\"http:\/\/phalconphp.ru\/\">\u0440\u0443\u0441\u0441\u043a\u0438\u0439 \u0441\u0430\u0439\u0442<\/a> \u0438 \u043d\u0430\u0447\u0430\u0442\u0430 <a href=\"https:\/\/github.com\/xboston\/phalcon-docs\">\u043b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>, \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0439\u0442\u0435\u0441\u044c!<br \/>  \u0415\u0441\u0442\u044c \u0442\u0430\u043a \u0436\u0435 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 <a href=\"http:\/\/phalcon-ru.tumblr.com\/\">Phalcon PHP FrameWork<\/a><\/p>\n<p>  \u041f\u0440\u0430\u0432\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0444\u043e\u0442\u043e \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442 Simon Roy: <a href=\"http:\/\/500px.com\/photo\/7924712\">500px.com\/photo\/7924712<\/a>    \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\/171915\/\"> http:\/\/habrahabr.ru\/post\/171915\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0433\u0440\u0430\u043f\u043f\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 Phalcon \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b\u043e \u043f\u0435\u0440\u0432\u0443\u044e \u0431\u0435\u0442\u0430-\u0432\u0435\u0440\u0441\u0438\u044e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 Phalcon 1.0.0. \u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0432 \u043a\u0443\u0440\u0441\u0435: Phalcon \u2014 \u044d\u0442\u043e PHP-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u0421\u0438 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043a\u0430\u043a \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043b\u044f PHP, \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e \u043d\u0435\u0433\u043e \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u043c\u043e\u0436\u043d\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 <a href=\"http:\/\/habrahabr.ru\/post\/159217\/\">Phalcon \u2014 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 PHP MVC Framework<\/a> \u0438 <a href=\"http:\/\/habrahabr.ru\/post\/160311\/\">Phalcon: \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/a>.<br \/>  \u0426\u0435\u043b\u044c \u0432\u044b\u043f\u0443\u0441\u043a\u0430 \u044d\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u2014 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u0438 \u043e\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0430 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/d12\/9a2\/d5c\/d129a2d5c108ff15eaf2d178fa3ee42a.jpg\"\/><\/p>\n<p>  \u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u0430\u043d\u043e\u043d\u0441 \u0432\u0430\u0436\u043d\u044b\u0445 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u044d\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438:  <\/p>\n<ol>\n<li><a href=\"#cache\">\u041c\u043d\u043e\u0433\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0435 \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/a><\/li>\n<li><a href=\"#volt\">\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0435 Volt<\/a><\/li>\n<li><a href=\"#sharding\">\u0413\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0448\u0430\u0440\u0434\u0438\u043d\u0433<\/a><\/li>\n<li><a href=\"#snapshots\">\u0417\u0430\u043f\u0438\u0441\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f (Record Snapshots)<\/a><\/li>\n<li><a href=\"#update\">\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435<\/a><\/li>\n<li><a href=\"#validation\">\u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f<\/a><\/li>\n<\/ol>\n<p>  <\/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-171915","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/171915","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=171915"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/171915\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=171915"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=171915"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=171915"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}