src/Entity/RecipeImages.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\traits\base64Field;
  4. use App\Entity\traits\Timestapable;
  5. use App\Repository\RecipeImagesRepository;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. #[ORM\Entity(repositoryClassRecipeImagesRepository::class)]
  9. class RecipeImages
  10. {
  11.     use Timestapable;
  12.     use base64Field;
  13.     
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\ManyToOne(inversedBy'recipeImages'cascade:['persist''remove'])]
  19.     #[ORM\JoinColumn(name:"recipe_id"referencedColumnName:"id"onDelete:"CASCADE")]
  20.     private ?Recipe $recipe null;
  21.     #[ORM\Column(length255)]
  22.     #[Groups(["list_recipes""show_recipe"])]
  23.     private ?string $url null;
  24.     #[ORM\Column(length255nullable:true)]
  25.     private ?string $mimeType null;
  26.     #[ORM\Column(length255nullable:true)]
  27.     private ?string $originalName null;
  28.     #[ORM\Column(length255nullable:true)]
  29.     private ?string $caption null;
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getRecipe($need false): ?Recipe
  35.     {
  36.         if($need){
  37.             return $this->recipe;
  38.         }else{
  39.             return null;
  40.         }
  41.     }
  42.     public function setRecipe(?Recipe $recipe): self
  43.     {
  44.         $this->recipe $recipe;
  45.         return $this;
  46.     }
  47.     public function getUrl(): ?string
  48.     {
  49.         return $this->url;
  50.     }
  51.     public function setUrl(string $url): self
  52.     {
  53.         $this->url $url;
  54.         return $this;
  55.     }
  56.     public function getCaption(): ?string
  57.     {
  58.         return $this->caption;
  59.     }
  60.     public function setCaption(string $caption): self
  61.     {
  62.         $this->caption $caption;
  63.         return $this;
  64.     }
  65.     /**
  66.      * Get the value of mimeType
  67.      */ 
  68.     public function getMimeType()
  69.     {
  70.         return $this->mimeType;
  71.     }
  72.     /**
  73.      * Set the value of mimeType
  74.      *
  75.      * @return  self
  76.      */ 
  77.     public function setMimeType($mimeType)
  78.     {
  79.         $this->mimeType $mimeType;
  80.         return $this;
  81.     }
  82.     /**
  83.      * Get the value of originalName
  84.      */ 
  85.     public function getOriginalName()
  86.     {
  87.         return $this->originalName;
  88.     }
  89.     /**
  90.      * Set the value of originalName
  91.      *
  92.      * @return  self
  93.      */ 
  94.     public function setOriginalName($originalName)
  95.     {
  96.         $this->originalName $originalName;
  97.         return $this;
  98.     }
  99. }