<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\SubcategoryRepository")
* @ORM\Table(name="subcategory")
*
* Defines the properties of the Tag entity to represent the subcategory tags.
*
* See https://symfony.com/doc/current/doctrine.html#creating-an-entity-class
*
* @author Yonel Ceruto <yonelceruto@gmail.com>
*/
class Subcategory {
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private ?int $id = null;
/**
* @ORM\Column(type="string", nullable=true)
*/
private ?string $name = null;
/**
* @ORM\Column(type="string", nullable=true)
*/
private ?string $image = null;
/**
* @ORM\Column(type="string", nullable=true)
*/
private ?string $description = null;
/**
* @ORM\Column(type="boolean")
*/
private $published;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Category", inversedBy="subcategories")
*/
private $category;
/**
* @ORM\Column(type="string", nullable=true)
*/
private ?string $ordre = null;
/**
* @ORM\ManyToMany(targetEntity="Experience", mappedBy="subcategories")
* @ORM\JoinColumn(nullable=true)
*/
private Collection $experiences;
public function __construct() {
$this->experiences = new ArrayCollection();
}
public function getId(): ?int {
return $this->id;
}
public function getName(): ?string {
return $this->name;
}
public function getDescription(): ?string {
return $this->description;
}
public function getPublished() {
return $this->published;
}
public function getCategory() {
return $this->category;
}
public function setName(?string $name): void {
$this->name = $name;
}
public function setDescription(?string $description): void {
$this->description = $description;
}
public function setPublished($published): void {
$this->published = $published;
}
public function setCategory($category): void {
$this->category = $category;
}
public function getOrdre(): ?string {
return $this->ordre;
}
public function setOrdre(?string $ordre): void {
$this->ordre = $ordre;
}
public function getImage(): ?string {
return $this->image;
}
public function setImage(?string $image): void {
$this->image = $image;
}
public function addExperience(Experience $experience): void {
if (!$this->experiences->contains($experience)) {
$this->experiences[] = $experience;
}
}
}