39 lines
988 B
PHP
39 lines
988 B
PHP
|
<?php declare(strict_types=1);
|
||
|
|
||
|
namespace App\Entity;
|
||
|
|
||
|
use Doctrine\ORM\Mapping as ORM;
|
||
|
use Doctrine\Common\Collections\{Collection, ArrayCollection};
|
||
|
|
||
|
#[ORM\Table(name: 'chipset', schema: 'collection')]
|
||
|
#[ORM\Entity]
|
||
|
class Chipset {
|
||
|
use GetSet;
|
||
|
|
||
|
#[ORM\Column('id', type: 'integer', nullable: FALSE)]
|
||
|
#[ORM\Id]
|
||
|
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
|
||
|
private int $id;
|
||
|
|
||
|
#[ORM\ManyToOne(targetEntity: Brand::class, fetch: 'EAGER')]
|
||
|
#[ORM\OrderBy(['name' => 'asc'])]
|
||
|
#[ORM\JoinColumn('brand_id', referencedColumnName: 'id', nullable: FALSE)]
|
||
|
private Brand $brand;
|
||
|
|
||
|
#[ORM\Column('name', type: 'string', nullable: FALSE)]
|
||
|
private string $name;
|
||
|
|
||
|
#[ORM\Column('parts', type: 'string', nullable: FALSE)]
|
||
|
private string $parts;
|
||
|
|
||
|
#[ORM\Column('link', type: 'string', nullable: TRUE)]
|
||
|
private ?string $link;
|
||
|
|
||
|
public function __toString(): string
|
||
|
{
|
||
|
$name = $this->brand->getName() . ' ' . $this->name;
|
||
|
|
||
|
return ($this->parts !== '') ? "{$name} ({$this->parts})" : $name;
|
||
|
}
|
||
|
}
|