2
   /**
 * @Groups({"car_read", "car_write"})
 * @ORM\ManyToMany(targetEntity="App\Entity\User", inversedBy="cars")
 */
public $users;

/**
 * @return Collection|User[]
 */
public function getUsers(): Collection
{
    return $this->users;
}

public function addUser(User $user): self
{
    if (!$this->users->contains($user)) {
        $this->users[] = $user;
    }

    return $this;
}

public function removeUser(User $user): self
{
    if ($this->users->contains($user)) {
        $this->users->removeElement($user);
    }

    return $this;
}



    /**
 * @Groups({"user_write", "user_read"})
 * @ORM\ManyToMany(targetEntity="App\Entity\Car", mappedBy="users")
 */
private $cars;

public function __construct($username)
{
    $this->username = $username;
    $this->cars = new ArrayCollection();
    $this->userData = new ArrayCollection();
}

public function addCar(Car $car): self
{
    if (!$this->cars->contains($car)) {
        $this->cars->add($car);
    }

    return $this;
}

public function removeCar(Car $Cars): bool
{
    return $this->cars->removeElement($Cars);
}

public function getCars(): Collection
{
    return $this->cars;
}

У данной машины есть юзер, это запрос на получение всех машин, ограничение я хочу поставить в itemOperations getъ

введите сюда описание изображения

При попытке получить машину используя юзера которому принадлежит эта машина получаю форбиден

0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Посмотрите другие вопросы с метками или задайте свой вопрос.