<?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\DestinationRepository")
* @ORM\Table(name="destination")
*
* 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 Destination {
/**
* @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 $description = null;
/**
* @ORM\Column(type="boolean")
*/
private $published;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Country", inversedBy="destinations")
*/
private $country;
/**
* @ORM\Column(type="string", nullable=true)
*/
private ?string $ordre = null;
/**
* @ORM\Column(type="string", nullable=true)
*/
private ?string $typedestination = null;
/**
* @ORM\Column(type="string", nullable=true)
*/
private ?string $image = null;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Experience", mappedBy="destination",orphanRemoval=true))
* @ORM\OrderBy({"id": "DESC"})
*/
private Collection $experiences;
public function __construct() {
$this->experiences = new ArrayCollection();
$this->published = 1;
}
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 getCountry() {
return $this->country;
}
public function getOrdre(): ?string {
return $this->ordre;
}
public function setId(?int $id): void {
$this->id = $id;
}
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 setCountry($country): void {
$this->country = $country;
}
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 getTypedestination(): ?string {
return $this->typedestination;
}
public function setTypedestination(?string $typedestination): void {
$this->typedestination = $typedestination;
}
public function getExperiences(): Collection {
return $this->experiences;
}
public function setExperiences(Collection $experiences): void {
$this->experiences = $experiences;
}
public function addExperience(Experience $experience): void {
$experience->setDestination($this);
if (!$this->experiences->contains($experience)) {
$this->experiences->add($experience);
}
}
public function removeExperience(Experience $experience): void {
$this->experiences->removeElement($experience);
}
}