{"id":257231,"date":"2015-05-15T01:04:02","date_gmt":"2015-05-14T21:04:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=257231"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=257231","title":{"rendered":"\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 API \u043d\u0430 Symfony2"},"content":{"rendered":"<p>     \t\u0422\u0430\u043a \u0432\u044b\u0448\u043b\u043e, \u0447\u0442\u043e \u0432\u0441\u044e \u0441\u0432\u043e\u044e \u043d\u0435 \u0434\u043e\u043b\u0433\u0443\u044e \u043a\u0430\u0440\u044c\u0435\u0440\u0443 \u044f \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 API \u0434\u043b\u044f \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u0441\u0430\u0439\u0442\u043e\u0432 \u043d\u0430 Symfony2. \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0432\u0441\u0435 \u043d\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u043e\u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c\u0438, \u0430 \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043d\u0435 \u043c\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041e\u0431 \u044d\u0442\u0438\u0445 \u0437\u043d\u0430\u043d\u0438\u044f\u0445 \u0438 \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u0424\u043e\u0440\u043c\u044b<\/h3>\n<p>  \u0412\u043e\u043e\u0431\u0449\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u0434\u043b\u044f API \u043d\u0435 \u043b\u0443\u0447\u0448\u0430\u044f \u0438\u0434\u0435\u044f, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0432\u0441\u0435 \u0436\u0435 \u0440\u0435\u0448\u0438\u043b\u0438\u0441\u044c, \u0442\u043e \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u0445. \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0444\u043e\u0440\u043c\u044b \u0432 symfony \u0434\u0435\u043b\u0430\u043b\u0438\u0441\u044c \u0434\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0441\u0430\u0439\u0442\u043e\u0432, \u0433\u0434\u0435 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434 \u0438 \u0431\u0435\u043a\u0435\u043d\u0434 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u044b. <\/p>\n<p>  \u041f\u0435\u0440\u0432\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0441 <a href=\"http:\/\/symfony.com\/doc\/current\/reference\/forms\/types\/entity.html\">entity type<\/a>. \u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u043e\u0442\u0441\u044b\u043b\u0430\u0435\u0442\u0435 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u043c\u0435\u0442\u043e\u0434\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 entity type \u0432 \u0444\u043e\u0440\u043c\u0430\u0445 \u2013 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0443\u0436\u043d\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u043c\u0443 id. \u041c\u043d\u043e\u0433\u0438\u0435 \u043d\u0435 \u0437\u043d\u0430\u044e\u0442 \u043e\u0431 \u044d\u0442\u043e\u043c \u0438 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u0438\u0432\u043b\u044f\u044e\u0442\u0441\u044f, \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u0435\u0442\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a \u0434\u043e\u043b\u0433\u043e.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">EntityType.php  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\CommonBundle\\Form\\Type;  use App\\CommonBundle\\Form\\DataTransformer\\EntityDataTransformer; use Doctrine\\ORM\\EntityManager; use Symfony\\Component\\Form\\AbstractType; use Symfony\\Component\\Form\\FormBuilderInterface; use Symfony\\Component\\OptionsResolver\\OptionsResolverInterface;  class EntityType extends AbstractType {     private $em;      public function __construct(EntityManager $em)     {         $this-&gt;em = $em;     }      public function setDefaultOptions(OptionsResolverInterface $resolver)     {         $resolver-&gt;setDefaults([             'field' =&gt; 'id',             'class' =&gt; null,             'compound' =&gt; false         ]);          $resolver-&gt;setRequired([             'class',         ]);     }      public function buildForm(FormBuilderInterface $builder, array $options)     {         $builder-&gt;addModelTransformer(new EntityDataTransformer($this-&gt;em, $options['class'], $options['field']));     }      public function getName()     {         return 'entity';     } } <\/code><\/pre>\n<p>  EntityDataTransformer.php  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\CommonBundle\\Form\\DataTransformer;  use Doctrine\\ORM\\EntityManager; use Symfony\\Component\\Form\\DataTransformerInterface;  class EntityDataTransformer implements DataTransformerInterface {     private $em;     private $entityName;     private $fieldName;      public function __construct(EntityManager $em, $entityName, $fieldName)     {         $this-&gt;em = $em;         $this-&gt;entityName = $entityName;         $this-&gt;fieldName = $fieldName;     }      public function transform($value)     {         return null;     }      public function reverseTransform($value)     {         if (!$value) {             return null;         }          return $this-&gt;em-&gt;getRepository($this-&gt;entityName)-&gt;findOneBy([$this-&gt;fieldName =&gt; $value]);     } } <\/code><\/pre>\n<p>  services.yml  <\/p>\n<pre><code class=\"markdown\">    common.form.type.entity:         class: App\\CommonBundle\\Form\\Type\\EntityType         arguments: [@doctrine.orm.entity_manager]         tags:             - { name: form.type, alias: entity } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0441 <a href=\"http:\/\/symfony.com\/doc\/current\/reference\/forms\/types\/checkbox.html\">checkbox type<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u044b\u0442\u0430\u044e\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0431\u0443\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043d\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0442\u0430\u043a\u043e\u0432\u0430, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043a\u043b\u044e\u0447 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0438 \u043e\u043d \u043d\u0435 \u043f\u0443\u0441\u0442\u043e\u0439, \u0442\u043e \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f true.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">BooleanType.php  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\CommonBundle\\Form\\Type;  use App\\CommonBundle\\Form\\DataTransformer\\BooleanDataTransformer; use Symfony\\Component\\Form\\AbstractType; use Symfony\\Component\\Form\\FormBuilderInterface;  class BooleanType extends AbstractType {     public function buildForm(FormBuilderInterface $builder, array $options)     {         $builder-&gt;addViewTransformer(new BooleanDataTransformer());     }      public function getParent()     {         return 'text';     }      public function getName()     {         return 'boolean';     } } <\/code><\/pre>\n<p>  BooleanDataTransformer.php  <\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\CommonBundle\\Form\\DataTransformer;  use Symfony\\Component\\Form\\DataTransformerInterface; use Symfony\\Component\\Form\\Exception\\TransformationFailedException;  class BooleanDataTransformer implements DataTransformerInterface {     public function transform($value)     {         return null;     }      public function reverseTransform($value)     {         if ($value === &quot;false&quot; || $value === &quot;0&quot; || $value === &quot;&quot; || $value === 0) {             return false;         }          return true;     } } <\/code><\/pre>\n<p>  services.yml  <\/p>\n<pre><code class=\"markdown\">    common.form.type.boolean:         class: App\\CommonBundle\\Form\\Type\\BooleanType         tags:             - { name: form.type, alias: boolean } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h3>JMS Serializer<\/h3>\n<p>  \u0412\u043e \u0432\u0441\u0435\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u043f\u0440\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 API \u0441\u043e\u0432\u0435\u0442\u0443\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435. \u041b\u044e\u0434\u0438 \u0441\u043c\u043e\u0442\u0440\u044f\u0442 \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u0433\u0434\u0435 \u0443 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0435\u0441\u0442\u044c \u0434\u0432\u0435 serialization groups: details \u0438 list, \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0438 \u0432\u0441\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0435\u0442\u0441\u044f \u043a\u0430\u043a\u0430\u044f-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u043d\u0430\u0437\u0432\u0430\u043d\u044b \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u043b\u0438\u0448\u043d\u0435\u0439, \u043d\u0435 \u043d\u0443\u0436\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u0422\u0430\u043a \u0436\u0435 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0443\u0432\u043e\u0434\u0438\u0442\u044c \u0432 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u043f\u0440\u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0435\u0441\u043b\u0438 \u043e\u0431\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u044b\u0432\u043e\u0434\u044f\u0442 \u0441\u0432\u044f\u0437\u044c \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440<\/b><\/p>\n<div class=\"spoiler_text\">News.php  <\/p>\n<pre><code class=\"php\">&lt;?php  use JMS\\Serializer\\Annotation as Serialization;  class News {     \/**      * @Serialization\\Groups({&quot;details&quot;, &quot;list&quot;})      *\/     protected $id;      \/**      * @Serialization\\Groups({&quot;details&quot;, &quot;list&quot;})      *\/     protected $title;      \/**      * @Serialization\\Groups({&quot;details&quot;, &quot;list&quot;})      *\/     protected $text;      \/**      * \u0421\u0432\u044f\u0437\u044c \u0441 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c\u044e User      *      * @Serialization\\Groups({&quot;details&quot;, &quot;list&quot;})      *\/     protected $author; } <\/code><\/pre>\n<p>  User.php  <\/p>\n<pre><code class=\"php\">&lt;?php  use JMS\\Serializer\\Annotation as Serialization;  class User {     \/**      * @Serialization\\Groups({&quot;details&quot;, &quot;list&quot;})      *\/     protected $id;      \/**      * @Serialization\\Groups({&quot;details&quot;, &quot;list&quot;})      *\/     protected $name;      \/** \u041e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043b\u0435\u0439 \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438 list \u0438 details *\/ } <\/code><\/pre>\n<p>  NewsController.php  <\/p>\n<pre><code class=\"php\">&lt;?php  class NewsController extends BaseController {     \/**      * @SerializationGroups({&quot;details&quot;})      * @Route(&quot;\/news\/{id}&quot;, requirements={&quot;id&quot;: &quot;\\d+&quot;})      *\/     public function detailsAction(Common\\Entity\\News $entity)     {         return $entity;     } } <\/code><\/pre>\n<\/p><\/div>\n<\/div>\n<p>  \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0441\u0442\u0438 \u0432 \u043f\u043e\u043b\u0435 author \u0431\u0443\u0434\u0443\u0442 \u0432\u0441\u0435 \u043f\u043e\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 User \u0441 \u0433\u0440\u0443\u043f\u043f\u043e\u0439 details, \u0447\u0442\u043e \u044f\u0432\u043d\u043e \u043d\u0435 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u043d\u0430\u0448\u0438 \u043f\u043b\u0430\u043d\u044b. \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0442\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f, \u043d\u043e \u043a \u043c\u043e\u0435\u043c\u0443 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u044e \u0442\u0430\u043a \u0434\u0435\u043b\u0430\u044e\u0442 \u043c\u043d\u043e\u0433\u0438\u0435.<\/p>\n<p>  \u042f \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u044b \u043a\u0430\u043a %entity_name%_details, %entity_name%_list \u0438 %entity_name%_embed. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043d\u0443\u0436\u043d\u0430 \u043a\u0430\u043a \u0440\u0430\u0437 \u0434\u043b\u044f \u0442\u0435\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u043a\u043e\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0443\u044e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u0432 \u0441\u043f\u0438\u0441\u043a\u0435.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440<\/b><\/p>\n<div class=\"spoiler_text\">News.php  <\/p>\n<pre><code class=\"php\">&lt;?php  use JMS\\Serializer\\Annotation as Serialization;  class News {     \/**      * @Serialization\\Groups({&quot;news_details&quot;, &quot;news_list&quot;})      *\/     protected $id;      \/**      * @Serialization\\Groups({&quot;news_details&quot;, &quot;news_list&quot;})      *\/     protected $title;      \/**      * @Serialization\\Groups({&quot;news_details&quot;, &quot;news_list&quot;})      *\/     protected $text;      \/**      * \u0421\u0432\u044f\u0437\u044c \u0441 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c\u044e User      *      * @Serialization\\Groups({&quot;news_details&quot;, &quot;news_list&quot;})      *\/     protected $author; } <\/code><\/pre>\n<p>  User.php  <\/p>\n<pre><code class=\"php\">&lt;?php  use JMS\\Serializer\\Annotation as Serialization;  class User {     \/**      * @Serialization\\Groups({&quot;user_details&quot;, &quot;user_list&quot;, &quot;user_embed&quot;})      *\/     protected $id;      \/**      * @Serialization\\Groups({&quot;user_details&quot;, &quot;user_list&quot;, &quot;user_embed&quot;})      *\/     protected $name;      \/** \u041e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u044b \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438 user_list \u0438 user_details *\/ } <\/code><\/pre>\n<p>  NewsController.php  <\/p>\n<pre><code class=\"php\">&lt;?php  class NewsController extends BaseController {     \/**      * @SerializationGroups({&quot;news_details&quot;, &quot;user_embed&quot;})      * @Route(&quot;\/news\/{id}&quot;, requirements={&quot;id&quot;: &quot;\\d+&quot;})      *\/     public function detailsAction(Common\\Entity\\News $entity)     {         return $entity;     } } <\/code><\/pre>\n<\/p><\/div>\n<\/div>\n<p>  \u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u0431\u0443\u0434\u0443\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u043e\u043b\u044f, \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u0435\u0441\u0442\u0430\u0445, \u0433\u0434\u0435 \u0442\u043e\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043a\u0440\u0430\u0442\u043a\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435.<\/p>\n<h3>\u041a\u043e\u043d\u0435\u0446<\/h3>\n<p>  \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u043e\u0432\u0435\u0442\u043e\u0432 \u0435\u0449\u0435 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0438 \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u044f \u0441 \u0440\u0430\u0434\u043e\u0441\u0442\u044c\u044e \u0438\u043c\u0438 \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c.     \t<\/p>\n<div class=\"clear\"><\/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\/257991\/\"> http:\/\/habrahabr.ru\/post\/257991\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t\u0422\u0430\u043a \u0432\u044b\u0448\u043b\u043e, \u0447\u0442\u043e \u0432\u0441\u044e \u0441\u0432\u043e\u044e \u043d\u0435 \u0434\u043e\u043b\u0433\u0443\u044e \u043a\u0430\u0440\u044c\u0435\u0440\u0443 \u044f \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 API \u0434\u043b\u044f \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u0441\u0430\u0439\u0442\u043e\u0432 \u043d\u0430 Symfony2. \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0432\u0441\u0435 \u043d\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u043e\u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c\u0438, \u0430 \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043d\u0435 \u043c\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041e\u0431 \u044d\u0442\u0438\u0445 \u0437\u043d\u0430\u043d\u0438\u044f\u0445 \u0438 \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c.  <\/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-257231","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/257231","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=257231"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/257231\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=257231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=257231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=257231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}