<?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\ExperienceRepository")
* @ORM\Table(name="experience")
*
* Defines the properties of the Subcategory entity to represent the article Subcategories.
*
* See https://symfony.com/doc/current/doctrine.html#creating-an-entity-class
*
* @author Yonel Ceruto <yonelceruto@gmail.com>
*/
class Experience {
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private ?int $id = null;
/**
* @ORM\Column(type="datetime")
*/
private \DateTime $createdAt;
/**
* @ORM\Column(type="string", nullable=true)
*/
private ?string $title = null;
/**
* @ORM\Column(type="string", nullable=true)
*/
private ?string $coachingtype = null;
/**
* @ORM\Column(type="string", nullable=true)
*/
private ?string $resume = null;
/**
* @ORM\Column(type="string", nullable=true)
*/
private ?string $description = null;
/**
* @ORM\Column(type="boolean")
*/
private $published;
/**
* @ORM\Column(type="boolean")
*/
private $enabled;
/**
* @var Subcategory[]|Collection
*
* @ORM\ManyToMany(targetEntity="Subcategory", inversedBy="experiences", cascade={"persist"})
* @ORM\JoinTable(name="bookoach_experience_subcategory")
* @ORM\OrderBy({"name": "ASC"})
*/
#[Assert\Count(max: 10, maxMessage: 'experience.too_many_subcategories')]
private Collection $subcategories;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Category", inversedBy="experiences")
*/
private $country;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Program", mappedBy="experience",orphanRemoval=true))
* @ORM\OrderBy({"id": "DESC"})
*/
private Collection $programs;
/**
* @ORM\Column(type="array", nullable=true)
*/
private $highlights;
public function __construct() {
$this->createdAt = new \DateTime('now');
$this->enabled = 1;
$this->published = 0;
$this->subcategories = new ArrayCollection();
$this->programs = new ArrayCollection();
}
public function addSubcategory(Subcategory $subcategory): void {
// foreach ($Subcategories as $subcategory) {
if (!$this->subcategories->contains($subcategory)) {
$this->subcategories [] = $subcategory;
$subcategory->addArticle($this);
}
// }
}
public function removeSubcategory(Subcategory $subcategory): void {
$this->subcategories->removeElement($subcategory);
}
public function getId(): ?int {
return $this->id;
}
public function getCreatedAt(): \DateTime {
return $this->createdAt;
}
public function getTitle(): ?string {
return $this->title;
}
public function getCoachingtype(): ?string {
return $this->coachingtype;
}
public function getResume(): ?string {
return $this->resume;
}
public function getDescription(): ?string {
return $this->description;
}
public function getPublished() {
return $this->published;
}
public function getEnabled() {
return $this->enabled;
}
public function getSubcategories(): Collection {
return $this->subcategories;
}
public function getCountry() {
return $this->country;
}
public function setId(?int $id): void {
$this->id = $id;
}
public function setCreatedAt(\DateTime $createdAt): void {
$this->createdAt = $createdAt;
}
public function setTitle(?string $title): void {
$this->title = $title;
}
public function setCoachingtype(?string $coachingtype): void {
$this->coachingtype = $coachingtype;
}
public function setResume(?string $resume): void {
$this->resume = $resume;
}
public function setDescription(?string $description): void {
$this->description = $description;
}
public function setPublished($published): void {
$this->published = $published;
}
public function setEnabled($enabled): void {
$this->enabled = $enabled;
}
public function setSubcategories(Collection $subcategories): void {
$this->subcategories = $subcategories;
}
public function setCountry($country): void {
$this->country = $country;
}
public function getPrograms(): Collection {
return $this->programs;
}
public function setPrograms(Collection $programs): void {
$this->programs = $programs;
}
public function getHighlights() {
return $this->highlights;
}
public function setHighlights($highlights): void {
$this->highlights = $highlights;
}
}