74 lines
1.3 KiB
PHP
74 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="vehicle_manufacturer")
|
|
*/
|
|
class VehicleManufacturer
|
|
{
|
|
// 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;
|
|
|
|
// vehicles
|
|
/**
|
|
* @ORM\OneToMany(targetEntity="Vehicle", mappedBy="manufacturer")
|
|
* @ORM\OrderBy({"make" = "ASC"})
|
|
*/
|
|
protected $vehicles;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->vehicles = 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 addVehicle(Vehicle $vehicle)
|
|
{
|
|
$this->vehicles->add($vehicle);
|
|
return $this;
|
|
}
|
|
|
|
public function clearVehicles()
|
|
{
|
|
$this->vehicles->clear();
|
|
return $this;
|
|
}
|
|
|
|
public function getVehicles()
|
|
{
|
|
return $this->vehicles;
|
|
}
|
|
}
|