'asc'])] private ?Brand $brand; #[ORM\Column(name: 'name', type: 'string', nullable: FALSE)] private string $name; #[ORM\Column(name: 'other_name', type: 'string', nullable: TRUE)] private ?string $otherName = NULL; #[ORM\Column(name: 'pin_count', type: 'integer', nullable: FALSE)] private int $pinCount; #[ORM\ManyToMany(targetEntity: Cpu::class, mappedBy: 'sockets', fetch: 'EXTRA_LAZY')] private Collection $cpus; #[ORM\ManyToMany(targetEntity: Motherboard::class, mappedBy: 'sockets', fetch: 'EXTRA_LAZY')] private Collection $motherboards; #[ORM\Column( name: 'socket_type', type: 'string', enumType: SocketType::class, )] private SocketType $type = SocketType::PIN_GRID_ARRAY; // ------------------------------------------------------------------------ public function getLabel(): string { $name = (empty($this->otherName)) ? $this->name : "$this->name / $this->otherName"; return "{$name} ({$this->type->value} $this->pinCount)"; } public function __toString(): string { $brand = ($this->brand !== null) ? "[{$this->brand->getName()}] " : ""; $name = $this->getLabel(); return $brand . $name; } }