73 lines
1.3 KiB
PHP
73 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
/**
|
|
* @ORM\Entity
|
|
* @ORM\Table(name="battery_manufacturer")
|
|
*/
|
|
class BatteryManufacturer
|
|
{
|
|
// unique id
|
|
/**
|
|
* @ORM\Id
|
|
* @ORM\Column(type="integer")
|
|
* @ORM\GeneratedValue(strategy="AUTO")
|
|
*/
|
|
protected $id;
|
|
|
|
// name
|
|
/**
|
|
* @ORM\Column(type="string", length=80)
|
|
* @Assert\NotBlank()
|
|
*/
|
|
protected $name;
|
|
|
|
// battery
|
|
/**
|
|
* @ORM\OneToMany(targetEntity="Battery", mappedBy="manufacturer")
|
|
*/
|
|
protected $batteries;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->batteries = 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 addBattery(Battery $battery)
|
|
{
|
|
$this->batteries->add($battery);
|
|
return $this;
|
|
}
|
|
|
|
public function clearBatteries()
|
|
{
|
|
$this->batteries->clear();
|
|
return $this;
|
|
}
|
|
|
|
public function getBatteries()
|
|
{
|
|
return $this->batteries;
|
|
}
|
|
}
|