76 lines
1.3 KiB
PHP
76 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
|
/**
|
|
* @ORM\Entity
|
|
* @ORM\Table(name="service")
|
|
*/
|
|
class Service
|
|
{
|
|
// unique id
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\Column(type="integer")
|
|
* @ORM\GeneratedValue(strategy="AUTO")
|
|
*/
|
|
protected $id;
|
|
|
|
// name of service
|
|
/**
|
|
* @ORM\Column(type="string", length=80)
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $name;
|
|
|
|
// link to partners with this service
|
|
/**
|
|
* @ORM\ManyToMany(targetEntity="Partner", mappedBy="services", fetch="EXTRA_LAZY")
|
|
*/
|
|
protected $partners;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->partners = new ArrayCollection();
|
|
}
|
|
|
|
public function getID()
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function setName($name)
|
|
{
|
|
$this->name = $name;
|
|
return $this;
|
|
}
|
|
|
|
public function getName()
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
public function addPartner(Partner $partner)
|
|
{
|
|
$this->partners[$partner->getID()] = $partner;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function clearPartners()
|
|
{
|
|
$this->partners->clear();
|
|
return $this;
|
|
}
|
|
|
|
public function getPartners()
|
|
{
|
|
return $this->partners;
|
|
}
|
|
|
|
}
|