<?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")
*/
private ?string $image;
/**
* @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", nullable=true)
*/
private $published;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $enabled;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $onpromo;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $price = null;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $currency = null;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $hashebergement = null;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $cancellation = null;
/**
* @ORM\Column(type="array", nullable=true)
*/
private $highlights;
/**
* @ORM\Column(type="array", nullable=true)
*/
private $included;
/**
* @ORM\Column(type="array", nullable=true)
*/
private $notincluded;
/**
* @ORM\Column(type="array", nullable=true)
*/
private $steps;
/**
* @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\Destination", inversedBy="experiences")
*/
private $destination;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Program", mappedBy="experience",orphanRemoval=true))
* @ORM\OrderBy({"id": "DESC"})
*/
private Collection $programs;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Media", mappedBy="experience",orphanRemoval=true))
* @ORM\OrderBy({"id": "DESC"})
*/
private Collection $medias;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Hebergement", mappedBy="experience",orphanRemoval=true))
* @ORM\OrderBy({"id": "DESC"})
*/
private Collection $hebergements;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Promotion", mappedBy="experience", cascade={"persist", "remove"})
*/
private $promotion;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Availability", mappedBy="experience", cascade={"persist", "remove"})
*/
private $availability;
public function __construct() {
$this->createdAt = new \DateTime('now');
$this->enabled = 1;
$this->published = 0;
$this->subcategories = new ArrayCollection();
$this->programs = new ArrayCollection();
$this->medias = new ArrayCollection();
$this->hebergements = new ArrayCollection();
}
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 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 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;
}
public function getDestination() {
return $this->destination;
}
public function setDestination($destination): void {
$this->destination = $destination;
}
public function getIncluded() {
return $this->included;
}
public function getNotincluded() {
return $this->notincluded;
}
public function setIncluded($included): void {
$this->included = $included;
}
public function setNotincluded($notincluded): void {
$this->notincluded = $notincluded;
}
public function getMedias(): Collection {
return $this->medias;
}
public function getHebergements(): Collection {
return $this->hebergements;
}
public function setMedias(Collection $medias): void {
$this->medias = $medias;
}
public function setHebergements(Collection $hebergements): void {
$this->hebergements = $hebergements;
}
public function getImage(): ?string {
return $this->image;
}
public function setImage(?string $image): void {
$this->image = $image;
}
public function getOnpromo() {
return $this->onpromo;
}
public function setOnpromo($onpromo): void {
$this->onpromo = $onpromo;
}
public function getPromotion() {
return $this->promotion;
}
public function getAvailability() {
return $this->availability;
}
public function setPromotion(Promotion $promotion): void {
$this->promotion = $promotion;
$promotion->setExperience($this);
}
public function setAvailability(Availability $availability): void {
$this->availability = $availability;
$availability->setExperience($this);
}
public function getPrice() {
return $this->price;
}
public function setPrice($price): void {
$this->price = $price;
}
public function getHashebergement() {
return $this->hashebergement;
}
public function getCancellation() {
return $this->cancellation;
}
public function setHashebergement($hashebergement): void {
$this->hashebergement = $hashebergement;
}
public function setCancellation($cancellation): void {
$this->cancellation = $cancellation;
}
public function getCurrency() {
return $this->currency;
}
public function setCurrency($currency): void {
$this->currency = $currency;
}
public function getSteps() {
return $this->steps;
}
public function setSteps($step): void {
if ($this->steps == null) {
$this->steps[] = $step;
} if (!in_array($step, $this->steps)) {
$this->steps[] = $step;
}
}
public function addProgram(Program $program): void {
$program->setExperience($this);
if (!$this->programs->contains($program)) {
$this->programs[] = $program;
}
}
public function removeProgram(Program $program): void {
$this->programs->removeElement($program);
}
public function addMedia(Media $media): void {
$media->setExperience($this);
if (!$this->medias->contains($media)) {
$this->medias->add($media);
}
}
public function removeMedia(Media $media): void {
$this->medias->removeElement($media);
}
public function addHebergement(Hebergement $hebergement): void {
$hebergement->setExperience($this);
if (!$this->hebergements->contains($hebergement)) {
$this->hebergements->add($hebergement);
}
}
public function removeHebergement(Hebergement $hebergement): void {
$this->hebergements->removeElement($hebergement);
}
public function addSubcategory(Subcategory $subcategory): void {
// foreach ($Subcategories as $subcategory) {
if (!$this->subcategories->contains($subcategory)) {
$this->subcategories [] = $subcategory;
$subcategory->addExperience($this);
}
// }
}
public function removeSubcategory(Subcategory $subcategory): void {
$this->subcategories->removeElement($subcategory);
}
}