vendor/bluue/categories-bundle/src/Entity/CategoryContext.php line 32

Open in your IDE?
  1. <?php
  2. /**
  3.  * @author Leo BANNHOLTZER (contact@scaledev.fr)
  4.  * @copyright 2021 - ScaleDEV SAS, 12 RUE CHARLES MORET, 10120 ST ANDRE LES VERGERS
  5.  * @license commercial
  6.  */
  7. declare(strict_types=1);
  8. namespace Bluue\CategoriesBundle\Entity;
  9. use App\Entity\Context;
  10. use Symfony\Component\Uid\Uuid;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Bluue\CategoriesBundle\Entity\Category;
  13. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  14. use Bluue\CategoriesBundle\Repository\CategoryContextRepository;
  15. use App\DoctrineExtensions\Timestampable\Traits\UserTimestampableEntity;
  16. use App\DoctrineExtensions\SoftDeleteable\Traits\UserSoftDeleteableEntity;
  17. use Gedmo\Mapping\Annotation as Gedmo;
  18. /**
  19.  * @ORM\Entity(repositoryClass=CategoryContextRepository::class)
  20.  * @ORM\Table(name="categories_bundle__category_context", indexes={
  21.  *  @ORM\Index(name="deleted_at", columns={"deleted_at"}),
  22.  *  @ORM\Index(name="created_at", columns={"created_at"}),
  23.  *  @ORM\Index(name="updated_at", columns={"updated_at"})
  24.  * })
  25.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=false)
  26.  */
  27. class CategoryContext
  28. {
  29.     use UserTimestampableEntity;
  30.     use UserSoftDeleteableEntity;
  31.     /**
  32.      * @ORM\Id
  33.      * @ORM\Column(type="uuid")
  34.      * @ORM\GeneratedValue(strategy="CUSTOM")
  35.      * @ORM\CustomIdGenerator(class=UuidGenerator::class)
  36.      */
  37.     private ?Uuid $id null;
  38.     /**
  39.      * @ORM\ManyToOne(targetEntity=Category::class, inversedBy="categoryContexts")
  40.      * @ORM\JoinColumn(nullable=false)
  41.      */
  42.     private Category $category;
  43.     /**
  44.      * @ORM\ManyToOne(targetEntity=Context::class)
  45.      * @ORM\JoinColumn(nullable=false)
  46.      */
  47.     private Context $context;
  48.     /**
  49.      * @return Uuid|null
  50.      */
  51.     public function getId(): ?Uuid
  52.     {
  53.         return $this->id;
  54.     }
  55.     /**
  56.      * @return Category|null
  57.      */
  58.     public function getCategory(): ?Category
  59.     {
  60.         return $this->category;
  61.     }
  62.     /**
  63.      * @param Category|null $category
  64.      * @return $this
  65.      */
  66.     public function setCategory(?Category $category): self
  67.     {
  68.         $this->category $category;
  69.         return $this;
  70.     }
  71.     /**
  72.      * @return Context|null
  73.      */
  74.     public function getContext(): ?Context
  75.     {
  76.         return $this->context;
  77.     }
  78.     /**
  79.      * @param Context|null $context
  80.      * @return $this
  81.      */
  82.     public function setContext(?Context $context): self
  83.     {
  84.         $this->context $context;
  85.         return $this;
  86.     }
  87. }