<?php
/**
* @author Leo BANNHOLTZER (contact@scaledev.fr)
* @copyright 2021 - ScaleDEV SAS, 12 RUE CHARLES MORET, 10120 ST ANDRE LES VERGERS
* @license commercial
*/
declare(strict_types=1);
namespace Bluue\CategoriesBundle\Entity;
use App\Entity\Context;
use Symfony\Component\Uid\Uuid;
use Doctrine\ORM\Mapping as ORM;
use Bluue\CategoriesBundle\Entity\Category;
use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
use Bluue\CategoriesBundle\Repository\CategoryContextRepository;
use App\DoctrineExtensions\Timestampable\Traits\UserTimestampableEntity;
use App\DoctrineExtensions\SoftDeleteable\Traits\UserSoftDeleteableEntity;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass=CategoryContextRepository::class)
* @ORM\Table(name="categories_bundle__category_context", indexes={
* @ORM\Index(name="deleted_at", columns={"deleted_at"}),
* @ORM\Index(name="created_at", columns={"created_at"}),
* @ORM\Index(name="updated_at", columns={"updated_at"})
* })
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=false)
*/
class CategoryContext
{
use UserTimestampableEntity;
use UserSoftDeleteableEntity;
/**
* @ORM\Id
* @ORM\Column(type="uuid")
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class=UuidGenerator::class)
*/
private ?Uuid $id = null;
/**
* @ORM\ManyToOne(targetEntity=Category::class, inversedBy="categoryContexts")
* @ORM\JoinColumn(nullable=false)
*/
private Category $category;
/**
* @ORM\ManyToOne(targetEntity=Context::class)
* @ORM\JoinColumn(nullable=false)
*/
private Context $context;
/**
* @return Uuid|null
*/
public function getId(): ?Uuid
{
return $this->id;
}
/**
* @return Category|null
*/
public function getCategory(): ?Category
{
return $this->category;
}
/**
* @param Category|null $category
* @return $this
*/
public function setCategory(?Category $category): self
{
$this->category = $category;
return $this;
}
/**
* @return Context|null
*/
public function getContext(): ?Context
{
return $this->context;
}
/**
* @param Context|null $context
* @return $this
*/
public function setContext(?Context $context): self
{
$this->context = $context;
return $this;
}
}