src/Entity/Details/Operation/DetailsSponsorship.php line 35

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Details\Operation;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\Details\DetailsSponsorshipRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. use App\Entity\Operation\Sponsorship;
  8. /**
  9.  * @ApiResource(
  10.  *     attributes={
  11.  *          "force_eager"=false,
  12.  *          "normalization_context"={
  13.  *              "groups"={
  14.  *                  "DetailsSponsorship:output",
  15.  *                  "DetailsSponsorship:io"
  16.  *               },
  17.  *              "enable_max_depth"=true
  18.  *          },
  19.  *          "denormalization_context"={
  20.  *              "groups"={
  21.  *                  "DetailsSponsorship:output",
  22.  *                  "DetailsSponsorship:io"
  23.  *               },
  24.  *              "enable_max_depth"=true
  25.  *          }
  26.  *      },
  27.  *     collectionOperations={"GET"},
  28.  *     itemOperations={"GET"},
  29.  * )
  30.  * @ORM\Entity(repositoryClass=DetailsSponsorshipRepository::class)
  31.  */
  32. class DetailsSponsorship extends DetailsOperation
  33. {
  34.     /**
  35.      * @ORM\OneToOne(targetEntity=Sponsorship::class, inversedBy="details")
  36.      * @ORM\JoinColumn(name="object_id", referencedColumnName="id")
  37.      * @Groups({
  38.      *     "OperationSponsorship:io",
  39.      *     "DetailsSponsorship:io",
  40.      * })
  41.      */
  42.     private $operation;
  43.     /**
  44.      * @return string
  45.      */
  46.     public function getId() : string
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getSponsorship(): Sponsorship
  51.     {
  52.         return $this->operation;
  53.     }
  54.     public function setSponsorship(Sponsorship $sponsorship)
  55.     {
  56.         $this->operation $sponsorship;
  57.         return $this;
  58.     }
  59.     public function getOperation(): Sponsorship
  60.     {
  61.         return $this->operation;
  62.     }
  63.     public function setOperation(Sponsorship $sponsorship): self
  64.     {
  65.         $this->operation $sponsorship;
  66.         return $this;
  67.     }
  68. }