fosrestbundle

Symfony2, FOSRestBundle. How to use group with JMSSerializerBundle?

╄→гoц情女王★ 提交于 2019-11-29 04:09:18
I have entity: <?php namespace AppBundle\Entity; use Doctrine\ORM\Mapping as ORM; use JMS\Serializer\Annotation\Groups; //... /** * @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository") **/ class User extends BaseUser { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") * @Groups({"default"}) */ protected $id; /** * @ORM\ManyToMany(targetEntity="StorageBundle\Entity\File") * @ORM\JoinTable(name="users_photos", * joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="photo_id",

CSRF validation needed or not when using RESTful API?

孤者浪人 提交于 2019-11-28 10:53:39
问题 The following is written on the of the page of FOSRestBundle: "CSRF validation When building a single application that should handle forms both via HTML forms as well as via a REST API, one runs into a problem with CSRF token validation. In most cases it is necessary to enable them for HTML forms, but it makes no sense to use them for a REST API. For this reason there is a form extension to disable CSRF validation for users with a specific role. This of course requires that REST API users

Symfony2, FOSRestBundle. How to use group with JMSSerializerBundle?

浪子不回头ぞ 提交于 2019-11-27 18:18:01
问题 I have entity: <?php namespace AppBundle\Entity; use Doctrine\ORM\Mapping as ORM; use JMS\Serializer\Annotation\Groups; //... /** * @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository") **/ class User extends BaseUser { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") * @Groups({"default"}) */ protected $id; /** * @ORM\ManyToMany(targetEntity="StorageBundle\Entity\File") * @ORM\JoinTable(name="users_photos", * joinColumns={@ORM\JoinColumn(name=