nineskeletor/src/Entity/Alertcategory.php

176 lines
2.8 KiB
PHP
Executable File

<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="alertcategory")
*/
class Alertcategory
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="label", type="string", length=100)
*/
private $label;
/**
* @var int
*
* @ORM\Column(name="color", type="string", nullable=true)
*/
private $color;
/**
* @ORM\ManyToOne(targetEntity="Icon", inversedBy="alertcategorys")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $icon;
/**
* @ORM\OneToMany(targetEntity="Alert", mappedBy="alertcategory", cascade={"persist"}, orphanRemoval=true)
* @ORM\JoinColumn(name="alerts", referencedColumnName="id")
*/
protected $alerts;
// A garder pour forcer l'id en init
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Constructor.
*/
public function __construct()
{
$this->alerts = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set label.
*
* @param string $label
*
* @return Alertcategory
*/
public function setLabel($label)
{
$this->label = $label;
return $this;
}
/**
* Get label.
*
* @return string
*/
public function getLabel()
{
return $this->label;
}
/**
* Set color.
*
* @param string $color
*
* @return Alertcategory
*/
public function setColor($color)
{
$this->color = $color;
return $this;
}
/**
* Get color.
*
* @return string
*/
public function getColor()
{
return $this->color;
}
/**
* Set icon.
*
* @param Icon $icon
*
* @return Alertcategory
*/
public function setIcon(Icon $icon = null)
{
$this->icon = $icon;
return $this;
}
/**
* Get icon.
*
* @return Icon
*/
public function getIcon()
{
return $this->icon;
}
/**
* Add alert.
*
* @return Alertcategory
*/
public function addAlert(Alert $alert)
{
$this->alerts[] = $alert;
return $this;
}
/**
* Remove alert.
*/
public function removeAlert(Alert $alert)
{
$this->alerts->removeElement($alert);
}
/**
* Get alerts.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getAlerts()
{
return $this->alerts;
}
}